Файл: new_fanland/news.php
Строк: 65
<?php
###########################
# Данная версия скрипта принадлежит #
# LiraS aka Артур Лукин Иванович #
# Вносить свои изменения крайне #
# запрещенно! #
###########################
include("db.php");
include "cfg.php";
function news_script()
{
echo "<div class="pt"><center>Новости</center></div>";
echo "<div class="main"><div class="in">"; pochta();
$all = mysql_num_rows(mysql_query("SELECT * FROM news"));
if(isset($_GET['s'])){$s=intval($_GET['s']);}else{$s=0;}
if($s<0) $s=0;
if($s>$all) $s=0;
$c=$s+1;
$asd = mysql_query("SELECT title, nick, text, time FROM news ORDER BY id DESC LIMIT ".$s.", 10");
while($dsa = mysql_fetch_array($asd))
{
$i2 = $i++;
$title = strip_tags($dsa['title']);
$text = strip_tags($dsa['text']);
$time = strip_tags($dsa['time']);
$nick = strip_tags($dsa['nick']);
$title = iconv('windows-1251', 'utf-8', $title);
$text = iconv('windows-1251', 'utf-8', $text);
echo "<b>$title</b><small><b>[".vremya($time)."]</b></small><br/>$text<br/>Добавил: <b>$nick</b><br/>------<br/>";
}
if($all>0)
{
$ba=ceil($all/10);
$ba2=$ba*10-10;
echo "Страницы:";
$asd=$s-(10*3);
$asd2=$s+(10*4);
if($asd<$all && $asd>0){echo ' <a href="news.php?usr='.$_GET['usr'].'&pwd='.$_GET['pwd'].'&start=0&r='.$rand.'">1</a> .. ';}
for($i=$asd; $i<$asd2;)
{
if($i<$all && $i>=0)
{
$ii=floor(1+$i/10);
if($s==$i)
{
echo ' '.$ii;
}
else
{
echo ' <a href="news.php?usr='.$_GET['usr'].'&pwd='.$_GET['pwd'].'&s='.$i.'&r='.$rand.'">'.$ii.'</a>';
}
}
$i=$i+10;
}
if($asd2<$all){echo ' .. <a href="news.php?usr='.$_GET['usr'].'&pwd='.$_GET['pwd'].'&s='.$ba2.'&r='.$rand.'">'.$ba.'</a>';}
}
echo "<br><a href="main.php?usr=$_GET[usr]&pwd=$_GET[pwd]">В игру</a>";
}
$db_connection = mysql_connect($db_host, $db_user, $db_pass);
mysql_select_db($db_table, $db_connection);
mysql_query('SET NAMES cp1251');
$exist = mysql_num_rows(mysql_query("SELECT usr, pwd FROM users WHERE usr = '".mysql_real_escape_string($_GET['usr'])."' AND pwd = '".mysql_real_escape_string($_GET['pwd'])."'"));
$online = mysql_num_rows(mysql_query("SELECT * FROM online WHERE laikas > '$timeout'"));
$year = date("Y.m.d");
$times = date("H:i");
$vremechko = "$year $times";
$subt = file_get_contents("max_on.dat");
$max = explode("|", $subt);
$max_onl = $max[0];
$max_on_time = $max[1];
if ($online >= $max_onl)
{
$fp55 = fopen("max_on.dat", 'w');
fwrite($fp55, "$online|$vremechko|");
fclose($fp55);
}
$set['title']='Новости';
head();
title ();
if($exist == 1)
{
include("on.php");
if($_GET[id] == "")
{news_script();}
}
else
{
echo "<div class="main"><div class="in">";
echo "Вы не зарегистрированны!!!<br/>";
echo "<br/>";
}foot();
mysql_close($db_connection);
?>