<? //inbox.php
$data = mysql_query("SELECT * FROM mailbox WHERE `index` <= $index_end and `index` > $index_start")
or die(mysql_error());
$info = mysql_fetch_array( $data );
if($info['read'] == 0) {
echo "<span class=\"tableStyle\">";
$tabColor = "tableStyleNew";
}
else {
$tabColor = "tableStyleOld";
}
//print table start
echo "<table class=\"$tabColor\" bordercolor=\"#FFFFFF\" border=\"1\" cellpadding=\"0\" cellspacing=\"1\" align=\"center\"> <tr> <td width=\"109\">";
echo $info['UserName'];
echo "</td> <td width=\"462\">";
//print subject and message preview
$sub_msg = "<strong>" . $info['subject'] . "</strong> - " . $info['message'];
if(!$info['attachment'] == NULL)
echo " <img src=\"attachment.gif\" /> ";
echo "<a href=\"view_message.php\" ";
echo "onclick=\" <? openmail(); ?> \" ";
echo ">" . substr($sub_msg,'',50) ."...</a>";
//print value send
//print table end
echo "</td> <td width=\"90\">";
echo $info['time'];
echo "</td> </tr></table>";
?>
<? //admin home page
$index_start = 0;
$index_end = 10;
function increment() {
echo $index_start = $index_start + 10;
echo $index_end = $index_end + 10;
//header("location:admin_home.php");
}
function decrement() {
echo $index_start = $index_start - 10;
echo $index_end = $index_end - 10;
//header("location:admin_home.php");
}
function openmail() {
//setcookie('1stmsg',$index_start);
//return $_COOKIE['1stmsg'];
}
//$index_start = 0; //1
include ('inbox.php');
$index_start = $index_start + 1; //2
include ('inbox.php');
$index_start = $index_start + 1; //3
include ('inbox.php');
$index_start = $index_start + 1; //4
include ('inbox.php');
$index_start = $index_start + 1; //5
include ('inbox.php');
$index_start = $index_start + 1; //7
include ('inbox.php');
$index_start = $index_start + 1; //8
include ('inbox.php');
$index_start = $index_start + 1; //9
include ('inbox.php');
$index_start = $index_start + 1; //10
include ('inbox.php');
setcookie('1stmsg',"2");
?>
<center><a href="#" onclick="<? decrement(); ?>"> Previous 10</a> | <a href="#" onclick="<? increment(); ?>">Next 10</a></center>
<?
include('db_conexn.php');
/*if(isset($_COOKIE['userName']) {
echo " cookie set ";
}*/
$index = $_COOKIE['1stmsg'];
$data = mysql_query("SELECT * FROM mailbox WHERE `index` = $index ")
or die(mysql_error());
$info = mysql_fetch_array( $data );
echo $info['UserName'];
echo $info['time'];
echo $info['message'];
$mail=mysql_query("UPDATE mailbox SET `read` = 1 WHERE `index` = $index");
?>
check it (admin) http://www.yackub.peipians.com/admin.php
user : admin
Pass : 123
client side
user : dan
pass : 123