James60 Posted January 17, 2008 Share Posted January 17, 2008 hello php freaks, i am not a savy php coder. this snippit was given to me & is supposted to create a text file that is automatically updated when someone comes to my site. (www.orehealthquotes.com) but it does not work. what do i need to change to make it work? i have limited knowledge of javascript. thanks james <!-- Add this at the end of the html document just before the </html> tag --> <?php $message = "Visitors"; if(!file_exists("counter.txt") { $fp = fopen("counter.txt", "a"); fclose($fp); } $fp = fopen("counter.txt", "r+"); $str = fread($fp, 1024); $str += 1; echo("<br>" . $message . ": " . $str); fwrite($fp, $str); fclose($fp); ?> Quote Link to comment https://forums.phpfreaks.com/topic/86499-hit-counter-does-not-work/ Share on other sites More sharing options...
revraz Posted January 17, 2008 Share Posted January 17, 2008 You probably have it in the wrong area since I dont even see the Visitors echo on your page. Try putting it right under your Last Update instead. Also, your page name has to be .php for it to work and your server needs to support .php code. Quote Link to comment https://forums.phpfreaks.com/topic/86499-hit-counter-does-not-work/#findComment-441994 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.