Размер файла: 5.03Kb
<?php
$themes = "themes";
if($_GET['mode']==$themes)
{
####################
# Автор: [Svig] #
# ICQ: 563000172 #
####################
include ("../conf.php");
include ("../lock.php");
if ($user == $myrow["user"] && $pass == $myrow["pass"])
{
echo "<link rel='stylesheet' type='text/css' href='../style.css'/>";
include ("../head.php");
$cat = mysql_real_escape_string(trim($_GET['cat']));
$num = 10;
@$page = $_GET['page'];
$result00 = mysql_query("SELECT COUNT(*) FROM forum_themes WHERE cat='$cat'");
$temp = mysql_fetch_array($result00);
$posts = $temp[0];
$total = (($posts - 1) / $num) + 1;
$total = intval($total);
$page = intval($page);
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * $num - $num;
$result = mysql_query ("select * from forum_themes where cat='$cat' order by id desc limit $start, $num",$db);
$result33 = mysql_query ("select * from forum_themes where cat='$cat'");
if (mysql_num_rows($result33) > 0)
{
$myrow = mysql_fetch_array($result);
do
{
echo "<div class='nav'>";
echo "• <b><a href='view_post.php?mode=post&user=$user&pass=$pass&id=".$myrow['id']."'>".$myrow['name']."</a></b> | ".$myrow['user_nick']."";
if($user == $adname){ echo " | (<a href='../admin/forum.php?mode=drop_themes&user=$user&pass=$pass&id=".$myrow['id']."'><font color='red'>del</font></a>)"; }
echo "</div>";
}
while ($myrow = mysql_fetch_array($result));
echo "<div class='nav'>";
if ($page != 1) echo "<a href=view_cat.php?mode=themes&cat=$cat&user=$user&pass=$pass&page=".($page - 1).">Назад</a>";
if ($page != $total) echo " <a href=view_cat.php?mode=themes&cat=$cat&user=$user&pass=$pass&page=". ($page + 1) .">Далее</a>";
echo "</div>";
}
else
{
echo "<div class='nav'>";
echo "В этом форуме пока нет тем!<br />";
echo "</div>";
echo "<div class='nav'>";
echo "• <a href=view_cat.php?mode=add&cat=$cat&user=$user&pass=$pass>Добавить тему</a><br />";
echo "• <a href=../menu.php?user=$user&pass=$pass>В меню</a>";
echo "</div>";
include ("../foot.php");
exit();
}
echo "<div class='nav'>";
echo "• <a href=view_cat.php?mode=add&cat=$cat&user=$user&pass=$pass>Добавить тему</a><br />";
echo "• <a href=../menu.php?user=$user&pass=$pass>В меню</a>";
echo "</div>";
include ("../foot.php");
exit();
}
else
{
echo "Ошибка! Неверный <b>Ник</b> или <b>Пароль</b><br />";
echo <<<sss
<a href="../index.php">На главную</a>
sss;
}
}
$add = "add";
if($_GET['mode']==$add)
{
include ("../conf.php");
include ("../lock.php");
if ($user == $myrow["user"] && $pass == $myrow["pass"])
{
echo "<link rel='stylesheet' type='text/css' href='../style.css'/>";
include ("../head.php");
$cat = mysql_real_escape_string(trim($_GET['cat']));
echo "<div class='nav'><form name='form' action='view_cat.php?mode=s&user=$user&pass=$pass' method='post'>";
echo "Имя темы:<br /><input name='name' type='text' value=''> <br />";
echo "Сообщение:<br /><textarea rows='3' cols='19' name='text'></textarea><br/>";
echo "<input name='cat' type='hidden' value='".$cat."'>";
echo "<input type='submit' value='Добавить'></form></div>";
echo "<div class='nav'>";
echo "• <a href=../menu.php?user=$user&pass=$pass>В меню</a>";
echo "</div>";
include ("../foot.php");
exit();
}
else
{
echo "Ошибка! Неверный <b>Ник</b> или <b>Пароль</b><br />";
echo <<<sss
<a href="../index.php">На главную</a>
sss;
}
}
$s = "s";
if($_GET['mode']==$s)
{
include ("../conf.php");
include ("../lock.php");
if ($user == $myrow["user"] && $pass == $myrow["pass"])
{
echo "<link rel='stylesheet' type='text/css' href='../style.css'/>";
include ("../head.php");
$text = htmlspecialchars(mysql_real_escape_string(trim($_POST['text']))); if ($text == ''){unset($text); }
$name = htmlspecialchars(mysql_real_escape_string(trim($_POST['name']))); if ($name == ''){unset($name); }
$cat = htmlspecialchars(mysql_real_escape_string(trim($_POST['cat']))); if ($cat == ''){unset($cat); }
$date = date("Y.m.d");
$user_id = $myrow["id"];
if (isset($text))
{
$result = mysql_query("INSERT INTO forum_themes (text,name,cat,user_nick,user_id,date) VALUES ('$text','$name','$cat','$user','$user_id','$date')");
if ($result == 'true')
{
$result2 = mysql_query("SELECT * FROM forum_themes ORDER BY id DESC",$db);
$myrow2 = mysql_fetch_array($result2);
echo "<html><head>
<meta http-equiv='Refresh' content='0; URL=view_post.php?mode=post&id=".$myrow2['id']."&user=".$user."&pass=".$pass."'>
</head></html>";
}
}
else
{
echo "<div class='nav'>Ошибка! Тема не создона!</div>";
echo "<div class='nav'>• <a href='index.php?user=$user&pass=$pass'>В форум</a><br />• <a href=../menu.php?user=$user&pass=$pass>В меню</a></div>";
include ("../foot.php");
exit();
}
}
else
{
echo "<link rel='stylesheet' type='text/css' href='../style.css'/>";
include ("../head.php");
echo "<div class='nav'>";
echo "Ошибка! <br />Неверный <b>Ник</b> или<b>Пароль</b>!<br /></div>";
echo "<div class='nav'><a href='index.php'>На главную</a></div>";
include ("../foot.php");
}
}
?>