admin: prevent ip spoofing for admin url

This commit is contained in:
Tanguy Pruvot 2017-08-05 02:36:34 +02:00
parent 91fdf629b4
commit 44aa14ddf7

View file

@ -5,12 +5,19 @@ class SiteController extends CommonController
public $defaultAction='index';
///////////////////////////////////////////////////
// Security Note: You can rename this action as you
// want, to customize the admin entrance url...
//
public function actionAdminRights()
{
$client_ip = $_SERVER['REMOTE_ADDR'];
$client_ip = arraySafeVal($_SERVER,'REMOTE_ADDR');
$valid = isAdminIP($client_ip);
if (arraySafeVal($_SERVER,'HTTP_X_FORWARDED_FOR','') != '') {
debuglog("admin access attempt via IP spoofing!");
$valid = false;
}
if ($valid)
debuglog("admin connect from $client_ip");
else