Файл: region_clean/news.php
Строк: 90
<?
#######################################
## Mod By KoT (borispol) [76-75-072] ##
#######################################
require_once "start.php";
require_once "sid.php";
header('Cache-Control: no-store, no-cache, must-revalidate');
if ($ver == "wml")header ("Content-type:text/vnd.wap.wml; charset=utf-8");
else header("Content-Type:text/html; charset=UTF-8");
require_once "inc.php";
$link = connect_db();
list($row, $id, $ps, $fsize1, $fsize2) = check_login($link);
require_once "version.php";
$cm = mysql_query ("select count(id) as num from news WHERE 1;");
$cmc = mysql_fetch_array($cm);
$news = $cmc['num'];
$cm1 = mysql_query ("select count(id) as num from newskom WHERE mid='$mid';");
$cmc1 = mysql_fetch_array($cm1);
$kom = $cmc1['num'];
if ($ver == "wml") {
echo $xml;
echo $dtd;
echo "<wml>n
<card title="Новости чата">n
<p align="left">n";
} else {
echo "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><link rel="stylesheet" type="text/css" href="css/$css.css"/>
<title>Новости чата</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>
<div align="left">n";
}
$new = mysql_query ("select count(id) as num from news;");
$news = mysql_fetch_array($new);
$num = $news['num'];
if (!isset($s)) $s = 0;
$mx = round(($num/5) + 0.45);
if ($s > $mx) $s = $mx;
if ($s == 0) $s = 1;
$ot = (($s - 1) * 5) + 1;
$do = $s * 5;
if ($do > $num) $do = $num;
$o = $ot - 1;
$n = $ot;
if ($do == 0) $n = $o;
echo $fsize1;
echo "Показывает $n-$do из $num<br/>n";
echo $divide;
echo $fsize2;
$o = intval($o);
$do = intval($do);
$r = mysql_query ("select * from `news` order by id desc limit $o,$do");
$re = mysql_query ("select id from `news` order by id desc limit $o,$do");
for ($i = $ot; $i <= $do; $i++) {
$arr = mysql_fetch_array($r);
$arr2 = mysql_fetch_array($re);
echo $fsize1;
$arr2['id'] = intval($arr2['id']);
echo "<b>".$arr['date']."</b><br/> ".$arr['content']."<br/>
<u>Разместил(а):</u><b> ".col_n($arr['login'])."</b><br/>";
$koms = mysql_fetch_array(mysql_query("SELECT COUNT(id) from newskom WHERE mid = '".$arr2['id']."'"));
echo "<a href="newskom.php?$ses&mid=".$arr2['id']."">Комментарии</a>(".$koms[0].")<br/>n";
echo $divide;
echo $fsize2;
}
mysql_close($link);
$next = $s + 1;
$prev = $s - 1;
if ($num > $do) {
$ot = (($next - 1) * 5) + 1;
$do = $next * 5;
if ($do > $num) $do = $num;
echo $fsize1;
echo "<a href="news.php?$ses&s=$next&ref=$ref">>>$ot-$do>></a><br/>n";
echo $fsize2;
}
if ($s > 1) {
$ot = (($prev - 1) * 5) + 1;
$do = $prev * 5;
echo $fsize1;
echo "<a href="news.php?$ses&s=$prev&ref=$ref"><<$ot-$do<<</a><br/>n";
echo $fsize2;
}
echo $fsize1;
echo $divide;
echo "<div class = 'd1'><a href="enter.php?$ses&ref=$ref">Прихожая</a></div>";
echo $fsize2;
include_once "foot.php";
?>