<?
include_once 'sys/inc/start.php';
include_once 'sys/inc/compress.php';
include_once 'sys/inc/sess.php';
include_once 'sys/inc/home.php';
include_once 'sys/inc/settings.php';
include_once 'sys/inc/db_connect.php';
include_once 'sys/inc/ipua.php';
include_once 'sys/inc/fnc.php';
include_once 'sys/inc/user.php';
$set['title']='Правила Ролевой Наруто';
include_once 'sys/inc/thead.php';
title();
err();
aut();
if (isset($_GET['view']) && $_GET['view']!=NULL && $_GET['view']=intval($_GET['view']))
{
$view = mysql_fetch_array(mysql_query("SELECT * FROM `narutorules` WHERE `id` = '".intval($_GET['view'])."' LIMIT 1"));
if($view==NULL){echo "Ошибка !";break;}
echo '<div class="p_m"><font color="green"><b>Название:</b></font><br>'.$view['title'].' </div><a href="narutorules.php?edit='.$view['id'].'"></a>';
echo '<div class="p_m"> '.output_text($view['text']).'</div><a href="narutorules.php?edit='.$view['id'].'"></a>';
echo '«<a href="narutorules.php">В правила</a><br/>';
echo '<div class="foot">';
echo '</div>';
}
if (!isset($_GET['view']))
{
$k_narutorules=mysql_result(mysql_query("SELECT COUNT(*) FROM `narutorules`"),0);
$k_page=k_page($k_narutorules,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
echo "<table class='post'>\n";
if ($k_narutorules==0)
{
echo " <tr>\n";
echo " <td class='p_t'>\n";
echo "Нет правил.\n";
echo " </td>\n";
echo " </tr>\n";
}
$q=mysql_query("SELECT * FROM `narutorules` ORDER BY `id` ASC LIMIT $start, $set[p_str]");
while ($narutorules = mysql_fetch_array($q))
{
echo " <tr>\n";
echo " <td class='p_t'>\n";
echo '<a href="narutorules.php?view='.$narutorules['id'].'">'.$narutorules['title'].'</a><br/>';
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
}
echo "</table>\n";
if ($k_page>1)str("?",$k_page,$page);
}
include_once 'sys/inc/tfoot.php';
?>