View file news.php

File size: 2.04Kb
<?php
error_reporting(0);
$urls='news.php';
include("config.php");
include("./includes/html/banned");

list($msec, $sec) = explode(chr(32), microtime()); 
$headtime = $sec + $msec;

$ref = rand(1000, 9999);

header ("Content-type: text/html; charset=utf-8");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-relative");
include("./template/head.php");
//AUTH
$q = mysql_query("SELECT `id` FROM `chat_users` WHERE `id` = '".$id."' AND `password` = '".$password."';");
if(mysql_num_rows($q) == 0)
{
include("./reginc.php");
include("./template/foot.php");
exit();
}
//END AUTH

$nid = intval($_GET['nid']);

$q = mysql_query("SELECT * FROM `chat_news` WHERE `id` = '".$nid."';");

if(mysql_num_rows($q) == 0)
{
echo "Новости с таким ID не существует!<br/>";
include("./template/foot.php");
exit();
}
else
{
$news = mysql_fetch_array($q);
$name = $news['name'];
$text = $news['blob'];
$author = $news['author'];
$date = $news['date'];
}

echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
echo "<html><head>\n";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n";
echo "<link rel=\"shortcut icon\" href=\"$icon\" /><title>".$name."</title>\n";
echo "<style type=\"text/css\">
body { font-weight: normal; font-size: normal; font-family: ".$font."; color: ".$color."; background-color: ".$background." }
a:link,a:active,a:visited { text-decoration: underline; color : ".$links." }
</style></head><body><div style=\"text-align: left\">\n";

//ONLINE
$online = time() + 60;
$update = mysql_query("UPDATE `chat_users` SET `time` = '".$online."', `place` = 0, `ip` = '".getenv('REMOTE_ADDR')."', `ua` = '".htmlspecialchars(getenv('HTTP_USER_AGENT'))."' WHERE `id` = '".$id."';");
//END ONLINE

echo "<u>$author [$date]:</u><br/>\n";
echo "$text<br/>\n";
echo "<a href=\"index.php\">Меню чата</a><br/>";
include("./template/foot.php");
break;
?>