NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Hit Counter Hosting.

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 06-24-2006, 01:24 AM THREAD STARTER               #1 (permalink)
Account Closed
Join Date: May 2006
Posts: 57
MixedByDJs is on a distinguished road
 



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
MixedByDJs is offline  
Old 06-24-2006, 04:56 AM   #2 (permalink)
Senior Member
 
lpxxfaintxx's Avatar
Join Date: May 2006
Location: Irvine, CA
Posts: 1,082
lpxxfaintxx is just really nicelpxxfaintxx is just really nicelpxxfaintxx is just really nicelpxxfaintxx is just really nice
 



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());
I'm not 100% sure, but if you set a setting in your .htaccess, it will make php files act as images. I haven't done much with image manipulation, so I was probably wrong..
lpxxfaintxx is offline  
Old 06-24-2006, 05:36 AM   #3 (permalink)
Senior Member
 
RickM's Avatar
Join Date: Sep 2005
Location: Herts, UK
Posts: 3,796
RickM has a brilliant futureRickM has a brilliant futureRickM has a brilliant futureRickM has a brilliant futureRickM has a brilliant futureRickM has a brilliant futureRickM has a brilliant futureRickM has a brilliant futureRickM has a brilliant futureRickM has a brilliant futureRickM has a brilliant future
 


Cancer Survivorship Save The Children Save The Children Cancer Animal Cruelty Child Abuse Cancer Survivorship 9/11/01 :: Never Forget Animal Cruelty Child Abuse Animal Rescue Animal Cruelty Protect Our Planet Protect Our Planet Protect Our Planet Animal Cruelty Save a Life
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.
__________________
RickM

Web Design Forums - Over 22,000 Web Designers & Programmers just like you!
WSDReg - Affordable Domain Registration. Serving NP members since 2006!
RickM is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 06:45 PM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger