I'm trying to compare the user's IP to allowed IP's. It's saying that my IP isn't allowed when it echos 97.103.49.59You do not have permission to do that.
I'm trying to compare them like so:
$ip_address = $_SERVER['REMOTE_ADDR'];
echo "$ip_address";
if(ip_adress=="97.103.49.59") {
header('Location: Blog.php');
} else {
echo "You do not have permission to do that.";
}
if(ip_adress=="97.103.49.59") {
should read
if($ip_address=="97.103.49.59") {
You forgot the $ in front of ip_adress.
if($ip_address=="97.103.49.59")
should do the trick.
if($ip_adress=="97.103.49.59") {
You forgot $
there..
It should be
if($ip_address=="97.103.49.59")
you can also allow or deny specific range
$start = ip2long("97.103.49.1");
$end = ip2long("97.103.49.255");
$ip = ip2long($_SERVER['REMOTE_ADDR']);
if ($ip >= $start && $ip <= $end) {
// In range
}