View file techno/files/clanlvl.php

File size: 1.85Kb
<?
defined('PROTECTOR') or die('Error: restricted access');

$req = mysql_query("SELECT * FROM `clan` where `lider`='$udata[clan]'");
$clan = mysql_fetch_array($req);
if($clan[exp]>=750000 && $clan[level]=="0"){$new_lvl='yes';}
if($clan[exp]>=2500000 && $clan[level]=="1"){$new_lvl='yes';}
if($clan[exp]>=4000000 && $clan[level]=="2"){$new_lvl='yes';}
if($clan[exp]>=6000000 && $clan[level]=="3"){$new_lvl='yes';}
if($clan[exp]>=10000000 && $clan[level]=="4"){$new_lvl='yes';}
if($clan[exp]>=15000000 && $clan[level]=="5"){$new_lvl='yes';}
if($clan[exp]>=21000000 && $clan[level]=="6"){$new_lvl='yes';}
if($clan[exp]>=28000000 && $clan[level]=="7"){$new_lvl='yes';}
if($clan[exp]>=36000000 && $clan[level]=="8"){$new_lvl='yes';}
if($clan[exp]>=45000000 && $clan[level]=="9"){$new_lvl='yes';}
if($clan[exp]>=100000000 && $clan[level]=="10"){$new_lvl='no';}

if($new_lvl==yes){$calan=$clan[level]+1;
if($clan[level]<=2 and $clan[level]>=0){$updata[money]=$clan[money]+rand(300,600);}
if($clan[level]<=4 and $clan[level]>2){$updata[money]=$clan[money]+rand(600,1200);}
if($clan[level]<=6 and $clan[level]>4){$updata[money]=$clan[money]+rand(1200,2400);}
if($clan[level]<=8 and $clan[level]>6){$updata[money]=$clan[money]+rand(2400,4800);}
if($clan[level]<=10 and $clan[level]>8){$updata[money]=$clan[money]+rand(4800,8000);}

$avtor="Гильдия";
$bon = $updata[money]-$clan[money];
$time = date("H:i d.m.y");
$text = "Ваш клан достиг $calan[level] уровня! сумма $bon монет была успешно перечислена в казну!";
 mysql_query("INSERT INTO `msg_r` SET `user_from` = '$avtor', `user_to` = '$clan[lider]', `time` = '$time', `read` = 1, `mail_msg` = '$text'");
mysql_query("UPDATE `clan` SET `level` = '$calan', `money` ='$updata[money]' WHERE `lider` = '$clan[lider]' LIMIT 1");
}
////////////////////////

?>