Файл: LinkForum/LinkUserInc/LinkUserLevelNext.php
Строк: 30
<?php
/**
* @author MyStyle
* @copyright 2013
*/
echo '<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" href="style.css?v=1" type="text/css"/>';
?>
<?php
echo '<title>Воспитание</title>
</head>
<body>';
if(!$user_id) {
}else{
$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/icons/ruby.png" alt=""/> <span>'.$level['rubies'].'</span></span></span></div>
</div>
</div>
<div>
</div>';
mysql_query("UPDATE `mystyle_user` SET `level` = '$level[level]', `ruby` = '".($user['ruby']+$level['rubies'])."', `money` = '".($user['money']+($level['level']*100))."' WHERE `id` = '$user[id]'");
$user['level']=$level['level'];
$user['money']=$user['money']+($level['level']*100);
$user['rubies']=$user['rubies']+$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'");
////////////////////////////////
////////////////////////////////
////////////////////////////////
////////////////////////////////
}
?>