Размер файла: 3.73Kb
<?php
require_once '../core/system.php';
$req = mysql_query("SELECT ban from `ban` where `id_us` = '".$user['id']."' and `time` > '".$_SERVER['REQUEST_TIME']."'");
$ban = mysql_fetch_array($req);
if($ban['ban'] == 3){
header('Location: /moduls/ban');
}
if(!isset($user['id'])) header('Location: /');
$umen = mysql_fetch_array(mysql_query("SELECT * FROM `umen` WHERE `id` = '".intval($_GET['id'])."' and `usr`='".$user['id']."' "));
$header = $umen['name'];
require_once H.'core/head.php';
$d = $umen['lvl'] + 1;
if($umen['lvl'] == 1){
$st = 20;
$next = 1.20;
$next2 = 0.65;
$next3 = 0.10;
$t = 36;
$t2 = 10;
$t3 = 42;
}
if($umen['lvl'] == 2){
$st = 70;
$next = 1.30;
$next2 = 0.80;
$next3 = 0.15;
$t = 34;
$t2 = 10;
$t3 = 39;
}
if($umen['lvl'] == 3){
$st = 180;
$next = 1.50;
$next2 = 1;
$next3 = 0.20;
$t = 32;
$t2 = 10;
$t3 = 37;
}
if($umen['lvl'] == 4){
$st = 400;
$next = 1.70;
$next2 = 1.10;
$next3 = 0.25;
$t = 30;
$t2 = 9;
$t3 = 35;
}
if($umen['lvl'] == 5){
$st = 780;
$next = 1.90;
$next2 = 1.25;
$next3 = 0.30;
$t = 28;
$t2 = 9;
$t3 = 33;
}
if($umen['lvl'] == 6){
$st = 1900;
$next = 2.10;
$next2 = 1.40;
$next3 = 0.35;
$t = 26;
$t2 = 9;
$t3 = 31;
}
if($umen['lvl'] == 7){
$st = 4000;
$next = 2.30;
$next2 = 1.60;
$next3 = 0.40;
$t = 24;
$t2 = 8;
$t3 = 29;
}
if($umen['lvl'] == 8){
$st = 7000;
$next = 2.50;
$next2 = 1.80;
$next3 = 0.45;
$t = 22;
$t2 = 8;
$t3 = 27;
}
if($umen['lvl'] == 9){
$st = 10000;
$next = 2.70;
$next2 = 2;
$next3 = 0.50;
$t = 20;
$t2 = 8;
$t3 = 25;
}
if($umen['lvl'] == 10){
$st = 15000;
$next = 2.90;
$next2 = 2.20;
$next3 = 0.55;
$t = 18;
$t2 = 7;
$t3 = 23;
}
if($umen['lvl'] == 11){
$st = 20000;
$next = 3.10;
$next2 = 2.40;
$next3 = 0.60;
$t = 16;
$t2 = 6;
$t3 = 21;
}
if($umen['lvl'] == 12){}
//$st=floor($st*0.70);
$goldd = $st*100;
if($umen['lvl'] < 12){
if($user['gold'] < $goldd){
header("Location: /user/umen?id=".$umen['id']."");
$_SESSION['err'] = 'Недостаточно золота';
exit;
}
if($umen['usr'] != $user['id']){
header("Location: /");
$_SESSION['err'] = 'Ошибка!';
exit;
}
$gold = $user['gold'] - $goldd;
mysql_query("INSERT INTO `logi` set `user_id` = '".$user['id']."', `text` = 'Умение', `time` = '".$time."', `kol`='".$goldd."', `kto`='-'");
if($umen['img']=='whack'){
$req = mysql_query("SELECT * FROM `bonus` WHERE `time`>'".time()."' and `typ`='4' and `usr`='".$user['id']."' and `param`='whack'");
$bon = mysql_fetch_array($req);
$avto = mysql_num_rows($req);
if($avto > 0){
$tj = $t-$bon['kol'];
} else {
$tj = $t;
}
mysql_query("UPDATE `umen` SET `lvl` = '".$d."', `sila`='".$next."',`time`='".$tj."' WHERE `id`='".intval($_GET['id'])."'");}
if($umen['img']=='healing'){
mysql_query("UPDATE `umen` SET `lvl` = '".$d."', `sila`='".$next2."',`time`='".$t2."' WHERE `id`='".intval($_GET['id'])."'");
}
if($umen['img']=='gift_of_the_Gods'){
$reqy = mysql_query("SELECT * FROM `bonus` WHERE `time`>'".time()."' and `typ`='4' and `usr`='".$user['id']."' and `param`='gift_of_the_Gods'");
$bony = mysql_fetch_array($reqy);
$avton = mysql_num_rows($reqy);
if($avton > 0){
$ts = $t3 - $bony['kol'];
} else {
$ts = $t3;
}
mysql_query("UPDATE `umen` SET `lvl` = '".$d."', `sila`='".$next3."',`time`='".$ts."' WHERE `id`='".intval($_GET['id'])."'");
}
mysql_query("UPDATE `user` SET `gold` = '".$gold."' WHERE `id` = '".$user['id']."'");
header("Location: /user/umen?id=".$umen['id']."");
$_SESSION['message'] = "Умение повышено до ".$d." уровня";
} else {
header("Location: /user/umen?id=".$umen['id']."");
$_SESSION['err'] = "<font color=94ED18>Ошибка</font>";
}
require_once H.'core/foot.php';
?>