Вход Регистрация
Файл: rating.php
Строк: 93
<?
include 'connect.php';
if(!
$u['id']){ 
header ("Location: registration.php?err=1"); 
exit; 
}
switch(
$_GET['act'])
{
case 
'history':
if(
$u['admin'] == || $u['admin'] == 2){
include 
'head.php';
echo 
'<div class="title"><img src= "ico/rating.png"><a href = "rating.php?act=history"> История рейтинга</a>  <b>Просмотр</b></div>';
$count mysql_result(mysql_query("SELECT COUNT(`id`) FROM `rating_history`"), 0);
if(
$count 0){
   
$total intval(($count 1) / 10) + 1;
   
$page intval($_GET['page']);
   if(empty(
$page) or $page 0$page 1
   if(
$page $total$page $total;
   
$start $page 10 10;
   
$result mysql_query("SELECT * FROM `rating_history` ORDER BY `time` DESC LIMIT $start, 10");
   while(
$history mysql_fetch_assoc($result)){
   echo 
$i '<div class="div">' '<div class="div">';
      
$user1 mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '".$history["user"]."'"));
      
$user2 mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '".$history["outuser"]."'"));
      
$message checkout($wall['message']);      
      if(
ban($user['id'])){
      echo 
'<a href = "/'.$user1['id'].'"> <del>'.$user1['login'].'</del></a> повысил рейтинг';
      if(
$user1['id'] == $user2['id']) echo ' себе';
      else echo 
' <a href = "/'.$user2['id'].'"> <del>'.$user2['login'].'</del></a>';
      echo 
' на '.$history['rating'].' за '.$history['money'].' монет.';
      } else {
      echo 
'<a href = "/'.$user1['id'].'"> '.$user1['login'].'</a> повысил рейтинг';
      if(
$user1['id'] == $user2['id']) echo ' себе';
      else echo 
' <a href = "/'.$user2['id'].'"> '.$user2['login'].'</a>';
      echo 
' на '.$history['rating'].' за '.$history['money'].' монет.';
      }
               echo 
'</div>';
     
$i++;
   }
   echo 
'</div>';
   
navigation($page$total,'?act=history&');
} else {
   echo 
'<img src="ico/error.gif" alt="Ошибка" /> История рейтинга пуста!</div>';
}
echo 
'</div>';
include 
'foot.php';
} else {
include 
'head.php';
echo 
'<div class="title">';
echo 
'<img src= "ico/rating.png"><a href = "rating.php?act=history"> История рейтинга</a>  <b>Ошибка</b>';
echo 
'</div>';
echo 
'<div class="txt">';
echo 
'<img src="ico/error.gif" alt="Ошибка" /> Ошибка, вам сюда нельзя!</div>';
echo 
'</div>';
include 
'foot.php';
}
break;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Дефаулт~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
default:
if(isset(
$_GET['id'])){
   
$id=num($_GET['id']);
   
$req mysql_query("SELECT * FROM `users` WHERE `id` = '$id' LIMIT 1");
   if (
mysql_num_rows($req)) $user mysql_fetch_assoc($req);
}
if(empty(
$user)){
   
$req mysql_query("SELECT * FROM `users` WHERE `id` = '".$u['id']."' LIMIT 1");
   
$user mysql_fetch_assoc($req);
}
if(
ban($user['id'])){
include 
'head.php';
echo 
'<div class = "div"><table><tr><td VALIGN=center><img src = "ico/close.png"></td><td VALIGN=center>
Пользователь заблокирован!
</table>
</div>'
;
include 
'foot.php';
exit;
}   
include 
'head.php';
echo 
'<div class="title"><img src= "ico/rating.png"> Покупка рейтинга</div>';
if(
$u['admin'] == || $u['admin'] == 2){
echo 
'<div class="nav"><a href = "?act=history">История</a></div>';

}
if (isset(
$_POST['submit'])) {
   if(isset(
$_POST['rating']) && $_POST['rating']>0) {
      
$rating num($_POST['rating']);
      
$money $rating*1000;
      if(
$money <= $u['money']){
         
$user['rating'] = $user['rating']+$rating;
         
mysql_query("UPDATE `users` SET `rating` = '".$user['rating']."' WHERE `id` = '".$user['id']."'");
         
mysql_query("UPDATE `users` SET `money` = '".($u['money']-$money)."' WHERE `id` = '".$u['id']."'");
         
mysql_query("INSERT INTO `rating_history` SET
         `user` = '"
.$u['id']."',
         `outuser` = '"
.$user['id']."',
         `time` = '"
.time()."',
         `rating` = '"
.$rating."',
         `money` = '"
.$money."'
         "
);
         if(
$u['id'] != $user['id']){
            if(
$u['sex'] == 'm'){
               
$action[0] = 'Повысил';
            } else {
               
$action[0] = 'Повысила';
            }
            
$text $action[0].' Ваш рейтинг на <b>'.$rating.'</b>.';
            
mysql_query("INSERT INTO `jurnal` SET
            `user` = '"
.$user['id']."',
            `outuser` = '"
.$u['id']."',
            `text` = '
$text',
            `time` = '"
.time()."',
            `new` = '1'
            "
);
             }
         
ok('Рейтинг успешно повышен!');
      } else {
         
error('У Вас недостаточно монет!');
      }
   } else {
      
error('Введите количество рейтинга!');
   }
}
    echo 
'<div class="div">- Повышение рейтинга пользователю:';
echo 
''.ico($user['sex'],$user['admin']).' <a href = "/page.php?id='.$user['id'].'">'.$user['login'].'</a> '.online($user['online']).'';
    echo 
'</div><div class="div">- У вас рейтинга:';
$rat $user[rating]  / 100;
    echo 
'<b> '.$rat.'</b></div><div class="div">';
    echo 
'- Наисление за покупку рейтинга: <b>0.1%</b> <br/>
    - Стоиость: <b>1000</b> монет</div>'
;
echo 
'<div class="div">';
echo 
'<form action="?id='.$user['id'].'" method="post">';
echo 
'Количество: <br/>';
echo 
'<input type="text" name="rating" value = "" maxlength="6" size = "8"><br/>';
echo 
'<input type="submit" name ="submit" value="Поднять" class="submit"></form>';
echo 
'</div>';
    
    echo
"<div class='div'>Внимание!В случае накрутки рейтинга ваша страница может быть заблокирована!</div>";
include 
'foot.php';
break;
}
?>
Онлайн: 0
Реклама