Файл: warwars.ru/library.php
Строк: 30
<?php
define('PROTECTOR', 1);
$headmod = 'library';//фикс. места
$textl='Помощь по игре';
include('files/path.php');
include('files/db.php');
include('files/auth.php');
include('files/func.php');
include('files/core.php');
include('files/head.php');
include('files/zag.php');
function main()
{
echo'<img src="pic/mesta/lib.png" alt="*"/><br/>';
$result = mysql_result(mysql_query("SELECT COUNT(*) FROM `library`"),0);
$whiel = mysql_query("SELECT id, title FROM `library`");
$lists = mysql_fetch_array($whiel);
if ($result == 0)
{ echo "--Статей нет--"; }
else{
do{
printf("<a href="library.php?id=%s&lb=list_library">%s</a><br/>",$lists[id],$lists[title]);
} while($lists = mysql_fetch_array($whiel));
}
}
function library_info()
{
$id=intval($_GET['id']);
if(empty($id)){
echo'Невыбрана статья!<br/>';
include($path.'files/down.php');
exit;
}
$id=intval($_GET['id']);
$whiel = mysql_query("SELECT * FROM library WHERE id='$id'");
$sta=mysql_num_rows($whiel);
if($sta==0){
echo'Невыбрана статья!<br/>';
include($path.'files/down.php');
exit;
}
$lists = mysql_fetch_array($whiel);
echo'<div class="event">';
echo "Название: <b>$lists[title]</b><br/><small>Дата добавления: <b>$lists[time]</b></small><br/>";
echo "------------<br/>";
echo "$lists[text]<br/>Автор: <b>$lists[author]</b></div>";
echo "<a href="library.php?">Назад</a><br/>";
}
$lb = (isset($_GET['lb'])) ? $_GET['lb'] : NULL;
if($lb == "")
{main();}
elseif($lb == "list_library")
{library_info();}
include('files/down.php');
?>