PHP Code:
///////////////////////////// in box main
addonline(getuid_sid($sid),"inbox","");
addplace(getuid_sid($sid),"inbox","");
echo "<title>site-Inbox</title>";
$theme = mysql_fetch_array(mysql_query("SELECT theme FROM database_users WHERE id='".$uid."'"));
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"/style/$theme[0]\" />";
echo "</head>";
include("top.php");
echo "<div class=\"announcement\">";
echo "<b>Private Messages</div></b>";
echo "<meta http-equiv=\"refresh\" content=\"20; URL= inbox.php?page=$page&time=";
echo date('dmHis');
echo "\">";
echo "<div class='box'><div class=\"div\"><a href=\"inbox.php\">Inbox</a> <b>·</b> ";
echo "<a href=\"inbox.php?ac=myfolder\">My Folder</a></div> </div> ";
mysql_query("UPDATE cc0801_private SET newpm='0' WHERE touid='".$uid."' AND newpm='1'");
$opt = $_POST["opt"];
$uid = getuid_sid($sid);
if($opt=="3")
{
$checkbox = $_POST["checkbox"];
if (empty($checkbox))
{
echo "Pls select one or more messages to delete<br/>";
}else{
$count = count($checkbox);
for($i=0; $i < $count; $i++)
{
$res = mysql_query("DELETE FROM cc0801_private WHERE id='".safe(cleanInput($checkbox[$i]))."' AND touid='".$uid."'");
}
if($res)
{
if($count=="1")
{
echo "$count message deleted successfully<br/>";
}else{
echo "$count messages deleted successfully<br/>";
}
}else{
echo "Pls try again later<br/>";
}
}
}else
if($opt=="4")
{
$cou = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM cc0801_private WHERE touid='".$uid."' AND starred='1'"));
if($cou[0]>50)
{
echo "You have already 50 messages in your folder<br/>";
}else{
$checkbox = $_POST["checkbox"];
if (empty($checkbox))
{
echo "Pls select one or more messages to move<br/>";
}else{
$count = count($checkbox);
for($i=0; $i < $count; $i++)
{
$res = mysql_query("UPDATE cc0801_private SET starred='1' WHERE id='".safe(cleanInput($checkbox[$i]))."' AND touid='".$uid."'");
}
if($res)
{
if($count=="1")
{
echo "$count message move to folder successfully<br/>";
}else{
echo "$count messages move to folder successfully<br/>";
}
}else{
echo "Pls try again later<br/>";
}
}
}
}
echo "<div class='box'>";
//////ALL LISTS SCRIPT <<
// if($view=="")$view="all";
if($page=="" || $page<=0)$page=1;
$msgi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM cc0801_private WHERE touid='".$uid."'"));
$today = date("dF20y");
$doit=false;
$num_items = $msgi[0]; //changable
$items_per_page= 10;
$num_pages = ceil($num_items/$items_per_page);
if($page>$num_pages)$page= $num_pages;
$limit_start = ($page-1)*$items_per_page;
if($num_items>0)
{
//changable sql
$sql = "SELECT
a.name, a.bmizt_rank, b.id, b.byuid, b.unread, b.text, b.timesent FROM database_users a
INNER JOIN cc0801_private b ON a.id = b.byuid
WHERE b.touid='".$uid."' GROUP BY b.byuid
ORDER BY b.timesent DESC LIMIT $limit_start, $items_per_page
";
$items = mysql_query($sql);
echo mysql_error();
while ($item = mysql_fetch_array($items))
{
$bm = mysql_fetch_array(mysql_query("SELECT id FROM database_users WHERE id='".$item[0]."'"));
$who = getuid_nick($item[0]);
$avlink = getavatar($who);
echo "<div class='padding'>";
if($item[4]=="1")
{
$lnk = "<img src=\"img/npm.png\" width=\"20\" height=\"20\"/><img class=\"bm\" src=\"$avlink\" alt=\"$id\" width=\"20\" height=\"20\"/><a href=\"inbox.php?ac=readmsg&who=$item[3]&pmid=$item[2]\"><font color=\"".ncolor($who)."\">$item[0]</font><a href=\"inbox.php?ac=readmsg&who=$item[3]&pmid=$item[2]\"></a>";
}
else if($item[4]=="2")
{
$lnk = "<img src=\"img/ofpm.png\" width=\"20\" height=\"20\"/><img class=\"bm\" src=\"$avlink\" alt=\"$id\" width=\"20\" height=\"20\"/><a href=\"inbox.php?ac=read&who=$item[3]&pmid=$item[2]\"><font color=\"".ncolor($who)."\">$item[0]</font></a>";
}else {
$lnk = "<img src=\"img/opm.png\" width=\"20\" height=\"20\"/><img class=\"bm\" src=\"$avlink\" alt=\"$id\" width=\"20\" height=\"20\"/><a href=\"inbox.php?ac=read&who=$item[3]&pmid=$item[2]\"><font color=\"".ncolor($who)."\">$item[0]</font></a>";
}
$number = strlen($item[5]);
if($number>10)
{
$text = substr("$item[5]", 0, 10);
$text = parsetitle($text);
$text = "$text...";
}else{
$text = substr("$item[5]", 0, 10);
$text = parsetitle($text);
}
echo "$lnk $text";
/*
$tmstamp = $item[6];
$ndate = date("dF20y", $tmstamp);
$today = date("dF20y");
$mday = date("d")-1;
if($mday>9)
{
$yesterday = date("".$mday."F20y");
}else{
$yesterday = date("0".$mday."F20y");
}
if($ndate==$today)
{
$timetxt = date("h:i:sa", $tmstamp);
echo "<small>Today - $timetxt</small>";
}else
if($ndate==$yesterday)
{
$timetxt = date("h:i:sa", $tmstamp);
echo "<small>Yesterday - $timetxt</small>";
}else{
$timetxt = date("dF20y - h:i:sa", $tmstamp);
echo "<small>$timetxt</small>";
}*/
echo "</div>";
}
////echo " <select name=\"opt\">";
if($opt=="1")
{
////echo "<option value=\"2\">Unmark All</option>";
}else{
///echo "<option value=\"1\">Mark All</option>";
}
///echo "<option value=\"3\" selected>Delete</option>";
///echo "<option value=\"4\">Move to My Folder</option>";
///echo "</select>";
///echo "<input type=\"submit\" class=\"button\" value=\"Submit\"/>";
///echo "</form>";
$unreadinbox=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM cc0801_private WHERE unread='1' AND touid='".$uid."'"));
$unrd="".$unreadinbox[0]."";
echo"</div>";
echo "<div class='box'>You Have <b>$unrd</b> Unred PM</div>";
echo "<div class=\"e\">";
////page
if($num_pages>1)
{
echo "<div class='nav'>";
if($page>2)
{
echo "<a href=\"inbox.php?page=1\">1</a> ";
$ppage = $page-1;
echo "<a href=\"inbox.php?page=$ppage\"><<</a> ";
}
///
if($page>3)
{
$pageA = $page-2;
echo "<a href=\"inbox.php?page=$pageA\">$pageA</a> ";
}
if($page>1)
{
$pageB = $page-1;
echo "<a href=\"inbox.php?page=$pageB\">$pageB</a> ";
}
if($page<$num_pages||$page>1)
{
echo " <span class='navcurrent'>$page</span> ";
}
if($page<$num_pages)
{
$pageC = $page+1;
echo "<a href=\"inbox.php?page=$pageC\">$pageC</a> ";
}
if($page<$num_pages-2)
{
$pageD = $page+2;
echo "<a href=\"inbox.php?page=$pageD\">$pageD</a> ";
}
//
if($page+1<$num_pages)
{
$npage = $page+1;
echo "<a href=\"inbox.php?page=$npage\">>></a>";
echo " <a href=\"inbox.php?page=$num_pages\">$num_pages</a>";
}
echo "</div>";
if($num_pages>2)
{
$rets = "<form action=\"inbox.php\" method=\"get\">";
$rets .= "Jump to page: <input name=\"page\" style=\"-wap-input-format: '*N'\" size=\"3\"/>";
$rets .= "<input type=\"submit\" class=\"button\" value=\"Go\"/>";
// $rets .= "<input type=\"hidden\" name=\"rid\" value=\"$rid\"/>";
$rets .= "</form>";
echo $rets;
}
}
echo"</div></table></div>";
}else{
echo "No new messages<hr/>";
}
////// UNTILL HERE >>
echo "<div class=\"div\"><a href=\"inbox.php?ac=deleteread&confirm=1\">Delete Read</a><br/>";
echo "<a href=\"inbox.php?ac=emptyinbox&confirm=1\">Empty Inbox</a><br/>";
/////echo "<a href=\"inbox.php?ac=sendto\">Send Message</a>";
echo "</div>";
}
if($rid!="")
{
echo "<a href=\"chat.php?rid=$rid\">Back To Chat</a><br/>";
}
include("foot.php");
Comment