chadrt Posted March 21, 2009 Share Posted March 21, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/150451-solved-protecting-a-script-using-ip-check-and-die/ Share on other sites More sharing options...
redarrow Posted March 21, 2009 Share Posted March 21, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/150451-solved-protecting-a-script-using-ip-check-and-die/#findComment-790186 Share on other sites More sharing options...
chadrt Posted March 21, 2009 Author Share Posted March 21, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/150451-solved-protecting-a-script-using-ip-check-and-die/#findComment-790191 Share on other sites More sharing options...
redarrow Posted March 21, 2009 Share Posted March 21, 2009 I think you have,cracked the solution to your problem mate. Quote Link to comment https://forums.phpfreaks.com/topic/150451-solved-protecting-a-script-using-ip-check-and-die/#findComment-790193 Share on other sites More sharing options...
chadrt Posted March 21, 2009 Author Share Posted March 21, 2009 Thank you very much for your help!! Quote Link to comment https://forums.phpfreaks.com/topic/150451-solved-protecting-a-script-using-ip-check-and-die/#findComment-790199 Share on other sites More sharing options...
DeanWhitehouse Posted March 21, 2009 Share Posted March 21, 2009 lol You might want to try code before asking for help with it Quote Link to comment https://forums.phpfreaks.com/topic/150451-solved-protecting-a-script-using-ip-check-and-die/#findComment-790240 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.