Jump to content


This topic is now archived and is closed to further replies.


force REMOTE_ADDR to detect local IP address not IP public

Recommended Posts

this is my real problem:
i have website http://ex.axample.com (subdomain from example.com)
now i dont want all my local network or internet to view it but only my local network with 192.168.10.* ip.

and i use the following script to do that but the result is FAIL
<? $ipne = $_SERVER['REMOTE_ADDR'];
$result = mysql_query("SELECT ipku FROM ip WHERE ipku = '$ipne'");
$num = mysql_numrows($result);
if ($num != "0") {
end_if; ?>
<body> my index content here </body>
<? exit;
} else
<html><body bgcolor=000000 text=red> <center><b> <? echo "Auth code : $num<br>"; echo "Access from $ipne denied<br><h1> Forbidden Area</h1>"; } ?>

and of course i try using htacces but also fail.
you can see the capture here: http://www.webdeveloper.com/forum/attachment.php?attachmentid=7817

Any other Solution? it will apreciate.
Best Regards,

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.