Файл: news.php
Строк: 67
<?
session_start();
include ('inc/db.php');
if (isset($_SESSION['user_id']))
{
$query = "SELECT *
FROM `user`
WHERE `id_user`='{$_SESSION['user_id']}'
LIMIT 1";
$sql = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_assoc($sql);
}
$title = "Новости";
include ('inc/head.php');
include 'inc/functions.php';
if (empty($_GET['str'])) {
$start = int(@$_GET['start']);
$on_page = 10;
if (empty($_GET['start'])) {
$start =0;
}
$qz = mysql_query("SELECT COUNT(*) FROM `news`");
$coltem = mysql_result($qz, 0);
$queryq = "SELECT *
FROM `news` ORDER BY id_new DESC LIMIT $start, $on_page";
$sqlq = mysql_query($queryq) or die(mysql_error());
if ($coltem == 0)
{
?>
<div class="name">Новости:</div>
<span class="err">
Новостей нет!
</span>
<div class="name">Навигация:</div>
<div class="blockin">
<div class="link"><a href="index.php">На главную</a></div>
</div>
<?
} else {
?>
<div class="name">Новости:</div>
<div class="blockin">
<?
while($myrow = mysql_fetch_assoc($sqlq))
{
echo '<div class="links">';
echo ''.$myrow['date'].'<br/>';
echo displaysmileys($myrow['text']);
echo '<br/><a href="news.php?str=sm&id='.$myrow['id_new'].'">подробней..</a>';
if (@$row['adm'] > 0) {
echo '<br/><a href=tech/tech.php?str=rednews&id='.$myrow['id_new'].'>ред.</a> <a href=tech/tech.php?str=delnews&id='.$myrow['id_new'].'>уд.</a>';
}
echo '</div>';
}
?>
</div>
<div class="name">Навигация:</div>
<div class="blockin">
<div class="links">
<?
echo pagenav('news.php?', $start, $coltem, $on_page);
?>
</div>
<div class="link"><a href="index.php">На главную</a></div>
</div>
<?
}
}
if (@$_GET['str']=="sm") {
$id = int(my_htmlspecialchats($_GET['id']));
$sites = mysql_num_rows(mysql_query("SELECT * FROM news WHERE id_new = '$id'"));
if ($sites == 1) {
$result = mysql_query("SELECT * FROM news WHERE id_new = '$id' LIMIT 1");
?>
<div class="name">Новости:</div>
<div class="blockout">
<div class="blockin">
<?
while($myrow = mysql_fetch_array($result))
{
$logg = @$myrow['name'];
$query55 = "SELECT *
FROM `user`
WHERE `login`='$logg'";
$sql55 = mysql_query($query55) or die(mysql_error());
$myrow55 = mysql_fetch_array($sql55);
echo ''.$myrow['date'].'<br/>';
echo displaysmileys($myrow['fulltext']);
}
?>
</div></div>
<div class="name">Навигация:</div>
<div class="blockin">
<div class="link"><a href="news.php">Архив новостей</a></div>
<div class="link"><a href="index.php">На главную</a></div>
</div>
<?
} else {
?>
<div class="name">Новости:</div>
<span class="err">
Такой новости не существует!</span>
<div class="name">Навигация:</div>
<div class="blockin">
<div class="links"><a href="news.php">Архив новостей</a></div>
<div class="links"><a href="index.php">На главную</a></div>
</div>
<?
}
}
include ('inc/foot.php');
?>