31
Tutorials, References, and Examples / Re: [PHP]blocking ip address from viewing site
« on: September 26, 2005, 07:17:30 pm »<?php
include "nav.html";
print "<font color=\"white\">". $_SERVER['REMOTE_ADDR'] ."</font>";
if $_SERVER['REMOTE_ADDR'] = 127.0.0.1 Then {
echo "<meta http-equiv=\"refresh\" content=\"5; url=http://www.mysite.com/dir/noview.php\" />" }
?>
Why doesn't it work?
Edit: Returns this message
Parse error: parse error, unexpected T_VARIABLE, expecting '(' in /home/deadly7/public_html/ on line 15Quoteif $_SERVER['REMOTE_ADDR'] = 127.0.0.1 Then {That is line 15.
Although this has been resolved; Mark since you're using a Boolean, try to put the include statement on the return true section of the script, I.E.
<?php
if($_SERVER['REMOTE_ADDR'] == "127.0.0.1")
{ ?>
<meta http-equiv="refresh" content="5; url=noview.php">
<?php
} else {
include "nav.html";
}
?>