View file moder.php

File size: 6.53Kb
<?php
// MyForum - Сервис форумов 
// Copyright © A'lex и KO. All Rights Reserved
// По всем вопросам обращайтесь на email [email protected] или в асю 376920428

include 'config.php';
include 'functions.php';

$wmode=getwmode($w);

if ($sid!=FALSE) {$inchtml.="<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>\n";}
if ($w!=FALSE) {$inchtml.="<input type=\"hidden\" name=\"w\" value=\"$w\"/>\n";}
if ($show!=FALSE) {$inchtml.="<input type=\"hidden\" name=\"show\" value=\"all\"/>\n";}

if ($sid!=FALSE) {$incwml.="<postfield name=\"sid\" value=\"$sid\"/>";}
if ($w!=FALSE) {$incwml.="<postfield name=\"w\" value=\"$w\"/>";}
if ($show!=FALSE) {$incwml.="<postfield name=\"show\" value=\"all\"/>";}

if ($mode=='del') {
	if (!$moder) {exit;}
	mysql_query("UPDATE {$table}{$f}_topiks SET Visible=1 WHERE ID=$t");
	mysql_query("UPDATE {$table}{$f}_messages SET Visible=1 WHERE TopikID=$t");
	header("Location: showforum.php?f=$f&p=$p$isid");
}

if ($mode=='up') {
	if (!$moder) {exit;}
	mysql_query("UPDATE {$table}{$f}_topiks SET Visible=0 WHERE ID=$t");
	mysql_query("UPDATE {$table}{$f}_messages SET Visible=0 WHERE TopikID=$t");
	header("Location: showtopik.php?f=$f&p=$p&t=$t$isid");
}

if ($mode=='close') {
	if ($moder || (($Cop==$userinfo['Nick']) && ($sid!=FALSE))) {
		mysql_query("UPDATE {$table}{$f}_topiks SET Enabled=1 WHERE ID=$t");
		header("Location: showforum.php?f=$f&p=$p$isid");
	}
}

if ($mode=='open') {
	if ($moder || (($Cop==$userinfo['Nick']) && ($sid!=FALSE))) {
		mysql_query("UPDATE {$table}{$f}_topiks SET Enabled=0 WHERE ID=$t");
		header("Location: showtopik.php?f=$f&p=$p&t=$t$isid");
	}
}

if ($mode=='delpost') {
	if (!$moder) {exit;}
	mysql_query("UPDATE {$table}{$f}_messages SET Visible=1 WHERE ID=$mes");
	header("Location: showtopik.php?f=$f&p=$p&t=$t&mes=$mes$isid");
}

if ($mode=='uppost') {
	if (!$moder) {exit;}
	mysql_query("UPDATE {$table}{$f}_messages SET Visible=0 WHERE ID=$mes");
	header("Location: showtopik.php?f=$f&p=$p&t=$t&mes=$mes$isid");
}

if ($mode=='banip') {
	if (!$moder) {exit;}
	$r = mysql_query("SELECT * FROM {$table}{$f}_messages WHERE ForumID=$p AND TopikID=$t AND ID=$mes");
	$a=mysql_fetch_array($r);
	$IP=$a['IP'];
	$UserAgent=$a['UserAgent'];
	
$formhtml=<<<END
<form action="moder.php?f=$f&mode=bannickexes&p=$p&t=$t&mes=$mes$isid" method="post">
$inchtml<input type="hidden" name="f" value="$f"/>
<input type="hidden" name="p" value="$p"/>
<input type="hidden" name="t" value="$t"/>
<input type="hidden" name="mes" value="$mes"/>
<input type="hidden" name="mode" value="banipexes"/>
<input type="hidden" name="ip" value="$IP"/>
<input type="hidden" name="useragent" value="$UserAgent"/>
Баним $IP $UserAgent на&nbsp;&nbsp;<input type="text" name="time" cols="10"/>&nbsp;&nbsp;часов
</td></tr>
<tr><td bgcolor="#79EBFB">
<p align="center">
<input type="submit" name="submit" value="Забанить"/></p>
</form>
END;

$formwml=<<<END
Баним $IP $UserAgent на  <input type="text" name="time" cols="10"/>  часов<br/>
<anchor>Забанить<go href="moder.php" accept-charset="UTF-8" method="post">
$incwml<postfield name="f" value="$f"/>
<postfield name="p" value="$p"/>
<postfield name="t" value="$t"/>
<postfield name="mes" value="$mes"/>
<postfield name="mode" value="banipexes"/>
<postfield name="ip" value="$IP"/>
<postfield name="useragent" value="$UserAgent"/>
<postfield name="time" value="<dol>(time)"/>
</go></anchor><br/>
END;

	if ($wmode=='html') {
		displayHTML('Бан', $Banner, $formhtml, "<a href=\"showtopik.php?f=$f&p=$p&t=$t&mes=$mes$isid\">Назад</a>");
	} else {
		displayWML('Бан', $Banner, $formwml, "<a href=\"showtopik.php?f=$f&p=$p&t=$t&mes=$mes$isid\">Назад</a>");
	}
}

