Файл: titwar.ru/lab.php
Строк: 120
<?
include './system/common.php';
include './system/functions.php';
include './system/user.php';
if(!$user) {
header('location: /');
exit;
}
switch($_GET['action']) {
default:
$title = 'Laboratory';
include './system/h.php';
?>
<div class='line'></div>
<div class='menu'>
<li align='center'><img src='/images/town/lab2.png' alt='*'/></li>
<li class='no_b' align='center'><font color='#90b0c0'>In the Laboratory you can improve your character</font></li>
</div>
<div class='line'></div>
<div class='list'>
<li><a href='/lab/wiz/'><img src='/images/icon/wiz.png' alt='*'/> Wizard</a></li>
<li class='no_b'><a href='/lab/premium/'><img src='/images/icon/premium.png' alt='*'/> Blessing</a></li>
</div>
<?
include './system/f.php';
break;
case 'wiz':
$title = 'Wizard';
include './system/h.php';
if($_GET['potion'] == true) {
if($user['g'] < 15) $errors[] = 'Error, you need <img src='/images/icon/g.png' alt='*'/> '.(15 - $user['g']).' gold<div class='separator'></div><a href='/trade/' class='button'>Buy</a>';
if($errors) {
echo '<div class='content' align='center'>';
foreach($errors as $error) {
echo $error.'<br/>';
}
echo '</div>
<div class='line'></div>';
}
else
{
mysql_query('UPDATE `users` SET `g` = `g` - 15,
`hp` = ''.($user['vit'] * 2).'',
`mp` = ''.$user['mana'].'' WHERE `id` = ''.$user['id'].''');
$referal = _string($_GET['referal']);
if($referal) {
header('location: '.$referal);
}
else
{
header('location: /lab/wiz/');
}
}
}
echo '
<div class='line'></div>
<div class='content' align='center'>
<img src='/images/town/wizard.png' alt='*'/>
</div>
<div class='line'></div>
<div class='content'>
<table cellpadding='0' cellspacing='0'>
<tr>
<td><img src='/images/alchemy/potion.png' alt='*'/></td>
<td valign='top' style='padding-left: 5px;'><b>Cheerfulness potion</b><br/>
<small><small>+100% to mana and health</small></small></td>
</tr></table>
<div class='separator'></div>
<div align='center'>
<a href='/lab/wiz/?potion=true' class='button'>Buy</a><br/><br/>
<font color='#909090'>Cost: <img src='/images/icon/g.png' alt='*'/> 15 gold</font>
</div>
</div>';
include './system/f.php';
break;
case 'premium':
$title = 'Blessing';
include './system/h.php';
if($_GET['buy'] == true) {
if($premium) $errors[] = 'Error, you already activated blessing';
if($user['g'] < 500) $errors[] = 'Error, you need <img src='/images/icon/g.png' alt='*'/> '.(500 - $user['g']).' gold<div class='separator'></div><a href='/trade/' class='button'>Buy</a>';
if($errors) {
echo '<div class='content' align='center'>';
foreach($errors as $error) {
echo $error.'<br/>';
}
echo '</div>
<div class='line'></div>';
}
else
{
mysql_query('UPDATE `users` SET `g` = `g` - 500 WHERE `id` = ''.$user['id'].''');
mysql_query('INSERT INTO `premium` (`user`,
`time`) VALUES ("'.$user['id'].'",
"'.(time() + (86400 * 14)).'")');
mysql_query('UPDATE `users` SET `str` = `str` + 200,
`vit` = `vit` + 200,
`agi` = `agi` + 200,
`def` = `def` + 200 WHERE `id` = ''.$user['id'].''');
header('location: /lab/premium/');
}
}
echo '
<div class='line'></div>
<div class='content' align='center'>
<img src='/images/town/prem-'.($premium ? 'on':'off').'.png' alt='*'/></li>
</div>
<div class='line'></div>
<div class='menu'>
<li align='center'><font color='#90c090'>+200</font> to all stats<br/>
<font color='#90c090'>+25%</font> to experience<br/>
Time of finding and collecting resources <font color='#90c090'>10%</font> less
</li>
<li class='no_b' align='center'> '.($premium ? 'Осталось: '._time($premium['time'] - time()):'<a href='/lab/premium/?buy=true' class='button'>Buy</a><br/><br/>
<font color='#909090'>Cost: <img src='/images/icon/g.png' alt='*'/> 500 gold</font>').'</li>
</div>';
include './system/f.php';
break;
}
?>