Page 1 of 1
How restrict the IP access the my website
Posted: Thu Feb 19, 2009 9:32 pm
by lengyun
I use the php make static website,but i think to restrict other IP address access my website,please tell me,thanks!
Re: How restrict the IP access the my website
Posted: Fri Feb 20, 2009 3:43 am
by vmmene
use the $_SERVER['REMOTE_ADDR'] to capture the ip and check the ip's if u want allow the ip the redirect to your site othere wise block that ip.
Re: How restrict the IP access the my website
Posted: Fri Feb 20, 2009 5:30 am
by JAB Creations
.htaccess
#Example comment, below is an example of a spammer's IP
deny from 58.247.46.114
Re: How restrict the IP access the my website
Posted: Fri Feb 20, 2009 6:12 am
by papa
vmmene wrote:use the $_SERVER['REMOTE_ADDR'] to capture the ip and check the ip's if u want allow the ip the redirect to your site othere wise block that ip.
And incorporate that with a MySQL table that stores the banned ip's.
Re: How restrict the IP access the my website
Posted: Fri Feb 20, 2009 11:02 am
by pickle
Note that IPs can be spoofed, so you can't rely on the IP 100% to restrict access.
Re: How restrict the IP access the my website
Posted: Fri Feb 20, 2009 4:34 pm
by josh
Yes IP can be spoofed, but response cannot be read, so a way to circumvent that would be to utilize a javascript redirect to a secret page. If attacker cannot read response he cannot know the secret key. This probably isn't practical for front-ends. but should be employed on requests like POSTing to the admin panel