| | |||||
| ||||||||
| CODE This forum is for posting code snippets and example scripts that aren't quite tutorials, but could be useful for others. You may post code snippets and/or completed scripts that you've written and want to share here. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| Senior Member Join Date: Aug 2002
Posts: 1,255
![]() ![]() | PHP: text/graphical hit/visitor counter in PHP This is a simple hit/visitor counter I threw together for anyone to use on their web site if they want. Feel free to modify it to suit your needs. You can download the entire script and installation instructions in the attached zip file. You can view a demo of it functioning as a text counter and counting only unique visits here http://www.coolesthost.com/simpcount...impcounter.php and a demo of it functioning as graphical hit counter and counting all hits here http://www.coolesthost.com/simpcounter/simpcounter.php. You can view the code below. PHP Code: |
| |
| | #4 (permalink) | ||||
| New Member Join Date: Dec 2004
Posts: 2
![]() | i dont know if this is the right place to post but i try... i'm trying to use your simpcounter and follow the instalation notes but when i comming to the step: "Call up the example.php file in your browser to get the code to add to your pages" i only recieve this
and allso text based and graphical counter but it still wont work Do somone know what the problem is?
Last edited by Tresk; 12-26-2004 at 11:26 AM.
| ||||
| |
| | THREAD STARTER #5 (permalink) |
| Senior Member Join Date: Aug 2002
Posts: 1,255
![]() ![]() | It looks the script is not showing the full path in the example for some reason or another. If you try it like this it should work: <?php include "c:\inetpub\wwwroot\simpcounter\simpcounter.ph p"; ?> Actually I just looked at the error again and it's saying the file is not found so I am not real sure. Maybe try this one as well if the above don't work: <?php include "c:\inetpub\wwwroot\simpcounter.php"; ?> Or throw this in a php file in the same directory as the simpcounter.php file: <?php include "simpcounter.php"; ?> Maybe one of them will work. If not, then if you can show your phpinfo() for the server and provide a link to the script with the errors we could probably figure it out.
Last edited by deadserious; 12-27-2004 at 10:16 PM.
|
| |
| | #6 (permalink) |
| New Member Join Date: Dec 2004
Posts: 2
![]() | it working now but im not sure what i did, to get it to work and i use this line now: <?php include"./simpcounter/simpcounter.php";?> but now i find that count.txt just showing 4 in it...all the time but the counter on the page show 273 and it's more correct allso iplog.txt is emty....all the time. not a big problem really, but still anoying anyway....thx for your time.... |
| |
| | #8 (permalink) |
| NamePros Member Join Date: Oct 2003
Posts: 126
![]() | If you're on a cPanel platform, instead of count.txt I would recommend using: /home/{YOUR_USERNAME}/count.txt Replace {YOUR_USERNAME} with your server user name. This won't allow anyone to see your counter unless they're on your main site. |
| |