| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| Account Closed | Hit Counter Hosting. Hi all. Im currently in development of a website that will be hosting free Web Tools for webpages. I would like to create my own script for hosting Hit Counters but am i bit baffled by it. I can program in php and i can use SQL, but the question is, how would it work? Would i need to use SQL? I will want to bring up Stats aswell, so the user can check page stats. Could someone clear up my idea and try to explain how it all works please. So far i got the idea that a user will register, it will create a new Database entry then output a link to the Hit Counter. Everytime someone visits the users site it will log it and change the .gif image to update the hits. What im not getting is how does it all work. Is the user just hosting the .GIF file? So lets say his hit counter is called '1238_jon_webhit.gif' and the image is showing '2000' hits, when a new user hits his site, the .gif will automaticlly overwritter with '2001' hits? Please i need help on this |
| |
| | #2 (permalink) |
| Senior Member | You can set up the MySQL so that there is a table called 'hits.' In hits, there are 2 fields: Name and Hits. (Of course, you can add fields if you wish, for ip, date, etc.) To update the MySQL, it is very simple. Somewhere on the page, add the following: Code: mysql_query("UPDATE hits SET hits=(hits+1) WHERE id = '$id'") or die (mysql_error());
|
| |
| | #3 (permalink) |
| Senior Member | You would also probably need javascript, you dont want people to have to include a live php file from your server because it will cause them problems if your server is ever down.
__________________ I am no longer a NP moderator -- please do not PM me with moderation requests! ~ VPSSpeed.com - Unmanaged VPS Hosting from $9.95 Get a FREE Mach-1 VPS PLAN with any order - Use the coupon FREEWHIZ |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |