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 [php] logging visitors

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 12-31-2006, 05:30 AM THREAD STARTER               #1 (permalink)
Account Closed
 
Alex.'s Avatar
Join Date: Nov 2006
Location: Uk
Posts: 601
Alex. is on a distinguished road
 


Ethan Allen Fund Third World Education

[php] logging visitors


Hi, i am planning on running an affliate scheme.

I want to use the GD function to create the image, and then Id like a function to log the site that's requesting the image, so i can add the url to the DB.

Is there a function / method that can do this for me??
Alex. is offline  
Old 12-31-2006, 06:52 AM   #2 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
in all honesty it would be fairly easy to write something yourself.

What I would do is the following:-

Make a htaccess mod rewrite rule to have change a url of something like http://www.yourdomain/username/ to http://www.yourdomain.com/image.php?user=username

Also create a database with a visitor referrer table with 3 fields 1 being a unique id another being their username and another being the count (username would match what is being changed in the url).

When someone gets the image simply do a statement such as UPDATE tbl_name SET count=count+1;

After this simply display the image.

Another method for the database would be to have 1 table for the referrer and another for the visitors, the referrer table would be the same as before but without the count field. In the visitor field you would store id, referrer id, and any other details that may come in handy such as a timestamp and their ip and possibly browser agent etc.
Peter is offline  
Old 12-31-2006, 05:40 PM THREAD STARTER               #3 (permalink)
Account Closed
 
Alex.'s Avatar
Join Date: Nov 2006
Location: Uk
Posts: 601
Alex. is on a distinguished road
 


Ethan Allen Fund Third World Education
im sorry, what i meant was is there a way to log the sites that request the image

thanks for the other info
Alex. is offline  
Old 12-31-2006, 06:26 PM   #4 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
If people are not going to sign up then the only way I can think of is to use $_SERVER['HTTP_REFERER'] which shows what the users browser claims to be the referrer to the current page, in this case the page that is calling the image.

However before using this make sure you sanitize it and do not 100% rely on it as it can be spoofed (as can anything else provided by the user) or may not be sent at all (due to example proxies or some firewalls).
Peter is offline  
Old 12-31-2006, 06:45 PM THREAD STARTER               #5 (permalink)
Account Closed
 
Alex.'s Avatar
Join Date: Nov 2006
Location: Uk
Posts: 601
Alex. is on a distinguished road
 


Ethan Allen Fund Third World Education
thanks, what do you mean by sanatise?
that should work ok for me, as the usage is for link exchange.
Alex. is offline  
Old 12-31-2006, 07:11 PM   #6 (permalink)
Senior Member
Join Date: Dec 2006
Location: England
Posts: 1,568
Matthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud of
 


Adoption Breast Cancer Breast Cancer Cancer Survivorship
By sanatise we mean to make the string safe, or to escape it in other words.
Matthew. is offline  
Old 12-31-2006, 07:55 PM THREAD STARTER               #7 (permalink)
Account Closed
 
Alex.'s Avatar
Join Date: Nov 2006
Location: Uk
Posts: 601
Alex. is on a distinguished road
 


Ethan Allen Fund Third World Education
thanks, will rep++ when i get to my pc.
Alex. 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 07:44 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