Jump to content

[SOLVED] protecting a script using IP check and die()


chadrt

Recommended Posts

I am trying to protect a script and I think I found a solution but I was hoping someone out here could provide me with something that might be smother or tell me if this is sufficient enough to do the trick.

 

<?
$ip = $_SERVER['REMOTE_ADDR'];
if ($ip=='192.168.1.1') {
} else {
die( "Protected Script - Your server does not have permission to use this resource!");
}

// Rest of Code below here!
?>

 

That code would be at the very top of my script to only allow only a specific server to use the page.  Thank in advance for anyone that has suggestions.

 

Chad

That means only the person that got a internal ip, can see the page.

 

intranet no internet what the point mate.

 

 

just don't have the server live, and only run on the internal network only.

 

tell Apache/php.ini to run off the ip in quistion

 

 

I set that IP only as a demonstration purpose I have an external IP that will go there, but I didnt want to create any problems with the server publicly displaying that IP, that I have planned to use my script with.

 

I just wanted to make sure that script was going to function without a ton of problems.  There is little security involved with my basic script that I have built, sql injection etc that could wreak havoc.

Archived

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

×
×
  • 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.