<?php
define('PROTECTOR', 1);

$headmod = 'library';//фикс. места

$textl='Помощь по игре';
include('files/path.php');
include($path.'files/db.php');
include($path.'files/auth.php');
include($path.'files/func.php');
include($path.'files/core.php');
include($path.'files/head.php');
include($path.'files/zag.php');
function main()
{
$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&amp;lb=list_library\">%s</a><br/>",$lists[id],$lists[title]);
} while($lists = mysql_fetch_array($whiel));
}
}
function library_info()
{
if(empty($_GET['id'])){
echo'Невыбрана статья!<br/>';
include($path.'files/down.php');
exit;
}
$whiel = mysql_query("SELECT * FROM library WHERE id='$_GET[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/>";
}


if($_GET[lb] == "")
{main();}
elseif($_GET[lb] == "list_library")
{library_info();}

include($path.'files/down.php');
?>
