Просмотр файла modules/kabinet/user_podarki.php

Размер файла: 10.65Kb
<?php
########################################
##	           WAP-ENGINE             ##
########################################
##                                    ##
##  Автор : CHUMA (Токарев Владимир)  ##
##  e-mail : [email protected]     ##
##  WAP : http://wap-engine.ru        ##
##                                    ##
########################################
##         ВЫ НЕ ИМЕЕТЕ ПРАВО         ##
##        ИЗМЕНЯТЬ КОД СКРИПТА        ##
##  ДЛЯ ДАЛЬНЕЙШЕГО РАСПРОСТРАНЕНИЯ!  ##
########################################
include ('../../config.php');
include ('../../templates/run.php');
include ('../../templates/func.php');
$title_page ='Подарки пользователя';

$passw_in = $passw;
$login_in = $login;
$status_in = $status;
####################
$time = date ("YmdHis", time() + ($sdvigclock*3600));
if (isset($_SESSION['sespass']) && isset($passw_in) && $_SESSION['sespass'] == $passw_in)
 {
  include '../../themes/'.$themes.'.php';
if ($portal=='off')
 {
  echo'<p align="center">'.$offmes.'</p>';
 }
if ($portal=='on')
 {
$nick = filter($_GET['nick']);

$nicks = file('../../data/nicks.php');
$count_nicks = count($nicks);
$count_nicks = $count_nicks - 2;
$user_est = 0;
for($i=2; $i <= $count_nicks; $i++)
{
if($nick == trim($nicks[$i]))
{
$user_est = 1;
break;
}
}

if(!empty($nick))
{
if($user_est == 1)
{
user_data('../../data/users/'.$nick.'.php');  # Считывание данных пользователя находится в файле templates/func.php
}
else
{
$error = 1;
}
}
else
{
$error = 1;
}

if(!empty($error))
{
echo'<p class="modul_name">Подарки пользователя</p>';
echo'<p class="err">Ошибка!!! Данного пользователя не существует!</p>';
echo'<p><img src="/images/st/back.gif"align="top"alt=""/> <a href="users.php?'.session_name().'='.session_id().'">Пользователи</a><br /> <img src="/images/st/back.gif"align="top"alt=""/> <a href="index.php?'.session_name().'='.session_id().'">В кабинет</a></p>';
include '../../templates/foot.php';
exit;
}

user_data('../../data/users/'.$nick.'.php');
$nick_name_arr = explode('::', $nickname);
$nickname = $nick_name_arr[0];
$nickcolor = $nick_name_arr[1];
if(!empty($nickname))
{
if(!empty($nickcolor))
{
$login_nick_color = '<font color="'.$nickcolor.'">'.$nickname.'</font>';
}
else
{
$login_nick_color = ''.$nickname.'';
}
}
else
{
$login_nick_color = ''.$nick.'';
}
  echo'<p class="modul_name"align="center">Подарки пользователя '.$login_nick_color.'</p>';

$m_polozhenie = 'Смотрит подарки пользователя '.$login_nick_color.'';

if($_GET['set'] == 1)
{
echo'<p class="b"><img src="/images/st/es.gif"alt=""/> Подарок успешно удален.</p>';
}

  $users_f = @file('../../data/users/'.$nick.'_podarki.php');
if(!empty($users_f))
{
  array_splice($users_f, 0, 2);
  array_splice($users_f, -2, 2);
$users_count = count($users_f);
}
else
{
$users_count = 0;
}
  
  $users_on_f = file('../../data/user_online.txt');
  $user_on_arr = implode('|', $users_on_f);
  $kto = filter($_GET['kto']);

  $kols = $kolusers;
  
  
  for($ii = 0; $ii <= $users_count; $ii++)
   {
    $user_n = $users_f[$ii];

	  $users_arr[] = $users_f[$ii];
	 
   }
  $users_f = $users_arr;
  $stranic = ceil($users_count/$kols);

  if(!empty($kto))
   {
    for($ii = 0; $ii <= $users_count; $ii++)
     {
      $user_n = explode('|', $users_f[$ii]);
      if(stristr("$user_n[0]", "$kto"))
	   {
	    $users_arr2[] = $users_f[$ii];
	   }
     }
    $users_f = $users_arr2;
    
    $stranic = ceil($users_count/$kols);
   }


  if($users_count == 0)
   {
    echo'<p class="b">Подарков у пользователя нет.</p>';
   }


  if(empty($_GET['page']))
   {
    $page_get = 1;
   }
    else
   {

    $page_get = $_GET['page'];
   }
  
  if($page_get > $stranic)
   {
    $page_get = $stranic;
   }
  if($page_get < 1)
   {
    $page_get = 1;
   }
   
  $do = $kols * ($page_get - 1);
  $end = $kols * $page_get;

  $page_nazad = $page_get - 1;
  $page_dalee = $page_get + 1;

  if (preg_match("#^[0-9]*$#", "$page_get")) 
   {
    for($i = $do; $i < $end; $i++)
     {
      $user_n = $users_f[$i];
	  if (!empty($users_f[$i]))
       {
	    
       

$user_p = explode('|', $users_f[$i]);
$podarok1 = trim($user_p[0]);
$podarok2 = trim($user_p[1]);
$podarok3 = trim($user_p[2]);
$podarok4 = trim($user_p[3]);
        
         

user_data('../../data/users/'.$podarok1.'.php');
echo"<p class=\"b\">";
if(strstr($user_on_arr, '|'.$podarok1.'|'))
{
pol_status_on($pol,$status);
}
else
{
pol_off($pol);
}

$nick_name_arr = explode('::', $nickname);
$nickname = $nick_name_arr[0];
$nickcolor = $nick_name_arr[1];
if(!empty($nickname))
{
if(!empty($nickcolor))
{
$login_nick_color = '<font color="'.$nickcolor.'">'.$nickname.'</font>';
}
else
{
$login_nick_color = ''.$nickname.'';
}
}
else
{
$login_nick_color = ''.$podarok1.'';
}

        echo" <a href=\"user_info.php?nick=$podarok1&amp;".session_name()."=".session_id()."\">$login_nick_color</a> ";
if($rating >= $kolbronza && $rating <= $kolserebro)
{
echo'<img src="/images/st/bronza.gif"alt=""/>';
}
if($rating >= $kolserebro && $rating <= $kolzoloto)
{
echo'<img src="/images/st/serebro.gif"alt=""/>';
}
if($rating >= $kolzoloto)
{
echo'<img src="/images/st/zoloto.gif"alt=""/>';
}if($icon_text == "1" || $icon_text == ""){
        echo" <a href=\"../kabinet/send_privat.php?nick=$podarok1&amp;".session_name()."=".session_id()."\"><img src=\"/images/st/1.gif\"align=\"top\"alt=\"\" title=\"Написать сообщение\"></a><br />";
}
if($icon_text == "0")
{
echo" <a href=\"../kabinet/send_privat.php?nick=$podarok1&amp;".session_name()."=".session_id()."\">[ЛС]</a><br />";
}
echo "($podarok4)<br /> $podarok3<br /> $podarok2<br /></p>";

if($status_in == '1' || $status_in == '2' || $status_in == '3')
{
echo'<p class="dy">';
echo"[<a href=\"user_podarki.php?act=del&amp;nick=$nick&amp;id=$i&amp;".session_name()."=".session_id()."\"onclick=\"return confirm('Подтверждаете удаление?')\">Удалить</a>]<br /></p>";
}
}
}
   
    if($stranic > 1)
     {
      echo "<p align=\"center\" class=\"d\">";
      echo "Страницы:";
      echo "<br>";
      if($page_get > 4)
       {
        echo "<a href=\"user_podarki.php?page=1&amp;nick=$nick&amp;".session_name()."=".session_id()."\">1</a>...";
       }
 
      $start_1 = $page_get - 3;
      $end_1 = $page_get - 1;
      if($start_1 < 1)
       {
        $start_1 = 1;
       }
  
      for($i = $start_1; $i <= $end_1; $i++)
       {
        echo"<a href=\"user_podarki.php?page=$i&amp;nick=$nick&amp;".session_name()."=".session_id()."\">$i</a> ";
       }

      echo"$page_get";

      $start_2 = $page_get + 1;
      $end_2 = $page_get + 3;
      if($start_2 < 1)
       {
        $start_2 = 1;
       }
      if($end_2 > $stranic)
       {
        $end_2 = $stranic;
       }
  
      for($i = $start_2; $i <= $end_2; $i++)
       {
        echo" <a href=\"user_podarki.php?page=$i&amp;nick=$nick&amp;".session_name()."=".session_id()."\">$i</a>";
       }

      if($stranic > $page_get && $page_get < ($stranic-3))
       {
        echo "...<a href=\"user_podarki.php?page=$stranic&amp;nick=$nick&amp;".session_name()."=".session_id()."\">$stranic</a>";
       }
      echo "<br>";


      if($page_get > 1)
       {
        echo "<a href=\"user_podarki.php?page=$page_nazad&amp;nick=$nick&amp;".session_name()."=".session_id()."\">Назад</a>";
       }
      echo " | ";
      if($stranic > $page_get)
       {
        echo "<a href=\"user_podarki.php?page=$page_dalee&amp;nick=$nick&amp;".session_name()."=".session_id()."\">Дальше</a>";
       } 
      echo "</p>";
     }
   }
    else
   {
    echo"<p align=\"center\">Неправельный формат страницы!!!<br>";
   }
user_data('../../data/users/'.$nick.'.php');
$nick_name_arr = explode('::', $nickname);
$nickname = $nick_name_arr[0];
$nickcolor = $nick_name_arr[1];
if(!empty($nickname))
{
if(!empty($nickcolor))
{
$login_nick_color = '<font color="'.$nickcolor.'">'.$nickname.'</font>';
}
else
{
$login_nick_color = ''.$nickname.'';
}
}
else
{
$login_nick_color = ''.$nick.'';
}
  echo"<p>Всего подарков: $users_count<br />";
echo"<img src=\"/images/st/back.gif\"align=\"top\"alt=\"\"/> <a href=\"user_info.php?nick=$login1&amp;".session_name()."=".session_id()."\">Анкета $login_nick_color</a><br />";
  
 echo"<img src=\"/images/st/back.gif\"align=\"top\"alt=\"\"/> <a href=\"../kabinet/index.php?".session_name()."=".session_id()."\">В кабинет</a></p>";

###############

if($_GET['act'] == 'del')
{
if($status_in == "1" || $status_in == "2" || $status_in == "3")
{
$nick = filter($_GET['nick']);

$bans = @file('../../data/users/'.$nick.'_podarki.php');
      $bans_count = count($bans);
      for($i=2; $i < $bans_count -2; $i++)
       {
        $banes[] = $bans[$i];
       }
      $bes_count = count($banes);



      for($i=0; $i < $bes_count; $i++)

       {
        if($i != $_GET['id'])
         {	
          $mes_to_file .= trim($banes[$i])."\r\n" ;
         }
       }
      $mes_to_file = trim($mes_to_file);
      if(!empty($mes_to_file))
       { $mes_to_file = "\r\n".$mes_to_file; } else
       { $mes_to_file = ''; }


      write_to_file('../../data/users/'.$nick.'_podarki.php', "<?php\r\n/*$mes_to_file\r\n*/\r\n?>");


$date = date('d.m.Y / H:i:s', time() + ($sdvigclock*3600));
    $adm_log_f = @file('../../data/adm_log.php');
    $adm_log_count = count($adm_log_f) - 2;
    $mes_to_adm_log = "$login_in|$date|Удалил подарок у пользователя $nick\r\n";
    for($i=2; $i < $adm_log_count; $i++)
     {
      $mes_to_adm_log .= $adm_log_f[$i];
     }
    $mes_to_adm_log = trim($mes_to_adm_log);
      
    $adm_log_file = fopen('../../data/adm_log.php','w');
    flock ($adm_log_file,LOCK_EX);
    fputs($adm_log_file,"<?php\r\n/*\r\n$mes_to_adm_log\r\n*/\r\n?>");
    fflush ($adm_log_file);
    flock ($adm_log_file,LOCK_UN);
    fclose($adm_log_file);

header ('Location: user_podarki.php?set=1&nick='.$nick.'&'.session_name().'='.session_id().'');
}
}
}
  include '../../templates/foot.php';
 }
  else
 {
  include '../../themes/'.$themes.'.php';
if ($portal=='off')
 {
  echo'<p align="center">'.$offmes.'</p>';
 }
if ($portal=='on')
 {
  echo"<p class=\"b\">Вы не авторизованы!!! Войдите в личный кабинет.<br></p>";
  echo"<p><img src=\"/images/st/back.gif\"align=\"top\"alt=\"\"/> <a href=\"../kabinet/index.php?".session_name()."=".session_id()."\">В кабинет</a><br></p>";
}
  include '../../templates/foot.php';
 }
####################
?>