[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

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


Closed Thread
 
LinkBack Thread Tools
Old 06-24-2006, 12:24 AM   #1 (permalink)
Account Closed
 
Join Date: May 2006
Posts: 57
16.60 NP$ (Donate)

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, 03:56 AM   #2 (permalink)
Senior Member
 
lpxxfaintxx's Avatar
 
Join Date: May 2006
Location: Irvine, CA
Posts: 1,060
261.85 NP$ (Donate)

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, 04:36 AM   #3 (permalink)
Senior Member
 
RickM's Avatar
 
Join Date: Sep 2005
Location: Herts, UK
Posts: 3,770
62.06 NP$ (Donate)

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.
__________________
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
RickM is offline  
Closed Thread


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 12:40 PM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85