Файл: www/mess.php
Строк: 27
<?php
include"db_con.php";
if($_POST['page']) $_SESSION['page'] = (int)$_POST['page'];
if(!$_SESSION['page'] || $_SESSION['page'] == 1) $page = 0;
else
$page = $_SESSION['page'];
$number = mysql_result(mysql_query("SELECT COUNT(*) FROM `mail`"), 0);
$na_page=9;
$total_pages=ceil($number/$na_page);
$print = mysql_query("SELECT * FROM `mail` ORDER BY `id` DESC LIMIT ".$page.",".($na_page)."");
if (mysql_affected_rows() != 0)
{
while($arr = mysql_fetch_array($print))
{
echo $arr['user'].' ['.$arr['date'].'] [<span onClick="otv(''.$arr['user'].'')">Отв</span>] <br /> '.$arr['content'].' <br />';
}
}
else
{
echo'Пока нет сообщений';
}
/*Постраничка*/
for ($v=0;$v<$total_pages;$v++){
$page_number=$v*$na_page;
if(!$page_number) $page_number = 1;
if ($page_number!=$page) {
echo "<span style='cursor: pointer;' onClick='nav($page_number)'>[".($v+1)."]</span> ";
} else {
echo '<b>['.($v+1).']</b>';
}
}
?>