Zend - The PHP Company




Security

Add Code


static ip page  

Type: code fragment
Added by: hansolo
Entered: 26/09/2001
Last modified: 31/10/2000
Rating: - (fewer than 3 votes)
Views: 5625
Submit to this page from a form with a hidden field. Checks that field and your ip address. Good if its static.


<?php
$ip 
GetHostByName($REMOTE_ADDR);
if ((
$ip!="24.43.234.25")||($cool!="some^&%$^%thing")) {
   echo 
"<script language='JavaScript'><!--n";
   echo 
" site='http://www.disney.com'n";
   echo 
"window.location.replace(site);n";
   echo 
"//--></script>n";
}
else{
   echo 
date("l, F d, Y",time()); //ex.Friday, September 21, 2001
   
echo "<br><br><strong>Welcome YourName</strong><br>n"
}
?>


Usage Example


/*call the page from a form*/
echo "<form action='cgi/secret.php' method='post'>n";
echo "<input type='hidden' name='cool' value='some^&%$^%thing'n";
echo "<input type='submit' value='enter'></form>n";


Rate This Script





Search



This Category All Categories