Unstoppable Domains — Get your daily AI drops report

[Php] Logging visitors

SpaceshipSpaceship
Watch

Alex.

Account Closed
Impact
5
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??
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
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.
 
1
•••
im sorry, what i meant was is there a way to log the sites that request the image

thanks for the other info
 
0
•••
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).
 
0
•••
thanks, what do you mean by sanatise?
that should work ok for me, as the usage is for link exchange.
 
0
•••
By sanatise we mean to make the string safe, or to escape it in other words.
 
1
•••
thanks, will rep++ when i get to my pc.
 
0
•••
CatchedCatched

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back