Просмотр файла mp.php

Размер файла: 1.46Kb
<?php
require_once 'includes/start.php';
require_once 'includes/functions.php';
require_once 'includes/header.php';
require_once 'themes/' . $config['themes'] . '/index.php';

if (!is_user () or !is_admin (array (101, 102, 103, 105)) or (isset ($_SESSION['mpanel_password']) and $_SESSION['mpanel_password'] === trim (file_get_contents (DATADIR . 'mpanel_pas.dat'))))
{
	header ('Location: pages/error.php?error=404');
	exit;
}

if (isset ($_POST['mp_password']))
{
	$mp_password = check ($_POST['mp_password']);
	
	if ($mp_password === trim (file_get_contents (DATADIR . 'mpanel_pas.dat')))
	{
		$_SESSION['mpanel_password'] = $mp_password;
		
		if (isset ($_SESSION['return_url']))
		{
			header ('Location: ' . $config['home'] . base64_decode ($_SESSION['return_url']));
			
			unset ($_SESSION['return_url']);
			
		}else
		{
			header ('Location: ' . $config['home'] . '/' . ADMINDIR . 'index.php');
		}
		
	}else
	{
		header ('Location: mp.php?note=bad_mpanel_password');
	}
	
	exit;
}

show_title ('key.gif', 'Проверка доступа');

echo '<form action="mp.php" method="post">';
echo '<b>Введите код доступа:</b><br />';
echo '<input type="password" name="mp_password" /><br /><br />';
echo '<input type="submit" value="Далее" /></form><br />';

echo '<img src="../images/img/homepage.gif" alt=""> <a href="index.php">На главную</a>'; 

require_once 'themes/' . $config['themes'] . '/foot.php';

?>