Opis: Dodany anty flood by *siwy21*
Upgrade:
<?
// Hanne's Shoutbox updated by DryKillLogic
// www.trackerx.com.ar -2007-
/*************************/
/* Poprawki Piter&Zielony*/
/* dla bttsupport */
/* nie dla szmat */
/* z torrentmania */
/*************************/
require_once("include/bittorrent.php");
dbconn(false);
loggedinorreturn();
// EDIT SHOUT ?
if (isset($_GET['edit']) && is_valid_id($_GET['edit']))
{
if (get_user_class() >= UC_MODERATOR)
$sql=mysql_query("SELECT id,text FROM shoutbox WHERE id=". sqlesc($_GET['edit']));
else
$sql=mysql_query("SELECT id,text FROM shoutbox WHERE id=". sqlesc($_GET['edit']) ." AND userid=". sqlesc($CURUSER['id']));
$res=mysql_fetch_array($sql);
if (!empty($res))
{
?>
</head> <body bgcolor=#f4f4f4>
<?php echo '<form method=post action=shoutbox.php>';
echo '<input type=hidden name=id value='.(int)$res['id'].'>';
echo '<textarea name=text width=500 id=specialbox>'.htmlspecialchars($res['text']).'</textarea>';
echo '<input type=submit name=save value='.Zapisz.' class=btn>';
echo '</form></body></html>';
die;
}
}
// UPDATE SHOUT?
if (isset($_POST['text']) && is_valid_id($_POST['id']))
{
$text = trim($_POST['text']);
$id = (int)$_POST['id'];
if (isset($text) && isset($id) && is_valid_id($id))
{
if (get_user_class() >= UC_MODERATOR)
mysql_query("UPDATE shoutbox SET text = ". sqlesc($text) ." WHERE id=". sqlesc($id));
else
mysql_query("UPDATE shoutbox SET text = ". sqlesc($text) ." WHERE id=". sqlesc($id) ." AND userid=".sqlesc($CURUSER['id']));
}
}
//deleting messages
if (isset($_GET['del']))
{
if (is_numeric($_GET['del']))
{
$query = "SELECT * FROM shoutbox WHERE id=".$_GET['del'];
$result = mysql_query($query);
}
else {
echo "<center>Nieznane ID wiadomo¶ci.</center>";
exit;}
$row = mysql_fetch_row($result);
if (get_user_class() >= UC_MODERATOR)
{
mysql_query("DELETE FROM shoutbox WHERE id=".$_GET['del']);
}
else
{
mysql_query("DELETE FROM shoutbox WHERE id=".$_GET['del']." AND userid=" . $CURUSER['id']);
}
}
?>
<html><head>
<script language=JavaScript>
<!--
//Disable right click script III- By Renigade (renigade@mediaone.net)
//For full source code, visit http://www.dynamicdrive.com
var message="";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
// -->
</script>
<title>ShoutBox</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<style type="text/css">
A {color: #000000; font-weight: bold; }
A:hover {color: #FF0000; text-decoration: underline overline;}
.small {font-size: 8pt; font-family: verdana; }
.date {font-size: 7pt;}
</style>
<STYLE>BODY {
SCROLLBAR-3DLIGHT-COLOR: #004E98;
SCROLLBAR-ARROW-COLOR: #004E98;
SCROLLBAR-DARKSHADOW-COLOR: white;
SCROLLBAR-BASE-COLOR: white
}
</STYLE>
</head>
<body bgcolor=#f4f4f4>
<?
/*
if ($CURUSER["chatpost"] == 'no')
{
print("<h2><br><center>Jeste¶ zbanowany!.</center></h2>");
exit;
}
else
{
*/
if($_GET["sent"]=="yes")
if(!$_GET["shbox_text"])
{
$userid=$CURUSER["id"];
}
else
{
$userid=$CURUSER["id"];
$username=$CURUSER["username"];
$date=sqlesc(time());
$text=trim($_GET["shbox_text"]);
$text = stripslashes($text);
if (!empty($text))
if ($text != "")
{
$res = mysql_query("SELECT * FROM shoutbox WHERE userid=".sqlesc($CURUSER['id'])." ORDER BY date DESC LIMIT 1") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) == 0)
mysql_query("INSERT INTO shoutbox (id, userid, username, date, text) VALUES ('id'," . sqlesc($userid) . ", " . sqlesc($username) . ", $date, " . sqlesc($text) . ")") or sqlerr(__FILE__, __LINE__);
else
{
$arrflood=mysql_fetch_array($res);
if ($text != $arrflood["text"])
mysql_query("INSERT INTO shoutbox (id, userid, username, date, text) VALUES ('id'," . sqlesc($userid) . ", " . sqlesc($username) . ", $date, " . sqlesc($text) . ")") or sqlerr(__FILE__, __LINE__);
}
}
print "<script type=\"text/javascript\">parent.document.forms[0].shbox_text.value='';</script>";
}
$res = mysql_query("SELECT * FROM shoutbox ORDER BY date DESC LIMIT 70") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) == 0)
print("\n");
else
{
print("<table border=0 cellspacing=0 cellpadding=2 width='100%' align='left' class='small'>\n");
while ($arr = mysql_fetch_assoc($res))
{
$res2 = mysql_query("SELECT username,class,avatar,donor, title,enabled,warned FROM users WHERE id=$arr[userid]") or sqlerr(__FILE__, __LINE__);
$arr2 = mysql_fetch_assoc($res2);
$resowner = mysql_query("SELECT id, username, class FROM users WHERE id=$arr[userid]") or print(mysql_error());
$rowowner = mysql_fetch_array($resowner);
if ($arr['userid'] != $CURUSER['id'])
$pm = "[<a class=altlink target=_blank href=sendmessage.php?receiver=$rowowner[id]>PW</a>]\n";
else
$pm = "";
if ($rowowner["class"] == "10")
$usercolor= "<font color=#a52a2a>" .htmlspecialchars($rowowner["username"]). "</font>";
if ($rowowner["class"] == "9")
$usercolor= "<font color=#0600ff>" .htmlspecialchars($rowowner["username"]). "</font>";
if ($rowowner["class"] == "8")
$usercolor= "<font color=#ff6600>" .htmlspecialchars($rowowner["username"]). "</font>";
if ($rowowner["class"] == "7")
$usercolor= "<font color=#00008b>" .htmlspecialchars($rowowner["username"]). "</font>";
if ($rowowner["class"] == "6")
$usercolor= "<font color=#009900>" .htmlspecialchars($rowowner["username"]). "</font>";
if ($rowowner["class"] == "5")
$usercolor= "<font color=#1e90ff>" .htmlspecialchars($rowowner["username"]). "</font>";
elseif ($rowowner["class"] == "4")
$usercolor= "<font color=#ff1e1e>" .htmlspecialchars($rowowner["username"]). "</font>";
elseif ($rowowner["class"] == "3")
$usercolor= "<font color=#c71585>" .htmlspecialchars($rowowner["username"]). "</font>";
elseif ($rowowner["class"] == "2")
$usercolor= "<font color=#9900cc>" .htmlspecialchars($rowowner["username"]). "</font>";
elseif ($rowowner["class"] == "1")
$usercolor= "<font color=#000000>" .htmlspecialchars($rowowner["username"]). "</font>";
elseif ($rowowner["class"] == "0")
$usercolor= "<font color=#696969>" .htmlspecialchars($rowowner["username"]). "</font>";
if (get_user_class() >= UC_MODERATOR) {
$del="[<a href=/shoutbox.php?del=".$arr[id].">D</a>]";
}
else if ($arr['userid'] == $CURUSER['id']){
$del="[<a href=/shoutbox.php?del=".$arr[id].">D</a>]";
}
else
$del="";
if (get_user_class() >= UC_MODERATOR) {
$edit="[<a href=/shoutbox.php?edit=".$arr[id].">E</a>]";
}
else if ($arr['userid'] == $CURUSER['id']){
$edit="[<a href=/shoutbox.php?edit=".$arr[id].">E</a>]";
}
else
$edit="";
print("<tr><td><font color=gray>[<span class='date'>".strftime("%d.%m %H:%M",$arr["date"])."]</font>
$del
$edit
$pm
</span>
<a href='userdetails.php?id=".$arr["userid"]."' target='_blank'>$usercolor</a>" .
($arr2["donor"] == "yes" ? "<img src=pic/star.gif alt=\"Donator\">" : "") .
($arr2["warned"] == "yes" ? "<img src="."/pic/warned.gif alt=\"Warned\">" : "") .($arr2["enabled"] == "no" ? "<img src="."/pic/disabled.gif alt=\"Disabled\">" : "").format_comment(
":$arr[text]
"));
}
print("</table>");
}
?>
</body>
</html>
PS. Mógłby ktoś zrobić tak jak jest w histori, tzn, chodzi mi o tabele, ze data jest w jednej tabeli i reszta w drugiej. Ja chce zeby data,pw,edycja,usuwanie było w jednej a reszta w drugiej

Z góry THX
