Help with log ip address when download

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
SuperX
Forum Newbie
Posts: 3
Joined: Sun Apr 09, 2006 5:56 pm

Help with log ip address when download

Post by SuperX »

I need help to create PHP code for my download page... when a user download the file and when they try to download again, they have to wait for like 10 minutes or so. I need help with IP address log, stuff like that. Thanks! :D
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Just store $_SERVER['REMOTE_ADDR'] in a database along with time() and make sure the time they download the file is more than 600 seconds since the record in the database, or there's no record in the database for that IP.

Note: $_SERVER['REMOTE_ADDR'] might be a public proxy server, in which case you *might* be lucky to find the real IP by checking $_SERVER['X_FORWARDED_FOR']. Essentially, anything that's restricting IP's is not particularly reliable.
Post Reply