File size: 1.39Kb
<?
/*
=============================================
Движок: SHCMS Engine
=============================================
Название файла: Безопастность для админской части
=============================================
Official website: http://shcms.ru
=============================================
Разработчик: Shamsik
=============================================
*/
if (!isset($_SERVER['PHP_AUTH_USER']))
{
Header ("WWW-Authenticate: Basic realm=\"SHCMS Admin\"");
Header ("HTTP/1.0 401 Unauthorized");
exit();
}
else {
if (!get_magic_quotes_gpc()) {
$_SERVER['PHP_AUTH_USER'] = mysql_escape_string($_SERVER['PHP_AUTH_USER']);
$_SERVER['PHP_AUTH_PW'] = mysql_escape_string($_SERVER['PHP_AUTH_PW']);}
$query = "SELECT password FROM admin_block WHERE login='".$_SERVER['PHP_AUTH_USER']."'";
$lst = @mysql_query($query);
if (!$lst){
Header ("WWW-Authenticate: Basic realm=\"SHCMS Admin\"");
Header ("HTTP/1.0 401 Unauthorized");
exit();
}
if (mysql_num_rows($lst) == 0)
{
Header ("WWW-Authenticate: Basic realm=\"SHCMS Admin\"");
Header ("HTTP/1.0 401 Unauthorized");
exit();
}
$pass = @mysql_fetch_array($lst);
if ($_SERVER['PHP_AUTH_PW']!= $pass['password'])
{
Header ("WWW-Authenticate: Basic realm=\"SHCMS Admin\"");
Header ("HTTP/1.0 401 Unauthorized");
exit();}
}
?>