ScottCFR Posted June 26, 2010 Share Posted June 26, 2010 Hello, This is my first time on these forums, I don't know if I am posting in the correct category. But anyways, I am trying to make a page on my site where I want to restrict to certain IPs. I don't have any code started, that's because I don't know what to do in this situation. Thanks, Scott W. Link to comment https://forums.phpfreaks.com/topic/205914-questions-d/ Share on other sites More sharing options...
Pikachu2000 Posted June 26, 2010 Share Posted June 26, 2010 Forcing authentication is a better option than allowing certain IP addresses. IP addresses change, can be spoofed, etc. Link to comment https://forums.phpfreaks.com/topic/205914-questions-d/#findComment-1077504 Share on other sites More sharing options...
ScottCFR Posted June 26, 2010 Author Share Posted June 26, 2010 I though of that, but I was worried about leaked passwords. Is there a way I can authenticate and verify IP? Link to comment https://forums.phpfreaks.com/topic/205914-questions-d/#findComment-1077506 Share on other sites More sharing options...
inversesoft123 Posted June 26, 2010 Share Posted June 26, 2010 Forcing authentication is a better option than allowing certain IP addresses. IP addresses change, can be spoofed, etc.[/Quote] That is true, But here is the solution for what you asked.. $ip = $_SERVER['REMOTE_ADDR']; if($ip != "xxx.xxx.xxx.xxx" || $ip != "xxx.xxx.xxx.xxx" || $ip != "xxx.xxx.xxx.xxx") { echo "Access Denied!"; } else { echo "Page content"; } Link to comment https://forums.phpfreaks.com/topic/205914-questions-d/#findComment-1077513 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.