matak
Jul 30 2007, 05:38 AM
This is really simple script. Well at least this part is, but it could be extendable. Only problem is that it's not really for massive websites with hundread of visitors a day, but rather for small ones. But it is a good script to figure out how to make a visitor counter script. Anyway here's the snippet. CODE <?php function getVisits($variable) {
$visits = array();
if ($handle = opendir('stats/')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { array_push($visits, $file); } } closedir($handle); } $key = array_search($variable, $visits); if ($key !== FALSE) { echo "Posjeta do sada: ".count($visits); } elseif ($key === FALSE){ $file = fopen("stats/".$variable, 'a'); fwrite($file, $variable); fclose($file); getVisits($variable); } } ?> Just call it with getVisits($_SERVER['REMOTE_ADDR'])., and be sure to have that stats directory in same root as file in which script is executed. Comments or improvments are welcome.
Reply
reconraiders
Jul 30 2007, 07:27 AM
Good work! Looks pretty good to me. I might use this but maybe use MySql instead of flat files. I just like SQL
Reply
matak
Jul 30 2007, 07:43 AM
Ok, fast reply works again  Yeah, mySQL is great, this is like i stated for small sites with less than 10(0) visitors a day  . I'm extending the script so it saves in directories based on a date value, and stuff like that, so that later i don't have like millions of files.
Reply
Recent Queries:--
wap chat flat script - 654.67 hr back. (1)
Similar Topics
Keywords : unique visitors script file unique visitors script sessions- Linux/ Apache /mod_rewrite Issue
- Error when accessing a file (4)
- Many Php Script Sites
- (16)
Hi I find many sites has PHP scripts :: http://www.proxy2.de/scripts.php http://www.free-php.net
http://knubbe.t35.com/ http://www.ngcoders.com/ http://www.oxyscripts.com/
http://www.phparena.net/ http://www.1phpstreet.com/ http://px.sklar.com/
http://www.scoznet.com/ http://php.resourceindex.com/ /blink.gif' border='0'
style='vertical-align:middle' alt='blink.gif' /> ...
Very Simple Online Now Script
- This is a very simple online now script. (4)
Hi all, Its Aldo. anyways, I wont be using the method of pagination, i will just tell you how to
make a basic online now script. When someone logs in, now take into consideration that the name of
the username input is username ( First ,create a table in your database saying online now and add 2
fields to it. id and username CODE id type=integer(INT) , auto increment, length =255
and username = VARCHAR length=the limit a username should be in your site now from there we take
off : CODE <?php //logged.php //authentication script //connection scri...
Guessing Php Script
- (2)
I am looking for: freeware php quess the person in the photo game script...
Php Downloads Script
- (4)
I've been looking all over the net for a PHP script which can provide an interface to browse a
downloads database. The database could be powered by MySQL. If you know a script like this, please
post it here. Thanks in advance, Ironchicken....
Php Guest Online Script
- (3)
make an index.php copy and paste this code CODE <?php $db_host = "localhost";
$db_user = "root"; $db_pass = ""; $db_name = "test";
$dbc = mysql_connect($db_host, $db_user, $db_pass); $dbs =
mysql_select_db($db_name); $tm = time(); $timeout = $tm -
(30*60);
if($_SERVER["REMOTE_ADDR"]){$ip=$_SERVER["REMOTE_ADDR
"];} else{$ip=$_SERVER["HTTP_X_FORWARDED_FOR"];}...
Watermark Your Image With Simple Php Script
- found it on the net (35)
This script was found on the net http://tips-scripts.com/?tip=watermark#tip B&T's Tips &
Scripts site. Just in case the site may not show, I will include the code here: List of things
needed: 1. your image in any format 2. watermark image--in gif format with transparent background 3.
script below with name (i.e. watermark.php) CODE <?php // this script creates a watermarked
image from an image file - can be a .jpg .gif or .png file // where watermark.gif is a mostly
transparent gif image with the watermark - goes in the same directory as this script // ...
How To Make Php Newsletter Script
- (3)
I have seen a post on here somewhere which shows how to make a simple newsletter php script. I
cvant find it anywhere and I wanted to ask some questions of the author. Does anyone know the one I
mean? Cheers ...
How To Make A View New Post Script?
- (5)
Ok so i'm still working on the forum software i posted about a while back, but I have no idea
how to do this. I want to make a view new post script, as this is one of the main things that my
forum software dose not have that all other forums have. so does any body have an idea on how i
would do this? Thanks....
Html Code Tester. Online Script
- (15)
Yes, yes. I have another script that I have written and I am distributing. I am not entirely sure if
this works. I have not tested it yet, but I will later and post back with a demo and fix it up.
Current script: CODE <?php //Save this as something like htmltest.php function
CheckForm() { $html_unsafe=$_POST['code']; //Gives us our user
input $html_safe=str_replace("<?php"," ",$html_unsafe);
//Starts security measures $html_safe=str_replace("?>","
",$html_sa...
Need Help Installing Dolphin Community Script!
- (5)
I'm not sure if this is the right place to post this but I really need help in installing the
dolphin community script. I have absolutely no previous experience of scripts or programming. I
would really appreciate if someone could walk me through it step-by-step, or even do it for me by
logging into my cpanel. I have tried to install it my self but I'm a little confused. I'm
sure it won't take very long at all for someone who has done this before....
Php Configuration File
- "config.php" (16)
I did create this topic mainly because I want to know everything about that configuration file. I
will post other replies if I want to know more depending on your experience. Is this code correct
for that file: CODE <? $host="localhost"; $dbname="XXX";
$dbuser="XXX"; $dbpass="XXX";
$connection=mysql_connect($host, $dbuser, $dbpass) or
die(mysql_error()); mysql_select_db($dbname) or
die(mysql_error()); ?> Add your suggestions or i...
Getting List Of Directories And Files Using Php
- PHP Function for Directory and File List (6)
is there a php function that lists the content of some folder.... example: /New folder new.txt
left.gif download.zip dc.exe ....so is there..? /rolleyes.gif' border='0'
style='vertical-align:middle' alt='rolleyes.gif' /> ...
Parse: Error Unexpected T_lnumber
- php parse error when running script (4)
Hi. I've just created a php script. The main object of the script is to delete some old files
and replace it with a new file with some new content, effectively moving the contents from one file
to another. These are the first 50 lines of the file: /* Calculate For The "A" Group - The
Latest Games ID */ $a_B = 002; while(file_exists("a_" . $a_B . ".dat")) {
$a_B++; } $new_page_contents = " " . $_POST . " " . $_POST . "
include \"/home/cmatcme/public_html/footer.php\"; ?> "; $a_stream = fopen(&...
Include File.php?id=something
- using the include() function (13)
Well, I am making a full CMS system for my site, and want to make the index.php file to include the
view.php?id=1 file. I tried with this code, but it didn't work: CODE <?php include
'view.php?id=1' ?> This is the error I get: CODE Warning:
main(view.php?id=1) [function.main]: failed to open stream: Invalid argument
in C:\server\xampp\htdocs\test\index.php on line 1 Warning:
main() [function.include]: Failed opening 'view.php?id=1' for inclusion
(i...
Script: Php Jukebox
- A one file script! (4)
This scripts is so simple, you dont need to edit ANY of it! All you have to do is make a folder
called 'songs' and put some audio files in it. Here is the whole page, I named it index.php
and put it in a folder called 'music': CODE <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"> <html> <head>
<title>PHP jukebox</title> </head> <body> <!-- ©2005 Craig
lloyd. All rights reserved. Visit cragllo.com for more sc...
What Kind Of Script Do You Need ?
- post here and get free script (15)
Hi everybody sorry if i posting here , i know I want design free PHP script and i dont know
webmasters what kind of scripts want i think its better to aks here becuase trap17 is very nice
webmasters forum So , Plz post here what kind of script with details you need ! sorry may en
is not very well for example you need "upload center" : write "upload center" with upload center
options ( like Ajax , Fast , multi lan and ... ) with this post we can give script details and
webmasters idea /smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile....
Script Help Required: Undefined Variable
- A fault I cannot spot in PHP (3)
Hi, when running a PHP script I keep getting the error: QUOTE Notice: Undefined variable: bret
in c:\program files\easyphp1-8\home\poll.php on line 294 Notice: Undefined
variable: bret in c:\program files\easyphp1-8\home\poll.php on line 294 (And,
yes, I get it twice). The code related to the variable is as follows: CODE function
LogString($string,$type) { $t_log = "\n";
$t_log .=
$this->globaldata->server_vars['REMOTE_ADDR']."...
Creatting A Playlist Through Php
- script help needed (5)
Hi I am trying to make a script so that i can insert songs into a playlist, but i need a script in
which it opens the playlist file and removes the closing tag at the end, so before i can add more
entrys. e.g CODE <atx> <entry>Location 5</entry> <entry>Location
4</entry> <entry>Location 3</entry> <entry>Location
2</entry> <entry>Location 1</entry> <atx> But to add more entrys
i would have to get rid of the atx, then use the fputs to place the new entry into the file. ...
Free Auction Script
- Any Suggestions? (6)
Any free auction script suggested? I want it to be as many practical functions as possible, yet
easy to manage. And more importantly, it is free! Appreciate your kind suggestions!...
Need Some Help In File Browser
- listing all sub folders and files in them. (8)
Hey I want to create a very simple file browser, so that, it reads all the sub-folders which are
places in a directory, and the files inside the sub-folders (It reads only files inside sub-folders
and list them in simply. ) Also, it creates a directory (any name) inside each sub folder. My
Following code reads on the files inside the main directory, it does not read the files inside the
sub-folders.. I appreciate any help. CODE <? $path = "./"; $dir_handle =
@opendir($path) or die("Unable to open $path"); whil...
How Do I Connect To Live Database With Php Script?
- while being hosted with ComputingHost (6)
I am not new to programming. I want to create a form to add some values into my tables, the code
are all working. But I am not sure what is the URL to connect to my site's database. All along,
I have been testing through MAMP, which provides a local copy of mySQL. Can anyone lend me a hand?
My site's URL is http://limetouch.com/ ...
Php Rediret Script
- (12)
Ok, what I am trying to do is this. Re-direct a domain name called: avalon.asn.au to
preschool.stmarksavalon.org.au I have created a script that will re-direct within the a folder.
However, the avalon.asn.au and stmarksavalon.org.au are PARKED Domains. Any ideas on how to create
this PHP Redirect Script please?...
Updating Php File Through A Web Form
- (5)
Hello, i'm not sure if this can be done with php or not but what i need is a way to make an php
file that have an html form on it and it will take the info you put in to that form and write it to
an existing php file, for example: if i have the file news.php and the file news_update.php. if you
went to news_update.php you would get an form with a text area for you to write a new addition for
the news.php file and when you hit submit it will add what you typed in the form to the file
news.php. If this is going to be a big code or a hard one to make but some one think...
Download Script For Mp3 Files
- (0)
Hello, I'm looking for a download script for sound files (e.g. mp3, avi, wma, and other ones).
i have found a few download scripts but they would not work for sound files for some reason. also
this will not be used for allowing downloading of illegal or riped music, what i will be using this
script for is i'm making a site for my church and the pastor wants to be able to recored the
services and then have me upload them to the site so that the church members can download them for
what ever reason. If some one could tell me how to make one or could show me a plac...
Library Script
- Where? (6)
Hello, everyone. Anyone knows where I can get a library script that acts like CMS script software,
you can add books or delete them. I want to build virtual online library which can be accessible to
everyone. Or just give me some advices how to make it build. I'm a novice in programming....
Wappy Buddy V1.10 - Tibia Gold Edition By Wappy & Jon Roig
- the official wap download script (3)
By downloading this script you are agreeing to the license and terms outlined below /biggrin.gif"
style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> QUOTE /** * *
@package: wappyBUDDY - Tibia Gold Edition * @version: 1.10 2006/10/01 00:00:01 wappy * @copyright:
©2003, 2006 jon roig, wappy * @release notes: this is the first official release of my download
script despite pirate and incomplete copies floating around that were stolen from one of my previous
servers. The next release will follow very shortly * @terms: wappyBUDDY is free softw...
Forum Script
- (3)
Hello, i'm wanting to start making my own forum software but i dont know where to start or what
i need to know in order to do this. I know i will need php and mysql but what else, and could some
one point me to a good site were i could learn php and mysql. Thanks ...
How Would I Go About Making A Simple "counting" Script?
- (3)
I plan on making a script for basic voting between different options, and I'd like to know what
PHP coding I would require. Basically, each choice will be as simple as this: CODE <form
method="post" action="process.php"> Best falsetto?<br><br>
<input type="radio" name="1"> Person A<br> <input
type="radio" name="2"> Person B<br> <input type="submit"
value="Submit"> </form> What PHP would be used to basically add 1 value to a...
Something I Discovered With Sessions [php]
- (4)
Hello All, I've been doing a lot of PHP programming since I last posted here. I've run
across two security related things with sessions that you may or may not know about. The first one
pertains to the session id, or the id that PHP assigns each computer when a session is created.
This id is either stored in a cookie (search for PHPSESSID) or through the URL as GET data.
Remember that all session data is stored server side; this ID is the only thing that PHP will use to
differentiate your computer from someone else's. While I was programming for Plug ...
Looking for , unique, visitors, script, flat, file, unique, visitors, script, sessions,
|
*RANDOM STUFF*
*SIMILAR VIDEOS*
Searching Video's for , unique, visitors, script, flat, file, unique, visitors, script, sessions,
*MORE FROM TRAP17.COM*
|
advertisement
|
|