########################################## # # # Jinx M's Basic Hit Counter # # # # www.jinxm.co.uk spam@jinxm.co.uk # # # ########################################## ############################################################################################### # # Although there are probably better ways of doing this, I had to work it out for myself. # Its a simple script looking at it now, yes, but working out how to do it was a learning # process for me. # # So please, don't pass this script off as your own work or make money out of it in any way. # If you distribute it, please distributed it along with the readme.txt file. # ############################################################################################### #version 1.0 # Righto, get all the variables and stuff from the edit.me file include ('public/edit.me'); # set a session ID session_start(); # This is the bit which adds to the count.txt file if ($count_what == 'visitors') { # First it creates a session Id for each visit so that it counts # visits rather than how many times a page is loaded. if (!$PHPSESSID) { $thefile = file("public/count.txt"); $count = implode("", $thefile); $count++; $myfile = fopen("public/count.txt","w"); fputs($myfile,$count); fclose($myfile); } # done } else { # Else it will count every page load $thefile = file("public/count.txt"); $count = implode("", $thefile); $count++; $myfile = fopen("public/count.txt","w"); fputs($myfile,$count); fclose($myfile); } ?>