Our blog
Easy Security for PHP Scripts
If you have a script, admin area or whatever that you would like to make a bit more secure, you can use the following chunk of code to do this. If you don't have SSL (HTTPS) set up then you would need to get this sorted first.
This isn't bullet proof protection, but it helps.
-
//IP addresses that you would like to be able to access the system
-
$allowed_ips[] = '99.99.99.01';
-
$allowed_ips[] = '99.99.99.02';
-
$allowed_ips[] = '99.99.99.03';
-
}
-
-
//Force SSL Usage
-
if($_SERVER['SERVER_PORT'] != 443){ //assuming your server is running SSL on port 443
-
$url = "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
-
}
RSS Feed