Файл: moder.php
Строк: 432
<?php
#############################
# СКРИПТ ФОРУМА #
# КАК НА #
# http://ony.su #
# Автор : ExPLOiT #
# ICQ : 949-38-99 #
#############################
/*
! Вы не имеете права распространять данный скрипт. !
*/
list($msec,$sec)=explode(chr(32),microtime());
$headtime=$sec+$msec;
INCLUDE_ONCE("connect.php");
include_once("config.php");
include_once("users.php");
include_once("functions.php");
if($status == "moderator" or $status == "admin")
{
switch($_GET['mode'])
{
case 'mtopic':
$id_theme = intval($_GET['id']);
$t_i = mysql_query("SELECT * FROM `themes` WHERE `id`=".$id_theme);
if(mysql_num_rows($t_i) < 1)
{
if($version == "wml")
{
header('Content-type: text/vnd.wap.wml; charset=utf-8');
echo(doctype("Ошибка").'
Тема удалена! <br />
--- <br />
<a href="./?v=wml&sid='.$sid.'">Форумы</a>
</p></card></wml>');
} elseif($version == "xhtml")
{
header("Content-type: text/html; charset=utf-8");
echo('<html>
<head>
<title>Ошибка</title>
</head>
<body bgcolor="'.$style['background'].'" link="'.$style['link'].'" vlink="'.$style['link'].'" text="#000000">
<table align="center" border="0" cellspacing="1" cellpadding="5" width="350">
<tr><td align="center" bgcolor="'.$style['title'].'">
<font color="#FFFFFF"><b>Ошибка</b></font>
</td></tr>
<tr><td bgcolor="'.$style['bottom'].'"></td></tr>
<tr><td bgcolor="'.$style['text'].'">Тема удалена</td></tr>
<tr><td bgcolor="'.$style['bottom'].'">
<a href="'.htmlspecialchars($_SERVER['HTTP_REFERER']).'">Назад</a>
</td></tr></table>
</body></html>');
}
} else
{
$id_post = topic2post($id_theme);
$SQL = mysql_query("SELECT * FROM `posts` WHERE `id`=".$id_post);
$line = mysql_fetch_array($SQL);
$t_info = mysql_fetch_array($t_i);
if($version == "wml")
{
header("Content-type: text/vnd.wap.wml; charset=utf-8");
echo(doctype("Модераторская").'Логин ['.$line['name'].'] <br />
User-Agent: ['.strtok($line['useragent'], "/").'] <br />
IP: ['.$line['ip'].'] <br />
---<br />
<a href="moder.php?mode=del&sid='.$sid.'&tid='.$id_theme.'&v=wml&fid='.$t_info['id_forum'].'">Удалить тему</a><br />');
if($t_info['pos'] == 1)
{
echo('<a href="moder.php?mode=bolt&b=1&sid='.$sid.'&tid='.$id_theme.'&v=wml&fid='.$t_info['id_forum'].'">Зекрепить тему</a><br />');
} else
{
echo('<a href="moder.php?mode=bolt&b=0&sid='.$sid.'&tid='.$id_theme.'&v=wml&fid='.$t_info['id_forum'].'">Открепить тему</a><br />');
}
echo('---<br />
Блокировать на : <br />
<select name="time">
<option value="300">5 мин.</option>
<option value="1500">15 мин.</option>
<option value="3600">1 час.</option>
<option value="21600">6 час.</option>
<option value="86400">1 день</option>
<option value="ip">IP 1 час</option>
<option value="ua">User-Agent 1 час</option>
</select><br />
Причина: <br />
<input type="text" name="mess" /><br />
<anchor>[Блокировать]
<go href="moder.php?v=wml&sid='.$sid.'&mode=ban" method="post">
<postfield name="time" value="$(time)" />
<postfield name="mess" value="$(mess)" />
<postfield name="who" value="'.$line['name'].'" />
<postfield name="ip" value="'.$line['ip'].'" />
<postfield name="ua" value="'.$line['useragent'].'" />
<postfield name="fid" value="'.$t_info['id_forum'].'" />
</go></anchor><br /><br />
- - - <br />
Переименовать: <br />
<input type="text" name="rename" value="'.$t_info['tname'].'" /> <br />
<anchor>[Переименовать]
<go href="moder.php?v=wml&sid='.$sid.'&mode=rename" method="post">
<postfield name="rename" value="$(rename)" />
<postfield name="tid" value="'.$id_theme.'" />
<postfield name="fid" value="'.$t_info['id_forum'].'" />
</go></anchor><br />
- - - <br />
Переместить: <br />
<select name="nf">');
$fidsS = mysql_query("SELECT id, name FROM `forums`");
while($fids = mysql_fetch_array($fidsS))
{
echo('<option value="'.$fids['id'].'">'.$fids['name'].'</option>');
}
echo('</select><br />
<anchor>[Переместить]
<go href="moder.php?v=wml&sid='.$sid.'&mode=nf" method="post">
<postfield name="nf" value="$(nf)" />
<postfield name="tid" value="'.$id_theme.'" />
<postfield name="fid" value="'.$t_info['id_forum'].'" />
</go></anchor><br />
- - - <br />
<a href="./?v=wml&sid='.$sid.'&mode=topics&f='.$t_info['id_forum'].'">Назад</a><br />
</p></card></wml>');
} elseif($version == "xhtml")
{
header("Content-type: text/html; charset=utf-8");
echo('<html>
<head>
<title>Модер</title>
</head>
<body bgcolor="'.$style['background'].'" link="'.$style['link'].'" vlink="'.$style['link'].'" text="#000000">
<table align="center" border="0" cellspacing="1" cellpadding="5" width="350">
<tr><td align="center" bgcolor="'.$style['title'].'" colspan="2">
<font color="#FFFFFF"><b>Модер</b></font>
</td></tr>
<tr><td bgcolor="'.$style['bottom'].'" colspan="2">
<a href="moder.php?mode=del&sid='.$sid.'&tid='.$id_theme.'&v=xhtml&fid='.$t_info['id_forum'].'" style="background-color: #FF0000; color: #FFFFFF; text-decoration: underline">Удалить тему</a><br />');
if($t_info['pos'] == 1)
{
echo('<a href="moder.php?mode=bolt&b=1&sid='.$sid.'&tid='.$id_theme.'&v=xhtml&fid='.$t_info['id_forum'].'">Зекрепить тему</a><br />');
} else
{
echo('<a href="moder.php?mode=bolt&b=0&sid='.$sid.'&tid='.$id_theme.'&v=xhtml&fid='.$t_info['id_forum'].'">Открепить тему</a><br />');
}
echo('
</td></tr>
<tr bgcolor="'.$style['text'].'"><td>
Логин:</td><td> ['.$line['name'].']</td></tr>
<tr bgcolor="'.$style['text'].'"><td>
User-Agent:</td><td>['.strtok($line['useragent'], "/").'] </td></tr>
<tr bgcolor="'.$style['text'].'"><td>
IP:</td><td> ['.$line['ip'].']</td></tr>
<tr bgcolor="'.$style['text'].'"><td>
<form action="moder.php?v=xhtml&sid='.$sid.'&mode=ban" method="post">
Блокировать на:</td><td>
<select name="time">
<option value="300">5 мин.</option>
<option value="1500">15 мин.</option>
<option value="3600">1 час.</option>
<option value="21600">6 час.</option>
<option value="86400">1 день</option>
<option value="ip">IP 1 час</option>
<option value="ua">User-Agent 1 час</option>
</select></td></tr>
<tr bgcolor="'.$style['text'].'"><td>
Причина: </td><td>
<input type="text" name="mess" /></td></tr>
<tr bgcolor="'.$style['text'].'"><td align="center" colspan="2">
<input type="submit" value="Блокировать" /><br />
<input type="hidden" name="ua" value="'.$line['useragent'].'" />
<input type="hidden" name="who" value="'.$line['name'].'" />
<input type="hidden" name="ip" value="'.$line['ip'].'" />
<input type="hidden" name="fid" value="'.$t_info['id_forum'].'" />
</form></td></tr>
<tr bgcolor="'.$style['text'].'"><td>
<form action="moder.php?v=xhtml&sid='.$sid.'&mode=rename" method="post">
Переименовать:</td><td>
<input type="text" name="rename" value="'.$t_info['tname'].'" /><br />
<input type="hidden" name="fid" value="'.$t_info['id_forum'].'" />
<input type="hidden" name="tid" value="'.$id_theme.'" /></td></tr>
<tr bgcolor="'.$style['text'].'"><td colspan="2" align="center">
<input type="submit" value="Переименовать" />
</form></td></tr>
<tr bgcolor="'.$style['text'].'"><td>
Переместить:</td><td>
<form action="moder.php?v=xhtml&sid='.$sid.'&mode=nf" method="post">
<select name="nf">');
$fidsS = mysql_query("SELECT id, name FROM `forums`");
while($fids = mysql_fetch_array($fidsS))
{
echo('<option value="'.$fids['id'].'">'.$fids['name'].'</option>');
}
echo('</select><br />
<input type="hidden" name="fid" value="'.$t_info['id_forum'].'" />
<input type="hidden" name="tid" value="'.$id_theme.'" />
</td></tr>
<tr bgcolor="'.$style['text'].'"><td align="center" colspan="2">
<input type="submit" value="Переместить" />
</form></td></tr>
<tr bgcolor="'.$style['bottom'].'"><td colspan="2">
<a href="./?v=xhtml&sid='.$sid.'&mode=topics&f='.$t_info['id_forum'].'">Назад</a><br />
</td></tr></table>
</body></html>');
}
}
break;
case 'mpost':
$t_info = mysql_fetch_array(mysql_query("SELECT * FROM `themes` WHERE `id`=".intval($_GET['tid'])));
if(!mysql_result(mysql_query("SELECT COUNT(*) FROM `posts` WHERE `id`=".intval($_GET['id'])), 0))
{
if($version == "wml")
{
header('Content-type: text/vnd.wap.wml; charset=utf-8');
echo(doctype("Ошибка").'
Поста не существует! <br />
--- <br />
<a href="./?v=wml&sid='.$sid.'">Форумы</a>
</p></card></wml>');
} elseif($version == "xhtml")
{
header("Content-type: text/html; charset=utf-8");
echo('<html>
<head>
<title>Ошибка</title>
</head>
<body bgcolor="'.$style['background'].'" link="'.$style['link'].'" vlink="'.$style['link'].'" text="#000000">
<table align="center" border="0" cellspacing="1" cellpadding="5" width="350">
<tr><td align="center" bgcolor="'.$style['title'].'">
<font color="#FFFFFF"><b>Ошибка</b></font>
</td></tr>
<tr><td bgcolor="'.$style['bottom'].'"></td></tr>
<tr><td bgcolor="'.$style['text'].'">Поста не существует!</td></tr>
<tr><td bgcolor="'.$style['bottom'].'">
<a href="'.htmlspecialchars($_SERVER['HTTP_REFERER']).'">Назад</a>
</td></tr></table>
</body></html>');
}
} else
{
$qline = mysql_query("SELECT * FROM `posts` WHERE `id`=".intval($_GET['id']));
$line = mysql_fetch_array($qline);
if($version == "wml")
{
header("Content-type: text/vnd.wap.wml; charset=utf-8");
echo(doctype("Модераторская").'
Логин ['.$line['name'].'] <br />
User-Agent: ['.strtok($line['useragent'], "/").'] <br />
IP: ['.$line['ip'].'] <br />
---<br />
<a href="moder.php?v=wml&sid='.$sid.'&mode=del&pid='.$_GET['id'].'&tid='.$_GET['tid'].'">Удалить пост</a><br />
---<br />
Блокировать на : <br />
<select name="time">
<option value="300">5 мин.</option>
<option value="1500">15 мин.</option>
<option value="3600">1 час.</option>
<option value="21600">6 час.</option>
<option value="86400">1 день</option>
<option value="ip">IP 1 час</option>
<option value="ua">User-Agent 1 час</option>
</select><br />
Причина: <br />
<input type="text" name="mess" /><br />
<anchor>[Блокировать]
<go href="moder.php?v=wml&sid='.$sid.'&mode=ban" method="post">
<postfield name="time" value="$(time)" />
<postfield name="mess" value="$(mess)" />
<postfield name="ip" value="'.$line['ip'].'" />
<postfield name="who" value="'.$line['name'].'" />
<postfield name="ua" value="'.$line['useragent'].'" />
<postfield name="fid" value="'.$t_info['id_forum'].'" />
</go></anchor><br /><br />
- - - <br />
<a href="./?v=wml&sid='.$sid.'&mode=posts&p='.$_GET['tid'].'">Назад</a> <br />
<a href="./?v=wml&sid='.$sid.'">Форумы</a>
</p></card></wml>');
} elseif($version == "xhtml")
{
header("Content-type: text/html; charset=utf-8");
echo('<html>
<head>
<title>Модер</title>
</head>
<body bgcolor="'.$style['background'].'" link="'.$style['link'].'" vlink="'.$style['link'].'" text="#000000">
<table align="center" border="0" cellspacing="1" cellpadding="5" width="350">
<tr><td align="center" bgcolor="'.$style['title'].'" colspan="2">
<font color="#FFFFFF"><b>Модер</b></font>
</td></tr>
<tr><td bgcolor="'.$style['bottom'].'" colspan="2">
<a href="moder.php?v=xhtml&sid='.$sid.'&mode=del&pid='.$_GET['id'].'&tid='.$line['id_theme'].' " style="background-color: #FF0000; color: #FFFFFF; text-decoration: underline">Удалить пост</a>
</td></tr>
<tr bgcolor="'.$style['text'].'"><td>
Логин:</td><td>['.$line['name'].']</td></tr>
<tr bgcolor="'.$style['text'].'"><td>
User-Agent:</td><td>['.strtok($line['useragent'], "/").']</td></tr>
<tr bgcolor="'.$style['text'].'"><td>
IP: </td><td>['.$line['ip'].'] </td></tr>
<tr bgcolor="'.$style['text'].'"><td>
<form action="moder.php?v=xhtml&sid='.$sid.'&mode=ban" method="post">
Блокировать на:</td><td>
<select name="time">
<option value="300">5 мин.</option>
<option value="1500">15 мин.</option>
<option value="3600">1 час.</option>
<option value="21600">6 час.</option>
<option value="86400">1 день</option>
<option value="ip">IP 1 час</option>
<option value="ua">User-Agent 1 час</option>
</select></td></tr>
<tr bgcolor="'.$style['text'].'"><td>
Причина:</td><td>
<input type="text" name="mess" /></td></tr>
<tr bgcolor="'.$style['text'].'"><td align="center" colspan="2">
<input type="submit" value="Блокировать" />
<input type="hidden" name="ua" value="'.$line['useragent'].'" />
<input type="hidden" name="who" value="'.$line['name'].'" />
<input type="hidden" name="ip" value="'.$line['ip'].'" />
<input type="hidden" name="fid" value="'.$t_info['id_forum'].'" />
</form></td></tr>
<tr bgcolor="'.$style['bottom'].'"><td colspan="2">
<a href="./?v=xhtml&sid='.$sid.'&mode=posts&p='.$_GET['tid'].'">Назад</a><br />
<a href="./?v=xhtml&sid='.$sid.'">Форумы</a>
</td></tr></table>
</body></html>');
}
}
break;
case 'rename':
if(!mysql_result(mysql_query("SELECT COUNT(*) FROM `themes` WHERE `id`=".intval($_POST['tid'])), 0))
{
header("Location: ".$forumdir.'v='.$version.'&sid='.$sid.'&mode=topics&f='.$_POST['fid']);
} else
{
mysql_query("UPDATE `themes` SET `tname`='".htmlspecialchars(sql($_POST['rename']))."' WHERE `id`=".intval($_POST['tid']));
header("Location: ".$forumdir.'v='.$version.'&sid='.$sid.'&mode=topics&f='.$_POST['fid']);
}
break;
case 'nf':
if(!mysql_result(mysql_query("SELECT COUNT(*) FROM `themes` WHERE `id`=".intval($_POST['tid'])), 0))
{
header("Location: ".$forumdir.'v='.$version.'&sid='.$sid.'&mode=topics&f='.$_POST['fid']);
} else
{
mysql_query("UPDATE `themes` SET `id_forum`=".intval($_POST['nf'])." WHERE `id`=".intval($_POST['tid']));
header("Location: ".$forumdir.'v='.$version.'&sid='.$sid.'&mode=topics&f='.$_POST['fid']);
}
break;
case 'del':
if(empty($_GET['pid']))
{
if(!mysql_result(mysql_query("SELECT COUNT(*) FROM `themes` WHERE `id`=".intval($_GET['tid'])), 0))
{
header("Location: ".$forumdir.'v='.$version.'&sid='.$sid.'&mode=topics&f='.$_GET['fid']);
} else
{
if($status == "admin"){ $SQL = "DELETE FROM `themes` WHERE `id`=".intval($_GET['tid']);
mysql_query("DELETE FROM `posts` WHERE `id_theme`=".intval($_GET['tid'])); }
else { $SQL = "UPDATE `themes` SET `del`=1, `mdel`='".$username."' WHERE `id`=".intval($_GET['tid']); }
mysql_query($SQL);
header("Location: ".$forumdir.'v='.$version.'&sid='.$sid.'&mode=topics&f='.$_GET['fid']);
}
} else
{
if(!mysql_result(mysql_query("SELECT COUNT(*) FROM `posts` WHERE `id`=".intval($_GET['pid'])), 0))
{
header("Location: ".$forumdir.'v='.$version.'&mode=posts&p='.$_GET['tid'].'&sid='.$sid);
} else
{
mysql_query("DELETE FROM `posts` WHERE `id`=".intval($_GET['pid']));
header("Location: ".$forumdir.'v='.$version.'&mode=posts&p='.$_GET['tid'].'&sid='.$sid);
}
}
break;
case 'bolt':
if($_GET['b'] == "1")
{
mysql_query("UPDATE `themes` SET `pos`=0 WHERE `id`=".intval($_GET['tid']));
header("Location: ".$forumdir.'v='.$version.'&sid='.$sid.'&mode=topics&f='.$_GET['fid']);
} else
{
mysql_query("UPDATE `themes` SET `pos`=1 WHERE `id`=".intval($_GET['tid']));
header("Location: ".$forumdir.'v='.$version.'&sid='.$sid.'&mode=topics&f='.$_GET['fid']);
}
break;
case 'ban':
if($_POST['time'] == "ua")
{
$SQL = "INSERT INTO `ban` VALUES(0, '', '".mysql_real_escape_string($_POST['ua'])."', '', ".(time() (60 * 60)).", '', '".$username."')";
} elseif($_POST['time'] == "ip")
{
$SQL = $SQL = "INSERT INTO `ban` VALUES(0, '".mysql_real_escape_string($_POST['ip'])."', '', '".$_POST['who']."', ".(time() (60 * 60)).", '', '".$username."')";
} else
{
$SQL = "INSERT INTO `ban` VALUES(0, '', '', '".mysql_real_escape_string($_POST['who'])."', ".(time() intval($_POST['time'])).", '".$_POST['mess']."', '".$username."')";
}
mysql_query($SQL);
header("Location: ".$forumdir.'v='.$version.'&sid='.$sid.'&mode=topics&f='.$_POST['fid']);
break;
case 'checkbox':
if(!empty($_GET['fid']) && !empty($_POST['id']))
{
mysql_query ( "DELETE FROM `themes` WHERE `id` IN(".implode(", ", array_map("intval", (array)$_POST['id'])).")" );
mysql_query("DELETE FROM `posts` WHERE `id_theme` IN(".implode(", ", array_map("intval", (array)$_POST['id'])).")" );
header("Location: ".$forumdir.'v='.$version.'&sid='.$sid.'&mode=topics&f='.$_GET['fid']);
} elseif(!empty($_GET['tid']) && !empty($_POST['id']))
{
mysql_query( "DELETE FROM `posts` WHERE `id` IN(".implode(", ", array_map("intval", $_POST['id'])).")" );
header("Location: ".$forumdir.'v='.$version.'&sid='.$sid.'&mode=posts&p='.$_GET['tid']);
}
break;
}
}
list($msec,$sec)=explode(chr(32),microtime());
echO("rn<!-- ".round(($sec+$msec)-$headtime,4).' -->');
?>