require "include/bittorrent.php";
dbconn(false);
loggedinorreturn();
$out = $_GET['out'];
if ($out) // Sentbox
{
stdhead("Sentbox", false);
print("
\n");
print("Sentbox \n");
print("\n");
$res = mysql_query("SELECT * FROM messages WHERE sender=" . $CURUSER["id"] . " AND location IN ('out','both') ORDER BY added DESC") or die("barf!");
if (mysql_num_rows($res) == 0)
stdmsg("Information","Your Sentbox is empty!");
else
while ($arr = mysql_fetch_assoc($res))
{
$res2 = mysql_query("SELECT username FROM users WHERE id=" . $arr["receiver"]) or sqlerr();
$arr2 = mysql_fetch_assoc($res2);
$receiver = "" . $arr2["username"] . " ";
$elapsed = get_elapsed_time(sql_timestamp_to_unix_timestamp($arr["added"]));
print("
\n");
print("To $receiver at\n" . $arr["added"] . " ($elapsed ago) GMT\n");
if (get_user_class() >= UC_MODERATOR && $arr["unread"] == "yes")
print("(Unread! ) ");
print("
\n");
print(format_comment($arr["msg"]));
print("
\n");
print("
\n");
print("Delete \n");
print("
\n");
}
}
else // Inbox
{
stdhead("Inbox", false);
print("\n");
print("Inbox \n");
print("\n");
$res = mysql_query("SELECT * FROM messages WHERE receiver=" . $CURUSER["id"] . " AND location IN ('in','both') ORDER BY added DESC") or die("barf!");
if (mysql_num_rows($res) == 0)
stdmsg("Information","Your Inbox is empty!");
else
while ($arr = mysql_fetch_assoc($res))
{
if (is_valid_id($arr["sender"]))
{
$res2 = mysql_query("SELECT username FROM users WHERE id=" . $arr["sender"]) or sqlerr();
$arr2 = mysql_fetch_assoc($res2);
$sender = "" . ($arr2["username"]?$arr2["username"]:"[Deleted]") . " ";
}
else
$sender = "System";
$elapsed = get_elapsed_time(sql_timestamp_to_unix_timestamp($arr["added"]));
print("
\n");
print("From $sender at\n" . $arr["added"] . " ($elapsed ago) GMT\n");
if ($arr["unread"] == "yes")
{
print("(NEW! ) ");
mysql_query("UPDATE messages SET unread='false' WHERE id=" . $arr["id"]) or die("arghh");
}
print("
\n");
print(format_comment($arr["msg"]));
print("
\n");
print("
\n");
print(($arr["sender"] ? "Reply " : "Reply ") .
" | Delete \n");
/*
if (get_user_class() >= UC_MODERATOR)
{
print("Templates: ".
($arr["sender"] ? "
FAQ " : "
FAQ ").
" | What else?".
"
\n");
}
*/
print("
\n");
}
}
print("
\n");
print("Do you need to find someone?
\n");
stdfoot();
?>