if ($mode=='bannick') {
	if (!$moder) {exit;}
	$r = mysql_query("SELECT * FROM {$table}{$f}_messages WHERE ForumID=$p AND TopikID=$t AND ID=$mes");
	$a=mysql_fetch_array($r);
	$nick=$a['Cop'];
	
$formhtml=<<<END
<form action="moder.php?f=$f&mode=bannickexes&p=$p&t=$t&mes=$mes$isid" method="post">
$inchtml<input type="hidden" name="f" value="$f"/>
<input type="hidden" name="p" value="$p"/>
<input type="hidden" name="t" value="$t"/>
<input type="hidden" name="mes" value="$mes"/>
<input type="hidden" name="mode" value="bannickexes"/>
<input type="hidden" name="nick" value="$nick"/>
Баним $nick на&nbsp;&nbsp;<input type="text" name="time" cols="10"/>&nbsp;&nbsp;часов за</td></tr>
<tr><td bgcolor="#C3F6FD">
<textarea name="comment" cols="57" rows="10">$body</textarea></td></tr>
<tr><td bgcolor="#C3F6FD">
<select name="del">
Удалить пост?&nbsp;&nbsp;
<option value="da">Да</option>
<option value="net">Нет</option>
</select>
</td></tr>
<tr><td bgcolor="#79EBFB">
<p align="center">
<input type="submit" name="submit" value="Забанить"/></p>
</form>
END;

$formwml=<<<END
Баним $nick на  <input type="text" name="time" cols="10"/>  часов за<br/>
<input name="comment" title="Причина" type="text" value="$body"/><br/>
Удалить пост?<br/>
<select name="del">
<option value="da">Да</option>
<option value="net">Нет</option>
</select><br/>
<anchor>Забанить<go href="moder.php" accept-charset="UTF-8" method="post">
$incwml<postfield name="f" value="$f"/>
<postfield name="p" value="$p"/>
<postfield name="t" value="$t"/>
<postfield name="mes" value="$mes"/>
<postfield name="mode" value="bannickexes"/>
<postfield name="nick" value="$nick"/>
<postfield name="time" value="<dol>(time)"/>
<postfield name="comment" value="<dol>(comment)"/>
<postfield name="del" value="<dol>(del)"/>
</go></anchor><br/>
END;

	if ($wmode=='html') {
		displayHTML('Бан', $Banner, $formhtml, "<a href=\"showtopik.php?f=$f&p=$p&t=$t&mes=$mes$isid\">Назад</a>");
	} else {
		displayWML('Бан', $Banner, $formwml, "<a href=\"showtopik.php?f=$f&p=$p&t=$t&mes=$mes$isid\">Назад</a>");
	}

}

if ($mode=='banipexes') {
	if (!$moder) {exit;}
	$bdate=dateinc($date, $time*60);
	mysql_query("INSERT INTO {$table}{$f}_banip VALUES ('$ip', '$useragent', '$bdate')");
	header("Location: showtopik.php?f=$f&p=$p&t=$t$isid");
}

if ($mode=='bannickexes') {
	if (!$moder) {exit;}
	$bdate=dateinc($date, $time*60);
	mysql_query("INSERT INTO {$table}{$f}_bannick VALUES ('$nick', '$bdate', '$comment')");
	if ($del=='da') {
		mysql_query("UPDATE {$table}{$f}_messages SET Visible=1 WHERE ID=$mes");
		}
	header("Location: showtopik.php?f=$f&p=$p&t=$t$isid");
}


mysql_close($lnk);
?>