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

Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

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.

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.