Файл: test.zfarm.mobi/styledb/mystyleuserinclude.php
Строк: 113
<?php
if(!empty($usid)){
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_msip` WHERE `user` = '".$user['id']."' AND `type` = '".num(1)."'"),0)!=0){
header("Location: ./banip.php");
exit;
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_club` WHERE `type` = '".num($user['msclub'])."'"),0)<1){}else{
$msclub = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_club` WHERE `id` = '".num($user['msclub'])."'"));
$club = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_club` WHERE `user` = '".$user['id']."' AND `id` = '".num($user['msclub'])."'"));
$clubuser = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_cuser` WHERE `user` = '".$user['id']."' AND `type` = '".num($user['msclub'])."'"));
$bigls=50;
if($msclub['level']<$bigls)
{
if($msclub['level']>1)
{
$rl=0;
$ql=mysql_query("SELECT * FROM `mystyle_clevel`");
while($pl=mysql_fetch_array($ql))
{
if($pl['level']<=$msclub['level'])$rl=$rl+$pl['rating'];
}
$krs=$msclub['rating']-$rl;
}
else $krs=$msclub['rating'];
$levels=mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_clevel` WHERE `level` = '".($msclub['level']+1)."' LIMIT 1"));
if($krs>=$levels['rating'])
{
mysql_query("UPDATE `mystyle_club` SET `level` = '".num($levels['level'])."', `ruby` = '".($msclub['ruby']+$levels['rubies'])."', `money` = '".($msclub['money']+($levels['level']*100))."' WHERE `id` = '".num($user['msclub'])."' LIMIT 1");
$msclub['level']=$levels['level'];
$msclub['money']=$msclub['money']+($levels['level']*100);
$msclub['ruby']=$msclub['ruby']+$levels['level'];
$rl=0;
$ql=mysql_query("SELECT * FROM `mystyle_clevel`");
while($pl=mysql_fetch_array($ql))
{
if($pl['level']<=$msclub['level'])$rl=$rl+$pl['rating'];
}
$krs=$msclub['rating']-$rl;
$levels=mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_clevel` WHERE `level` = '".($msclub['level']+1)."' LIMIT 1"));
}
}
mysql_query("UPDATE `mystyle_club` SET `level` = '1' WHERE `level` = '0'");
}
////////////////////////////////////////
$bigl=50;
/*Эсли в базе нету больше уровней, то переходы не выполняються, а счетчик опыта показывает ввесь, набраный за всю игру, опыт*/
if($user['level']<$bigl)
{
if($user['level']>1)
{
$rl=0;
$ql=mysql_query("SELECT * FROM `mystyle_level`");
while($pl=mysql_fetch_array($ql))
{
if($pl['level']<=$user['level'])$rl=$rl+$pl['rating'];
}
$kr=$user['rating']-$rl;
}
else $kr=$user['rating'];
$level=mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_level` WHERE `level` = '".($user['level']+1)."' LIMIT 1"));
if($kr>=$level['rating'])
{
echo '<div>
<div class="body feedbackPanel">
<div>Поздравляем, ты получил <span>'.$level['level'].'</span> уровень.</div>
<div>Награда: <span><span class="money nobr textshadow"><img width="16" height="16" src="images/zombi/cash.png" alt=""/> <span>'.$level['rubies'].'</span></span></span></div>
</div>
</div>
<div>
</div>';
mysql_query("UPDATE `mystyle_user` SET `level` = '".num($level['level'])."', `ruby` = '".($user['ruby']+$level['rubies'])."', `money` = '".($user['money']+($level['level']*100))."' WHERE `id` = '".num($user['id'])."' LIMIT 1");
$user['level']=$level['level'];
$user['money']=$user['money']+($level['level']*100);
$user['ruby']=$user['ruby']+$level['level'];
$rl=0;
$ql=mysql_query("SELECT * FROM `mystyle_level`");
while($pl=mysql_fetch_array($ql))
{
if($pl['level']<=$user['level'])$rl=$rl+$pl['rating'];
}
$kr=$user['rating']-$rl;
$level=mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_level` WHERE `level` = '".($user['level']+1)."' LIMIT 1"));
}
}
mysql_query("UPDATE `mystyle_user` SET `level` = '1' WHERE `level` = '0'");
}
mysql_query("UPDATE `mystyle_user` SET `mozgi_time` = NULL WHERE `mozgi_time` < '".num($time)."' AND `id` = '".num($user['id'])."' LIMIT 1");
mysql_query("DELETE FROM `mystyle_msbury` WHERE `time` < '".num($time)."' LIMIT 1");
$collections_exp = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_collections_exp` WHERE `user` = '".num($user['id'])."' LIMIT 1"));
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_farm` WHERE `user` = '".num($user['id'])."'"),0)<4){
mysql_query("INSERT INTO `mystyle_farm` SET `user` = '".num($user['id'])."'");
mysql_query("INSERT INTO `mystyle_farm` SET `user` = '".num($user['id'])."'");
mysql_query("INSERT INTO `mystyle_farm` SET `user` = '".num($user['id'])."'");
mysql_query("INSERT INTO `mystyle_farm` SET `user` = '".num($user['id'])."'");
}
mysql_query("update mystyle_user set date_last = $time where id = $user[id] limit 1");
$timeactiv=$time-$user['date_last'];
if($timeactiv < 120)
{
$newtimeactiv=$user['time']+$timeactiv;
mysql_query("update mystyle_user set time = $newtimeactiv where id = $user[id] limit 1");
}
if($user['day_bonys'] < time() && $user['level'] >= 5){
$ruby = $user['ruby']+15;
$time_bonys = $time+86400;
mysql_query("update mystyle_user set ruby = $ruby, day_bonys = $time_bonys where id = $user[id] limit 1");
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_amimals_user` WHERE `user` = '".num($user['id'])."'"),0)<4 && $user['level']>=7)
{
mysql_query("INSERT INTO `mystyle_amimals_user` SET `user` = '".num($user['id'])."'");
mysql_query("INSERT INTO `mystyle_amimals_user` SET `user` = '".num($user['id'])."'");
mysql_query("INSERT INTO `mystyle_amimals_user` SET `user` = '".num($user['id'])."'");
mysql_query("INSERT INTO `mystyle_amimals_user` SET `user` = '".num($user['id'])."'");
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_mscrypt` WHERE `user` = '".num($user['id'])."'"),0)<9 && $user['level']>=25)
{
mysql_query("INSERT INTO `mystyle_mscrypt` SET `user` = '".num($user['id'])."'");
mysql_query("INSERT INTO `mystyle_mscrypt` SET `user` = '".num($user['id'])."'");
mysql_query("INSERT INTO `mystyle_mscrypt` SET `user` = '".num($user['id'])."'");
mysql_query("INSERT INTO `mystyle_mscrypt` SET `user` = '".num($user['id'])."'");
mysql_query("INSERT INTO `mystyle_mscrypt` SET `user` = '".num($user['id'])."'");
mysql_query("INSERT INTO `mystyle_mscrypt` SET `user` = '".num($user['id'])."'");
mysql_query("INSERT INTO `mystyle_mscrypt` SET `user` = '".num($user['id'])."'");
mysql_query("INSERT INTO `mystyle_mscrypt` SET `user` = '".num($user['id'])."'");
mysql_query("INSERT INTO `mystyle_mscrypt` SET `user` = '".num($user['id'])."'");
}
$browser = $_SERVER['HTTP_USER_AGENT'];
mysql_query("UPDATE `mystyle_user` SET `useragent` = '".$browser."' WHERE `id` = '".$user['id']."'");
$userip = $_SERVER["HTTP_X_REAL_IP"];
mysql_query("UPDATE `mystyle_user` SET `userip` = '".$userip."' WHERE `id` = '".$user['id']."'");
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_msip` WHERE `user` = '".num($user['id'])."'"),0)<1)
{
mysql_query("INSERT INTO `mystyle_msip` SET `user` = '".num($user['id'])."', `ip` = '".$userip."'");
}
if(isset($_GET['get_prize']))
{
if(isset($_GET['gen_code']) && $_SESSION['prize']==$_GET['gen_code'] && isset($_SESSION['prize']))
{
$lopp = $user['lopaty']+1;
mysql_query("UPDATE `mystyle_user` SET `lopaty` = '".$lopp."' WHERE `id` = '".$user['id']."' LIMIT 1");
$text = 'Вы поймали 1 лопату';
$_SESSION['msg'] = $text;
unset($_SESSION['prize']);
header("Location: ./");
exit;
}
else
{
$text = 'Не успели...';
$_SESSION['msg'] = $text;
header("Location: ./");
exit;
}
}
$rand=rand(1,500);
if($rand==55 || $rand==72 || $rand==78)
{
$_SESSION['prize']=md5($rand);
echo '<div class="feedback"><center> <a class="btnp" href="./?get_prize=1&gen_code='.md5($rand).'">Лови лопату</a> </center></div>';
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_ban` WHERE `id_user` = '".num($user['id'])."' AND `izg` = '".num(1)."' LIMIT 1"),0)!=0 && (!isset($_GET['user']) || isset($_GET['user']) && $_GET['user']!=$user['id'])){
header("Location: ?profile=$user[id]&bans");
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_ban` WHERE `id_user` = '".num($user['id'])."' AND `time` > '".num($time)."' AND `izg` = '".num(0)."' LIMIT 1"),0)!=0)$molchi=1;
$ban=mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_ban` WHERE `id_user` = '".num($user['id'])."' AND `time` > '".num($time)."' AND `izg` = '".num(0)."' ORDER BY `id` DESC LIMIT 1"));
if(isset($_GET['closeduserfaq']) && $user['guest'] == 1){
mysql_query("update mystyle_user set guest = null where id = $user[id] limit 1");
unset($_SESSION['training']);
}
?>