File size: 3.08Kb
<?php
require_once "config.php";
echo '<link rel="stylesheet" type="text/css" href="style.css">';
switch($_GET['act']) {
case "sid":
if($admin==$_POST['log'] && $passwd==$_POST['pass']) {
$_SESSION['admin']=$_POST['log'];
echo 'Вы успешно авторизованы!<br><a href="guest.php">Далее</a><br>';
}
if(isset($_SESSION['admin'])) {
$q = mysql_query("SELECT * FROM `setting`;");
while($data=mysql_fetch_array($q)) {
$home = $data['home'];
$copy = $data['copy'];
$str = $data['str'];
}
echo 'Главная страница:<br>
<form action="?act=setting" method="POST">
<input type="text" name="home" value="'.$home.'"><br>
Копипайт:<br>
<input type="text" name="copy" value="'.$copy.'"><br>
Сообщений на страницу:<br>
<input type="text" name="str" value="'.$str.'"><br>
<input type="submit" value="Изменить"></form><br>';
echo '<a href="admin.php?act=listban">Список забаненных</a><br>';
echo '<a href="admin.php?act=exit">Выйти</a><br>';
}
break;
case 'listban':
$q = mysql_query("SELECT * FROM `bans`;");
if(mysql_num_rows($q) ==0) {
echo 'Список пуст';
} else {
$bn = 1;
while($ban = mysql_fetch_array($q)) {
echo "".$bn.". IP: <font color=\"red\">".$ban['ip']."</font><br>
UserAgent: <font color=\"red\">".$ban['agent']."</font><br>
<form action=\"edit.php?act=unban\" method=\"POST\">
<input type=\"hidden\" name=\"ip\" value=\"".$ban['ip']."\">
<input type=\"hidden\" name=\"ua\" value=\"".$ban['agent']."\">
<input type=\"submit\" value=\"Разбанить\"></form>
------------------------------<br>";
$bn++;
}
}
break;
case 'exit':
session_destroy();
header('Location: guest.php');
break;
case "setting":
if(isset($_SESSION['admin'])) {
$copy = $_POST['copy'];
$home = $_POST['home'];
$str = $_POST['str'];
$q = mysql_query("UPDATE `setting` SET `copy`='".$copy."', `home`='".$home."',`str`='".$str."'");
if($q) {
echo 'Данные измененны<br>
<a href="guest.php">Далее</a><br>';
} else {
echo "Ошибка изменения<br>";
}
}
break;
default:
if(empty($_SESSION['admin'])) {
echo '<form action="admin.php?act=sid" method="POST">
Логин:<br><input type="text" name="log"><br>
Пароль:<br><input type="password" name="pass"><br>
<input type="submit" value="Войти"></form><br>';
} else {
header("Location: admin.php?act=sid");
}
break;
}
include_once "foot.php";
?>