Ip

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
User avatar
radium35
Forum Commoner
Posts: 50
Joined: Mon Nov 10, 2008 5:05 pm
Location: USA
Contact:

Ip

Post by radium35 »

How would you for example restrict the access to 1 ip per 24 hours to a page?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Ip

Post by pickle »

When a page is accessed, record the IP the user has ( look at $_SERVER for that ) and the timestamp it was used. On subsequent accesses, check if an entry exists for the last 24 hours & if it does, only allow users from that IP to continue.

Note though that it is possible to spoof IPs, or even for multiple computers to appear as one IP (think: router).
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
radium35
Forum Commoner
Posts: 50
Joined: Mon Nov 10, 2008 5:05 pm
Location: USA
Contact:

Re: Ip

Post by radium35 »

so i would insert the ip into the DB
Post Reply