| | |
stat hit counter HELP
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Here is a neat and helpful PHP script that can count unique page views on your website. First you need to open up a new page in your text editor and paste in this code.
then save the page as counter.php
Next open up another new page in your text editor and just save it as hits.txt
Then upload all of the files onto your server and CHMOD hits.txt to 0777 or just 777.
After that open up your main page or the page you will be placing the counter on and pste in the following code.
then save and close that page. If needed, re-upload the file(s) to your server. Very simple and easy to use.
check this for reference:
http://www.doheth.co.uk/codelair/php-mysql/hit-counter
php Syntax (Toggle Plain Text)
<?php $filename = "hits.txt"; $file = file($filename); $file = array_unique($file); $hits = count($file); echo $hits; $fd = fopen ($filename , "r"); $fstring = fread ($fd , filesize ($filename)); fclose($fd); $fd = fopen ($filename , "w"); $fcounted = $fstring."\n".getenv("REMOTE_ADDR");
Next open up another new page in your text editor and just save it as hits.txt
Then upload all of the files onto your server and CHMOD hits.txt to 0777 or just 777.
After that open up your main page or the page you will be placing the counter on and pste in the following code.
php Syntax (Toggle Plain Text)
<?php include ('counter.php'); ?>
check this for reference:
http://www.doheth.co.uk/codelair/php-mysql/hit-counter
Last edited by Shanti Chepuru; Jul 31st, 2008 at 6:00 am. Reason: add
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
![]() |
Similar Threads
- Confusion: Hit counter glitch ? O_O (IT Professionals' Lounge)
- DNS error (Viruses, Spyware and other Nasties)
- Warning: Unexpected character in input: (PHP)
- New to php and need some help with a guestbook (PHP)
- Having prolems with a guestbook (HTML and CSS)
- Reston, Virginia Gost Visitors (Search Engine Optimization)
- Output problems (C++)
Other Threads in the PHP Forum
- Previous Thread: Any recommendations on an easy to follow php registration form tutorial?
- Next Thread: Problem with my dispalyname
| Thread Tools | Search this Thread |
apache api array beginner binary body broken cakephp checkbox class cms code computing cron curl database date date/time delete display dynamic echo email error file files filter folder form forms function functions gc_maxlifetime global google host href htaccess html image include insert ip javascript joomla limit link list login mail memmory memory menu mlm msqli_multi_query multiple mycodeisbad mysql navigation oop parameter parsing paypal pdf php problem query radio random recourse recursion regex remote script search seo server sessions sms snippet source space sql static syntax system table thesishelp tutorial update upload url validator variable video web webdesign wordpress xml youtube






