Файл: accmarket.net/fraction/up_lvl.php
Строк: 41
<?php
define('_ON_CMS', 1);
require_once '../includes/start.php';
require_once '../includes/function.php';
require_once '../includes/header.php';
$fr=$_GET['f'];
$q = mysql_query("SELECT * FROM `fractions` WHERE `id`='".check(mysql_real_escape_string($fr))."'");
$f = mysql_fetch_array($q);
$fadm = mysql_result(mysql_query("SELECT COUNT(*) FROM `fractions_users` WHERE `uid`='".$use_id."' AND `fid`='".$f['id']."' AND `adm`=1;"), 0);
if($game==0 OR $level==0 OR $f['id']=='' OR $fadm==0 OR $ban!=0){
header('Location: ../index.php');
}
echo '<div class="top"><img src="../images/fr.png" alt="" /> Фракция <u>'.$f['name'].'</u> | Поднятие уровня</div>';
if($f['opyt']>=($f['lvl']*25000) AND $fadm==1){
echo '<div class="cont">Нужные ресурсы</div>';
$ok=$_GET['ok'];
$up_min=$f['lvl']*20000;
$up_gas=$f['lvl']*20000;
$up_metall=$f['lvl']*20000;
$up_water=$f['lvl']*15000;
$up_kred=$f['lvl']*25000;
$up_prov=$f['lvl']*25000;
echo '<div class="conts">
<img src="../images/min.gif" alt="" /> '.$up_min.' минералов<br/>
<img src="../images/gas.gif" alt="" /> '.$up_gas.' газа Веспен<br/>
<img src="../images/metall.gif" alt="" /> '.$up_metall.' металлов<br/>
<img src="../images/water.png" alt="" /> '.$up_water.' воды<br/>
<img src="../images/kred.png" alt="" /> '.$up_kred.' кредитов<br/>
<img src="../images/prov.png" alt="" /> '.$up_prov.' провизии<br/>';
if($ok!=1){
if($up_min<=$f['min'] AND $up_gas<=$f['gas'] AND $up_metall<=$f['metall'] AND $up_water<=$f['water'] AND $up_kred<=$f['kred'] AND $up_prov<=$f['prov']){echo '<a href="?ok=1&f='.$f['id'].'">Поднять уровень</a><br/>';}else{
echo 'Не хватает ресурсов в Хранилище ресурсов фракции!';
}
}else{
if($up_min<=$f['min'] AND $up_gas<=$f['gas'] AND $up_metall<=$f['metall'] AND $up_water<=$f['water'] AND $up_kred<=$f['kred'] AND $up_prov<=$f['prov']){
mysql_query("UPDATE `fractions` SET
`lvl`=lvl+1,
`min`=min-'".($up_min)."',
`gas`=gas-'".($up_gas)."',
`metall`=metall-'".($up_metall)."',
`water`=water-'".($up_water)."',
`kred`=kred-'".($up_kred)."',
`prov`=prov-'".($up_prov)."' WHERE `id`='".$f['id']."';");
}
header("Location: fraction.php?f=".$f['id']."");
}
echo '</div>';
}
echo '<div class="conts"><a href="fraction.php?f='.$f['id'].'"><<Назад</a></div>';
div('<a href="../">В игру</a>','conts');
require_once '../includes/footer.php';
?>