Файл: colxoz.ru/quest.php
Строк: 55
<?
include './system/common.php';
include './system/functions.php';
include './system/user.php';
if(!$user) {
header('location: /');
exit;
}
$title = 'Задания';
include './system/h.php';
?>
<div class='title'><?=$title?></div>
<div class='line'></div>
<div class='content' align='center'>
<font color='#90b0c0'>Выполняй задания и получай отличную награду</font>
</div>
<div class='line'></div>
<div class='menu'>
<li class='no_b'></li>
<?
$q = mysql_query('SELECT * FROM `quests` LIMIT 10');
$i = 0;
while($row = mysql_fetch_array($q)) {
$quest = mysql_query('SELECT * FROM `quest` WHERE `user` = "'.$user['id'].'" AND `quest` = "'.$row['id'].'"');
$quest = mysql_fetch_array($quest);
if(!$quest) {
mysql_query('INSERT `quest` (`user`,
`quest`) VALUES ("'.$user['id'].'",
"'.$row['id'].'")');
}
$quest = mysql_query('SELECT * FROM `quest` WHERE `user` = "'.$user['id'].'" AND `quest` = "'.$row['id'].'"');
$quest = mysql_fetch_array($quest);
if($quest['end'] == 0) {
$progress = round(100 / ($row['count'] / $quest['count']));
if($progress > 100) {
$progress = 100;
}
if($quest['count'] < $row['count']) {
$i++;
}
if($quest['count'] < $row['count']) echo '<li>'; else echo '<div class='block' style='text-align: left;'>';
?>
<font color='#90c090'><b><?=$row['name']?></b></font><br/>
<small><?=$row['about']?><br/>
<font color='#90b0c0'>Прогресс:</font> <?=$quest['count']?> из <?=$row['count']?>
<div style='border:1px solid #000; background: #ffffff; height: 4px; width: 50%;'>
<div style='background: #fc3; height: 4px; width: <?=$progress?>%;'></div>
</div>
<font color='#90b0c0'>Награда:</font> <?=($row['_g'] > 0 ? '<img src='/images/icon/gold.png' alt='*'/> '.$row['_g']:'')?> <?=($row['_s'] > 0 ? '<img src='/images/icon/silver.png' alt='*'/> '.$row['_s']:'')?> <?=($row['_exp'] > 0 ? '<img src='/images/icon/exp.png' alt='*'/> '.$row['_exp']:'')?></small>
<?
if($quest['count'] >= $row['count']) {
?><br/><br/>
<div align='center'><a href='/quest/<?=$quest['id']?>/end/' class='button'>Завершить задание</a></div>
<?
}
if($quest['count'] < $row['count']) echo '</li>'; else echo '</div>';
}
}
?>
<li class='no_b'></li>
</div>
<?
include './system/f.php';
?>