Файл: user/rating/translate.php
Строк: 190
<?
/*
** author tproger & deelfy.ru
** vk.com/nikolayev_aidar
*/
include_once '../../sys/inc/start.php';
include_once '../../sys/inc/compress.php';
include_once '../../sys/inc/sess.php';
include_once '../../sys/inc/home.php';
include_once '../../sys/inc/settings.php';
include_once '../../sys/inc/db_connect.php';
include_once '../../sys/inc/ipua.php';
include_once '../../sys/inc/fnc.php';
include_once '../../sys/inc/user.php';
only_reg();
if (isset($user))$ank['id'] = intval($_GET['id']);
$ank=get_user($ank['id']);
if(!$ank || $user['id'] == $ank['id']){header("Location: /index.php?".SID);exit;}
if (isset($_GET['act']) && $_POST['rating'])
{
$rating=abs(intval($_POST['rating']));
if ($user['rating'] < $rating)$err = 'У вас не достаточно рейтинга для перевода';
if (!$err)
{
mysql_query("UPDATE `user` SET `rating` = '" . ($ank['rating'] + $rating) . "' WHERE `id` ='$ank[id]';");
mysql_query("UPDATE `user` SET `rating` = '" . ($user['rating'] - $rating) . "' WHERE `id` ='$user[id]';");
$msg = "Пользователь [b]".$user['nick']."[/b] перевeл вам рейтинг в колличестве [b] $rating [/b] % [br]НЕ ЗАБУДЬТЕ СКАЗАТЬ СПАСИБО!";
mysql_query("INSERT INTO `mail` (`id_user`, `id_kont`, `msg`, `time`) values('0', '$ank[id]', '$msg', '$time')");
$_SESSION['message'] = 'Перевод успешно выполнен';
header("Location: /info.php?id=$ank[id]");
exit;
}
}
$set['title']='Перевод рейтинга'; // заголовок страницы
include_once '../../sys/inc/thead.php';
title();
aut();
err();
echo "<div class='foot'>n";
echo "<img src='/style/icons/str2.gif' alt='*'> <a href='/info.php?id=$ank[id]'>$ank[nick]</a> | Перевод<br />n";
echo "</div>n";
if (isset($user) & $user['rating']<=2)
{
echo '<div class="mess">';
echo "<b>Извини ".$user['nick']." ,</b> n";
echo "но чтобы переводить рейтинг другим обитателям необходимо иметь более <b>2</b> % рейтинга <br/>
На данный момент ваш рейтинг состовляет <b>$user[rating] </b>% n";
echo '</div>';
}
else
{
echo '<div class="mess">';
echo "Ваш рейтинг: <br />";
if ($user['rating']>=0 && $user['rating']<= 100){
echo "<div style='background-color: #73a8c7; width: 200px; height: 17px;'>
<div style=' background-color: #064a91; height:17px; width:$user[rating]%;'></div>
<span style='position:relative; top:-17px; left:45%; right:57%; color:#ffffff;'>$user[rating]%</span>
</div>";
}elseif ($user['rating']>=100 && $user['rating']<= 200){
$rat=$user['rating']-100;
echo "<div style='background-color: #73a8c7; width: 200px; height: 17px;'>
<div style=' background-color: #064a91; height:17px; width:$rat%;'></div>
<span style='position:relative; top:-17px; left:45%; right:57%; color:#ffffff;'>$user[rating]%</span>
</div>";
}elseif ($user['rating']>=200 && $user['rating']<= 300){
$rat=$user['rating']-200;
echo "<div style='background-color: #73a8c7; width: 200px; height: 17px;'>
<div style=' background-color: #064a91; height:17px; width:$rat%;'></div>
<span style='position:relative; top:-17px; left:45%; right:57%; color:#ffffff;'>$user[rating]%</span>
</div>";
}elseif ($user['rating']>=300 && $user['rating']<= 400){
$rat=$user['rating']-300;
echo "<div style='background-color: #73a8c7; width: 200px; height: 17px;'>
<div style=' background-color: #064a91; height:17px; width:$rat%;'></div>
<span style='position:relative; top:-17px; left:45%; right:57%; color:#ffffff;'>$user[rating]%</span>
</div>";
}elseif ($user['rating']>=400 && $user['rating']<= 500){
$rat=$user['rating']-400;
echo "<div style='background-color: #73a8c7; width: 200px; height: 17px;'>
<div style=' background-color: #064a91; height:17px; width:$rat%;'></div>
<span style='position:relative; top:-17px; left:45%; right:57%; color:#ffffff;'>$user[rating]%</span>
</div>";
}elseif ($user['rating']>=500 && $user['rating']<= 600){
$rat=$user['rating']-500;
echo "<div style='background-color: #73a8c7; width: 200px; height: 17px;'>
<div style=' background-color: #064a91; height:17px; width:$rat%;'></div>
<span style='position:relative; top:-17px; left:45%; right:57%; color:#ffffff;'>$user[rating]%</span>
</div>";
}elseif ($user['rating']>=600 && $user['rating']<= 700){
$rat=$user['rating']-600;
echo "<div style='background-color: #73a8c7; width: 200px; height: 17px;'>
<div style=' background-color: #064a91; height:17px; width:$rat%;'></div>
<span style='position:relative; top:-17px; left:45%; right:57%; color:#ffffff;'>$user[rating]%</span>
</div>";
}elseif ($user['rating']>=700 && $user['rating']<= 800){
$rat=$user['rating']-700;
echo "<div style='background-color: #73a8c7; width: 200px; height: 17px;'>
<div style=' background-color: #064a91; height:17px; width:$rat%;'></div>
<span style='position:relative; top:-17px; left:45%; right:57%; color:#ffffff;'>$user[rating]%</span>
</div>";
}elseif ($user['rating']>=800 && $user['rating']<= 900){
$rat=$user['rating']-800;
echo "<div style='background-color: #73a8c7; width: 200px; height: 17px;'>
<div style=' background-color: #064a91; height:17px; width:$rat%;'></div>
<span style='position:relative; top:-17px; left:45%; right:57%; color:#ffffff;'>$user[rating]%</span>
</div>";
}elseif ($user['rating']>=900 && $user['rating']<= 1000){
$rat=$user['rating']-900;
echo "<div style='background-color: #73a8c7; width: 200px; height: 17px;'>
<div style=' background-color: #064a91; height:17px; width:$rat%;'></div>
<span style='position:relative; top:-17px; left:45%; right:57%; color:#ffffff;'>$user[rating]%</span>
</div>";
}
echo '</div>';
echo "<form class='main' action="?id=$ank[id]&act" method="post">";
echo "Количество % для перевода рейтинга:<br />n";
echo "<input type='text' name='rating' value='1' /><br />n";
echo "<input class='submit' type='submit' value='Перевести' /><br />n";
echo "</form>";
}
echo "<div class='foot'>n";
echo "<img src='/style/icons/str2.gif' alt='*'> <a href='/info.php?id=$ank[id]'>$ank[nick]</a> | Перевод<br />n";
echo "</div>n";
include_once '../../sys/inc/tfoot.php';
?>