<?php
/**
* Quick and dirty and easy phpinfo() protection.
* (Don't leave this on your server.)
*/
$whitelsit = array('0.0.0.0'); // Whitelist certain IP addresses
// Find the best IP address for the viewer
$ip =& $_SERVER['REMOTE_ADDR'];
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip =& $_SERVER['HTTP_CLIENT_IP'];
} else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip =& $_SERVER['HTTP_X_FORWARDED_FOR'];
}
// Redirect the user if their IP address is not in the whitelist
if (!in_array($ip, $whitelsit)) {
header('Location: https://codepad.co'); // (Change this domain name to your home page)
// Or display an error message instead:
/* echo 'GET LOST LOSER!';*/
exit;
} else if (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] !== 'on') { // Force HTTPS
header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
exit;
}
phpinfo();
exit;
This should be a more secure means to a less secure method to peek at your phpinfo()
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.