Файл: rusikanlove/rusikanlove/news.php
Строк: 46
<?php
include_once"template/session.php";
include_once"ini.php";
include_once"funct/pages.ini.php";
$id = $_SESSION['id'];
$auth_u = mysql_query("SELECT id FROM user WHERE id='$id'");
if(mysql_num_rows($auth_u)=="0"){ session_destroy(); header('Location: /index.php');}
if($_SESSION['auth']=="1"){
mysql_query("UPDATE user SET time='$time' WHERE id='$id'");
$url = "news.php?";
$wf = 5; //количество сообщений на страницу
$x = mysql_query("SELECT * FROM `news`");
$tp = mysql_num_rows($x);
$mp = ceil($tp/$wf);
$page = (int)$_GET['page'];
if($page < 1){ $page = 1; }
if($page > $mp){ $page = $mp; }
$start = $page * $wf - $wf;
if(!preg_match('#^[0-9]{1,3}$#i',$page)) $page=1;
if(mysql_num_rows($x)!="0"){
include_once"template/head.php";
echo'<div class="r"><img src="image/icon/news.png" alt="" />Новости</b></div>';
$z = mysql_query("SELECT * FROM `news` ORDER BY `id` DESC LIMIT $start,$wf");
while($arr = mysql_fetch_array($z)){
echo'<img src="/image/icon/elka.png" alt="" /><b>'.$arr['title'].'</b><br />
'.$arr['date'].'<br />
'.$arr['msg'].'<br /><br />';
}
page($tp,$page,$wf,$url);
echo'<br /><img src="image/icon/home.png" alt="." /><a href="menu.php">Меню</a><br />';
include_once"template/foot.php";
} else {
include_once"template/head.php";
echo'<div class="r"><img src="image/icon/news.png" alt="" />Новости</b></div>';
echo'На данный момент нету ни одной новости<br />
<img src="image/icon/home.png" alt="." />
<a href="menu.php">Меню</a><br />';
include_once"template/foot.php";
}
} else { session_destroy(); header('Location: index.php'); }
?>