View file gb/admin/index.php

File size: 0.98Kb
<?php
include("../../config.php");


session_start();

	require_once ('../config.php');
	require_once ('../kernel/GuestBook.php');
	require_once ('../kernel/HtmlPage.php');

	define('UP_PATH', '../');

	

	$auth = new Authorisation;

	if (isset($_GET['exit']) || !$auth->IsAuth()) {
		$auth->ExitUser();
		header('Location: ../');
		exit();
	}

	if (isset($_GET['edit']) && $_GET['edit']=='clear') {
		$guestbook = new GuestBook;
		$guestbook->ClearAll();
		$error_message = new ErrorMessage();
		$error_message->_message = 'Гостевая книга  почищена!';
	}

	if (isset($_POST['password']) && isset($_POST['password2']) && !empty($_POST['password']) && !empty($_POST['password2']))
	{
		$err_num = $auth->SetPassword();
		if (0!=$err_num) $error_message = new ErrorMessage($err_num);
	}

	$page = new HtmlPage();
	$page->ShowTitle();
	if (isset($error_message)) { $error_message->ShowMessage(); echo '<br />';}
	$page->ShowAdminMenu();
	$page->ShowFooter();

?>