Файл: www/quests.php
Строк: 40
<?php
include 'inc/mysql.php';
include 'inc/check.php';
include 'inc/functions.php';
top();
include 'inc/account.php';
$titlestr='Дневник';
include 'inc/interface.php';
if(isset($_SESSION['auth']) && $_SESSION['auth']==1){
echo '
<div class="title">
Дневник
</div>
';
$cop=10;
$ca=mysql_result(mysql_query("SELECT COUNT(*) FROM `quests` WHERE `account`='".$account['id']."'"),0);
$cp=ceil($ca/$cop);
if(isset($_GET['page']) && is_numeric($_GET['page'])){
$page = $_GET['page'];
if($_GET['page']>$cp) $page=$cp;
if($_GET['page']<1)$page=1;
}else{
$page=1;
}
$start=$page*$cop-$cop;
$q=mysql_query("SELECT * FROM `quests` WHERE `account`='".$account['id']."' ORDER BY `id` DESC LIMIT $start,$cop");
if ($ca==0){
echo '
<div class="help">
Нет заданий!
</div>
';
}
while ($result=mysql_fetch_assoc($q)){
echo '<div class="border-top"></div>';
echo '<div class="tools"><font color="#3d8e2f">'.mysql_result(mysql_query("SELECT `name` FROM `quest` WHERE `id`='".$result['quest']."'"),0).'</font>';
if ($result['complet']){
echo ' <font color="gray">(Выполнено)</font>';
}
echo '</div>';
echo '<div class="help">';
echo '<font color="#8e8171">'.mysql_result(mysql_query("SELECT `about` FROM `quest` WHERE `id`='".$result['quest']."'"),0).'</font><br />';
@$mob = mysql_result(mysql_query("SELECT `name` FROM `mobs` WHERE `ident_id`='".$result['kill_mob']."' LIMIT 1"),0);
@$res = mysql_result(mysql_query("SELECT `name` FROM `items` WHERE `id`='".$result['res_need']."'"),0);
if ($result['kill_mob']){
echo $mob.' - убито '.$result['kill_mob_col_kill'].'/'.$result['kill_mob_col'].'<br />';
}
if ($result['res_need']){
echo $res.' '.mysql_result(mysql_query("SELECT COUNT(*) FROM `inventory` WHERE `ident_id`='".$result['res_need']."'"),0).'/'.$result['res_need_col'].'<br />';
}
echo '</div>';
}
echo '<div class="nstr">';
echo '
Страницы
';
if($page-1>0){
echo '<a href="?page='.($page-1).'"><</a> ';
}
if($page-1>0){
echo '<a href="?page='.($page-1).'">'.($page-1).'</a> ';
}
echo '<b>'.$page.'</b>';
if($page+1<=$cp){
echo ' <a href="?page='.($page+1).'">'.($page+1).'</a>';
}
if($page+1<=$cp){
echo ' <a href="?page='.($page+1).'">></a>';
}
echo '</div>';
}else{
header("Location: /?"); exit;
}
down();
?>