Файл: public_html/system/user.php
Строк: 89
<?
$id = _string(_num($_COOKIE['id']));
$password = _string($_COOKIE['password']);
if($id && $password) {
$q = mysql_query('SELECT * FROM `users` WHERE `id` = "'.$id.'" AND `password` = "'.$password.'"');
$user = mysql_fetch_array($q);
if(!$user) {
setCookie('id', '');
setCookie('password', '');
}
if($user['id']!='1103'){
mysql_query('UPDATE `users` SET `online` = "'.time().'",
`self` = "'.$_SERVER['PHP_SELF'].'" WHERE `id` = "'.$user['id'].'"');
mysql_query('UPDATE `users` SET `ua` = "'.$_SERVER['HTTP_USER_AGENT'].'",
`ip` = "'.$_SERVER['REMOTE_ADDR'].'" WHERE `id` = "'.$user['id'].'"');
}
$_time = 2;
if($user['last_update'] < (time() - $_time)){
mysql_query('UPDATE `users` SET `last_update` = "'.time().'" WHERE `id` = "'.$user['id'].'"');
}
if((time() - $user['last_update']) > $_time) {
mysql_query('UPDATE `users` SET `last_update` = "'.time().'" WHERE `id` = "'.$user['id'].'"');
if($user['self'] != '/coliseum.php') {
$hp = $user['vit'] * 2;
if($user['hp'] < $hp) {
$_hp = (((time() - $user['last_update']) / $_time) - 1 );
if($_hp > $hp) {
$_hp = $hp - $user['hp'];
}
mysql_query('UPDATE `users` SET `hp` = "'.($user['hp'] + $_hp ).'" WHERE `id` = "'.$user['id'].'"');
}
if($user['mp'] < $user['mana']) {
$_mp = (((time() - $user['last_update']) / $_time) - 1 );
if($_mp > $user['mana']) {
$_mp = $user['mana'] - $user['mp'];
}
mysql_query('UPDATE `users` SET `mp` = "'.($user['mp'] +$_mp ).'" WHERE `id` = "'.$user['id'].'"');
}
}
}
if($user['essence'] > 0) {
$ess = $user['essence'] * 3;
$user['str'] += $ess;
$user['vit'] += $ess;
$user['agi'] += $ess;
$user['def'] += $ess;
}
/*
if($i['essence'] > 0) {
$ess = $i['essence'] * 3;
$i['str'] += $ess;
$i['vit'] += $ess;
$i['agi'] += $ess;
$i['def'] += $ess;
}
*/
if($user['last_update'] - $user['duel_last_update'] > (60 * 30)) {
mysql_query('UPDATE `users` SET `duel_last_update` = "'.($user['duel_last_update'] + (60 * 30)).'",
`duel_fights` = "'.($user['duel_fights'] + (($user['duel_fights'] < 11) ? 1:0)).'",
`duel_changes` = "'.($user['duel_changes'] + (($user['duel_changes'] < 11) ? 1:0)).'" WHERE `id` = "'.$user['id'].'"');
}
/*
if($user['hp'] > $user['vit'] * 2) {
mysql_query('UPDATE `users` SET `hp` = "'.($user['vit'] * 2).'" WHERE `id` = "'.$user['id'].'"');
}
*/
if($user['hp'] < 0) {
mysql_query('UPDATE `users` SET `hp` = "0" WHERE `id` = "'.$user['id'].'"');
}
if($user['mp'] > $user['mana']) {
mysql_query('UPDATE `users` SET `mp` = "'.$user['mana'].'" WHERE `id` = "'.$user['id'].'"');
}
if($user['mp'] < 0) {
mysql_query('UPDATE `users` SET `mp` = "0" WHERE `id` = "'.$user['id'].'"');
}
$clan_memb = mysql_query('SELECT * FROM `clan_memb` WHERE `user` = "'.$user['id'].'"');
$clan_memb = mysql_fetch_array($clan_memb);
function clan_buff($i) {
switch($i) {
case 0:
$buff = 4;
break;
case 1:
$buff = 4;
break;
case 2:
$buff = 8;
break;
case 3:
$buff = 12;
break;
case 4:
$buff = 24;
break;
case 5:
$buff = 28;
break;
case 6:
$buff = 32;
break;
case 7:
$buff = 36;
break;
case 8:
$buff = 48;
break;
case 9:
$buff = 52;
break;
case 10:
$buff = 56;
break;
case 11:
$buff = 60;
break;
case 12:
$buff = 72;
break;
case 13:
$buff = 76;
break;
case 14:
$buff = 80;
break;
case 15:
$buff = 84;
break;
case 16:
$buff = 96;
break;
case 17:
$buff = 100;
break;
case 18:
$buff = 104;
break;
case 19:
$buff = 108;
break;
case 20:
$buff = 120;
break;
case 21:
$buff = 124;
break;
case 22:
$buff = 128;
break;
case 23:
$buff = 132;
break;
case 24:
$buff = 144;
break;
case 25:
$buff = 148;
break;
case 26:
$buff = 152;
break;
case 27:
$buff = 156;
break;
case 28:
$buff = 168;
break;
case 29:
$buff = 172;
break;
case 30:
$buff = 176;
break;
case 31:
$buff = 180;
break;
case 32:
$buff = 192;
break;
case 33:
$buff = 196;
break;
case 34:
$buff = 200;
break;
case 35:
$buff = 204;
break;
case 36:
$buff = 208;
break;
case 37:
$buff = 212;
break;
case 38:
$buff = 216;
break;
case 40:
$buff = 220;
break;
case 41:
$buff = 224;
break;
case 42:
$buff = 228;
break;
case 43:
$buff = 232;
break;
case 44:
$buff = 236;
break;
case 45:
$buff = 240;
break;
case 46:
$buff = 244;
break;
case 47:
$buff = 248;
break;
case 48:
$buff = 252;
break;
case 49:
$buff = 260;
break;
case 50:
$buff = 270;
break;
case 51:
$buff = 280;
break;
case 52:
$buff = 290;
break;
case 53:
$buff = 300;
break;
case 54:
$buff = 400;
break;
case 55:
$buff = 500;
break;
case 56:
$buff = 600;
break;
case 57:
$buff = 700;
break;
case 58:
$buff = 800;
break;
case 59:
$buff = 900;
break;
case 60:
$buff = 1000;
break;
case 61:
$buff = 2000;
break;
case 61:
$buff = 2500;
break;
case 62:
$buff = 3000;
break;
case 63:
$buff = 3500;
break;
case 64:
$buff = 4000;
break;
case 65:
$buff = 4500;
break;
case 66:
$buff = 5000;
break;
case 67:
$buff = 5500;
break;
case 68:
$buff = 6000;
break;
case 69:
$buff = 6500;
break;
case 70:
$buff = 7000;
break;
case 25:
$buff = 200;
break;
}
return $buff;
}
if($clan_memb) {
$clan = mysql_fetch_array(mysql_query('SELECT * FROM `clans` WHERE `id` = "'.$clan_memb['clan'].'"'));
if($clan_memb['last_update'] <= time()) {
mysql_query('UPDATE `clan_memb` SET `last_update` = "'.($clan_memb['last_update'] + ((60 * 60) * 24 )).'",
`v` = `v` + 3 WHERE `id` = "'.$clan_memb['id'].'"');
}
$clan_buff = clan_buff($clan['built_1']);
if($clan['built_1'] > 0 && $clan_buff) {
$user['str'] += $clan_buff;
$user['vit'] += $clan_buff;
$user['agi'] += $clan_buff;
$user['def'] += $clan_buff;
}
}
if($clan['altar1']==1)
{
$user['str'] += 3000;
}
if($clan['altar2']==1)
{
$user['vit'] += 3000;
}
if($clan['altar3']==1)
{
$user['agi'] += 3000;
}
if($clan['altar4']==1)
{
$user['def'] += 3000;
}
if($clan['altar1']==1)
{
$i['str'] += 3000;
}
if($clan['altar2']==1)
{
$i['vit'] += 3000;
}
if($clan['altar3']==1)
{
$i['agi'] += 3000;
}
if($clan['altar4']==1)
{
$i['def'] += 3000;
}
$ban = mysql_fetch_array(mysql_query('SELECT * FROM `ban` WHERE `user` = "'.$user['id'].'"'));
if($ban) {
if($ban['time'] <=time()) {
mysql_query('DELETE FROM `ban` WHERE `user` = "'.$user['id'].'"');
}
if($ban['time'] > time() && $_SERVER['PHP_SELF'] != '/ban.php') {
header('location: /ban.php');
exit;
}
}
$elikstr= mysql_fetch_array(mysql_query('SELECT * FROM `elikstr` WHERE `user` = "'.$user['id'].'"'));
if($elikstr) {
if($elikstr['time'] <= time()) {
mysql_query('UPDATE `users` SET `str` = `str` - 200 WHERE `id` = ''.$user['id'].''');
mysql_query('DELETE FROM `elikstr` WHERE `user` = ''.$user['id'].''');
}
}
$elikdef= mysql_fetch_array(mysql_query('SELECT * FROM `elikdef` WHERE `user` = "'.$user['id'].'"'));
if($elikdef) {
if($elikdef['time'] <= time()) {
mysql_query('UPDATE `users` SET `def` = `def` - 200 WHERE `id` = ''.$user['id'].''');
mysql_query('DELETE FROM `elikdef` WHERE `user` = ''.$user['id'].''');
}
}
$elikvit= mysql_fetch_array(mysql_query('SELECT * FROM `elikvit` WHERE `user` = "'.$user['id'].'"'));
if($elikvit) {
if($elikvit['time'] <= time()) {
mysql_query('UPDATE `users` SET `vit` = `vit` - 200 WHERE `id` = ''.$user['id'].''');
mysql_query('DELETE FROM `elikvit` WHERE `user` = ''.$user['id'].''');
}
}
$elikagi= mysql_fetch_array(mysql_query('SELECT * FROM `elikagi` WHERE `user` = "'.$user['id'].'"'));
if($elikagi) {
if($elikagi['time'] <= time()) {
mysql_query('UPDATE `users` SET `agi` = `agi` - 200 WHERE `id` = ''.$user['id'].''');
mysql_query('DELETE FROM `elikagi` WHERE `user` = ''.$user['id'].''');
}
}
$premium = mysql_fetch_array(mysql_query('SELECT * FROM `premium` WHERE `user` = "'.$user['id'].'"'));
if($premium) {
if($premium['time'] <= time()) {
mysql_query('UPDATE `users` SET `str` = `str` - 500,
`vit` = `vit` - 500,
`agi` = `agi` - 500,
`def` = `def` - 500 WHERE `id` = ''.$user['id'].''');
mysql_query('DELETE FROM `premium` WHERE `user` = ''.$user['id'].''');
}
}
}
/**
Трофеи
**/
$names = array (0,'Трофей бойца','Трофей воина','Трофей избранного','Трофей идущего к славе','Трофей несокрушимогo',
'Трофей силы','Трофей могущества','Трофей титана','Трофей полубога');
$quests = array (0,10,20,35,50,220,500,1500,2300,3500);
$undying_kills = array (0,50,200,350,500,2200,5000,7500,8300,1000);
$skill = array (0,10,24,35,50,100,185,190,200,230);
if (isset($user))
{
$qquj = mysql_query("SELECT * FROM `chest` WHERE `user`='".$user['id']."'");
$q1234556= mysql_fetch_array($qquj);
if ( !$q1234556)
{
mysql_query("INSERT INTO `chest`
SET `user`='".$user['id']."' ")or die (mysql_error());
}
for ($i =1;$i<10;$i++)
{
if ($user['troph'.$i] == 0)
{
if ($user['undying']>= $undying_kills[$i] && $user['quests']>=$quests[$i] && $user['skill']>=$skill[$i] && $user['troph'.$i] == 0)
{
mysql_query("UPDATE `users` SET `troph$i` = '1' WHERE `id`='".$user['id']."' ")or die (mysql_error());
echo"<div class ='block'/>
<center>
<img src='/images/medals/50x50/<?=$i;?>.png'/><br/>
<?=$names[$i];?>
<br/>
Трофей получен!
</center>
</div>";
}
}
}
$stats = array (0,'str','vit','agi','def');
$costs = 1000;
$value = 'g';
$namesT = array (0,"Эликсир силы","Эликсир выносливости","Эликсир ловкости",
"Эликсир защиты");
$params = 1000;
$suffix = array (0,"к силе","к жизням","к удаче","к броне");
}
$clan_rud = mysql_fetch_array(mysql_query('SELECT * FROM `clan_rud` WHERE `clan` = "'.$clan['id'].'"'));
if($clan_rud) {
if($clan_rud['time'] < time()) {
mysql_query('UPDATE `clan_rud` SET `g` = "0",`time` = "'.(time()+(20*3600)).'" WHERE `clan` = "'.$clan['id'].'"');
}}
$stone = mysql_fetch_array(mysql_query('SELECT * FROM `stone` WHERE `user` = "'.$user['id'].'"'));
if($stone) {
if($stone['time'] < time()) {
mysql_query('UPDATE `users` SET `str` = `str` - 250,
`vit` = `vit` - 250,
`agi` = `agi` - 250,
`def` = `def` - 250 WHERE `id` = ''.$user['id'].''');
mysql_query('DELETE FROM `stone` WHERE `user` = ''.$user['id'].''');
}
}
///22.06.2017 05:34 четверг
/*
*
buff / author: XxxDIABLOxxX
*
*/
$_belt = mysql_fetch_array(mysql_query("SELECT * FROM `belt` WHERE `user` = ".$user['id'].""));
$__belt_param = array(1 => 'str', 2 => 'vit', 3 => 'agi', 4 => 'def');
for($i = 1; $i <= 4; $i++) {
if($_belt['belt_'.$i.''] > time()) $user[$__belt_param[$i]] += $user['skill'];
if($_belt['belt_'.$i.''] < time()) {
mysql_query("UPDATE `belt` SET `belt_".$i."` = '0' WHERE `user` = ".$user['id']."");
}
}
//semdan
// 27.07.2017 четверг 01.47
$OK = mysql_query("SELECT * FROM `ork` WHERE `id` = 1");
while($m= mysql_fetch_assoc($OK)){
if(date(H) == 18){
if(date(i) == 0) {
if($m[1]==0) {
mysql_query("UPDATE `ork` SET `1` = 1");
mysql_query("UPDATE `users` SET `ork_u` = 0");
}
}
}
}
$TABLEorkNAGRaDa = mysql_fetch_assoc(mysql_query("SELECT * FROM `ork` WHERE `id` = 1"));
if($TABLEorkNAGRaDa[1]==1) {
if(date('H') == 18) {
if(date('i') == 30) {
//время окончания битвы//
mysql_query("UPDATE `ork` SET `1` = 0,`2` = 1,`pe` = 0");
mysql_query("UPDATE `users` SET `ork_z` = 0");
header('location:?');
}
}
}