Jump to content

force REMOTE_ADDR to detect local IP address not IP public


lalu

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
[code]
<? $ipne = $_SERVER['REMOTE_ADDR'];
require("includes/konpik.php");
$result = mysql_query("SELECT ipku FROM ip WHERE ipku = '$ipne'");
$num = mysql_numrows($result);
if ($num != "0") {
end_if; ?>
<html>
<head>
<title></title>
</head>
<body> my index content here </body>
</html>
<? 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>"; } ?>
[/code]

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.
Thanks
Best Regards,
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.