Просмотр файла admin/forum.php

Размер файла: 6.24Kb
<?php

$forum = "forum";
if($_GET['mode']==$forum)
{

include ("../conf.php");
include ("../lock.php");

if ($user == $myrow["user"] && $pass == $myrow["pass"])
{
if($user == $adname){

include ("../head.php");
echo "<link rel='stylesheet' type='text/css' href='../style.css'/>";

echo "<div class='nav'>";
echo "<form name='form' action='forum.php?mode=s&user=$user&pass=$pass' method='post'>";
echo "Имя форума:<br /><input name='title' type='text' value=''><br />
<input type='submit' value='Добавить'></form></div>";
echo "<div class='nav'>• <a href=forum.php?mode=del&user=$user&pass=$pass>Удалить форум</a></div>";
echo "<div class='nav'>• <a href=../menu.php?user=$user&pass=$pass>В меню</a></div>";
include ("../foot.php");
exit();
}
}
else
{
include ("../head.php");
echo "Ошибка! <br />Неверный <b>Ник</b> или <b>Пароль</b>!<br />";
echo <<<sss
<a href="../index.php">На главную</a>
sss;
exit();
}
}




$s = "s";
if($_GET['mode']==$s)
{
include ("../conf.php");
include ("../lock.php");

if ($user == $myrow["user"] && $pass == $myrow["pass"])
{
if($user == $adname){


$title = $_POST['title'];
if ($title == '')
{
unset($title);
}

if (isset($title))
{
$result = mysql_query("INSERT INTO forum (title) VALUES ('$title')");

if ($result == 'true')
{
include ("../head.php");
echo "<link rel='stylesheet' type='text/css' href='../style.css'/>";
echo "<div class='nav'>";
echo "Форум успешно добавлен!<br />";
echo "• <a href=../menu.php?user=$user&pass=$pass>В меню</a>";
echo "</div>";
include ("../foot.php");
exit();
}
else
{
include ("../head.php");
echo "<link rel='stylesheet' type='text/css' href='../style.css'/>";
echo "<div class='nav'>";
echo "Форум не добавлен!<br />";
echo "• <a href=../menu.php?user=$user&pass=$pass>В меню</a>";
echo "</div>";
include ("../foot.php");
exit();
}
}
else
{
include ("../head.php");
 echo "<link rel='stylesheet' type='text/css' href='../style.css'/>";
echo "<div class='nav'>";
echo "Вы ввели не всю информацию.<br />";
echo "• <a href=../menu.php?user=$user&pass=$pass>В меню</a>";
echo "</div>";
include ("../foot.php");
exit();
}
}
}
else
{
include ("../head.php");
echo "<link rel='stylesheet' type='text/css' href='../style.css'/>";
echo "Ошибка! <br />Неверный <b>Ник</b> или <b>Пароль</b>!<br />";
echo <<<sss
<a href="../index.php">На главную</a>
sss;
include ("../foot.php");
exit();
}


}






$drop = "drop";
if($_GET['mode']==$drop)
{

include ("../conf.php");
include ("../lock.php");

if ($user == $myrow["user"] && $pass == $myrow["pass"])
{
if($user == $adname){

$id = mysql_real_escape_string(trim($_POST['id']));

if($id != '')
{
$result = mysql_query("DELETE FROM forum WHERE id='".$id."'");

if ($result == 'true') {
include ("../head.php");
echo "<link rel='stylesheet' type='text/css' href='../style.css'/>";
echo "<div class='nav'>Форум удален!</div>";
echo "<div class='nav'><a href=../menu.php?user=$user&pass=$pass>В меню</a></div>";
include ("../foot.php");
exit();
}
}
else {
include ("../head.php");
echo "<link rel='stylesheet' type='text/css' href='../style.css'/>";
echo "<div class='nav'>";
echo "Форум не удален!</div>";
echo <<< sss
<div class='nav'>
• <a href=../menu.php?user=$user&pass=$pass>В меню</a>
</div>
sss;
include ("../foot.php");
exit();
}
}
else
{
echo "<p>Ошибка!!!</p>";
exit();
}
}

else
{
include ("../head.php");
echo "Ошибка! <br />Неверный <b>Ник</b> или <b>Пароль</b>!<br />";
echo <<<sss
<a href="../index.php">На главную</a>
sss;
include ("../foot.php");
exit();
}
}






$del = "del";
if($_GET['mode']==$del)
{


include ("../conf.php");
include ("../lock.php");

if ($user == $myrow["user"] && $pass == $myrow["pass"])
{
if($user == $adname){

include ("../head.php");
echo "<link rel='stylesheet' type='text/css' href='../style.css'/>";
echo <<<sss
<form name="" action="forum.php?mode=drop&user=$user&pass=$pass" method="post">
sss;

$result = mysql_query("SELECT * FROM forum");
$myrow = mysql_fetch_array($result);

do
{
echo "<link rel='stylesheet' type='text/css' href='../style.css'/>";
echo "<div class='nav'>";
echo " <input name='id' type='radio' value='".$myrow['id']." '>";
echo " ".$myrow['title']." <br /></div>";
}

while ($myrow = mysql_fetch_array($result));

echo <<< sss
<div class='nav'>
<input type="submit" value="Удалить"></form>
</div><div class='nav'>
• <a href=../menu.php?user=$user&pass=$pass>В меню</a>
</div>
sss;
include ("../foot.php");
}
}
else
{
include ("../head.php");
echo "Ошибка! <br />Неверный <b>Ник</b> или <b>Пароль</b>!<br />";
echo <<<sss
<a href="../index.php">На главную</a>
sss;
}
}



$drop_themes = "drop_themes";
if($_GET['mode']==$drop_themes)
{

include ("../conf.php");
include ("../lock.php");

if ($user == $myrow["user"] && $pass == $myrow["pass"])
{
if($user == $adname){

$id = mysql_real_escape_string(trim($_GET['id']));

if($id != '')
{
$result = mysql_query("DELETE FROM forum_themes WHERE id='".$id."'");

if ($result == 'true') {
include ("../head.php");
echo "<link rel='stylesheet' type='text/css' href='../style.css'/>";
echo "<div class='nav'>Тема удалена!</div>";
echo "<div class='nav'>• <a href=../menu.php?user=$user&pass=$pass>В меню</a></div>";
include ("../foot.php");
exit();
}
}
else {
include ("../head.php");
echo "<link rel='stylesheet' type='text/css' href='../style.css'/>";
echo "<div class='nav'>";
echo "Тема не удалена!</div>";
echo <<< sss
<div class='nav'>
• <a href=../menu.php?user=$user&pass=$pass>В меню</a>
</div>
sss;
include ("../foot.php");
exit();
}
}
else
{
echo "<p>Ошибка!!!</p>";
exit();
}
}

else
{
include ("../head.php");
echo "Ошибка! <br />Неверный <b>Ник</b> или <b>Пароль</b>!<br />";
echo <<<sss
<a href="../index.php">На главную</a>
sss;
include ("../foot.php");
exit();
}
}

?>