[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 12-31-2006, 04:30 AM   #1 (permalink)
NamePros Regular
 
Alex.'s Avatar
 
Join Date: Nov 2006
Location: Uk
Posts: 601
133.80 NP$ (Donate)

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??
__________________
_\|/_ _\|/_ _\|/_ _\|/_ _\|/_ :confused:
Alex. is offline  
Old 12-31-2006, 05:52 AM   #2 (permalink)
Senior Member
 
Peter's Avatar
 
Join Date: Nov 2003
Location: Scotland
Posts: 4,900
0.60 NP$ (Donate)

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, 04:40 PM   #3 (permalink)
NamePros Regular
 
Alex.'s Avatar
 
Join Date: Nov 2006
Location: Uk
Posts: 601
133.80 NP$ (Donate)

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
__________________
_\|/_ _\|/_ _\|/_ _\|/_ _\|/_ :confused:
Alex. is offline  
Old 12-31-2006, 05:26 PM   #4 (permalink)
Senior Member
 
Peter's Avatar
 
Join Date: Nov 2003
Location: Scotland
Posts: 4,900
0.60 NP$ (Donate)

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, 05:45 PM   #5 (permalink)
NamePros Regular
 
Alex.'s Avatar
 
Join Date: Nov 2006
Location: Uk
Posts: 601
133.80 NP$ (Donate)

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.
__________________
_\|/_ _\|/_ _\|/_ _\|/_ _\|/_ :confused:
Alex. is offline  
Old 12-31-2006, 06:11 PM   #6 (permalink)
Stud Sausage
 
Join Date: Dec 2006
Location: England
Posts: 1,546
34.41 NP$ (Donate)

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, 06:55 PM   #7 (permalink)
NamePros Regular
 
Alex.'s Avatar
 
Join Date: Nov 2006
Location: Uk
Posts: 601
133.80 NP$ (Donate)

Alex. is on a distinguished road

Ethan Allen Fund Third World Education
thanks, will rep++ when i get to my pc.
__________________
_\|/_ _\|/_ _\|/_ _\|/_ _\|/_ :confused:
Alex. 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 04:09 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