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

Размер файла: 9.59Kb
<?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')
 {
$login1 = filter($_GET['login']);
  echo'<p class="modul_name"align="center">Подарки пользователя '.$login1.'</p>';

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

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

  $users_f = @file('../../data/users/'.$login1.'_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.'|'))
{
if($pol == '1')
{
if($status == '5')
{
echo'<img src="/images/st/m_nov.gif"alt=""/>';
}
elseif($status == '4')
{
echo'<img src="/images/st/m.gif"alt=""/>';
}
elseif($status == '3')
{
echo'<img src="/images/st/mod_m.gif"alt=""/>';
}
elseif($status == '2')
{
echo'<img src="/images/st/gmod_m.gif"alt=""/>';
}
elseif($status == '1')
{
echo'<img src="/images/st/admin_m.gif"alt=""/>';
}
}
elseif($pol == '0')
{
if($status == '5')
{
echo'<img src="/images/st/w_nov.gif"alt=""/>';
}
elseif($status == '4')
{
echo'<img src="/images/st/w.gif"alt=""/>';
}
elseif($status == '3')
{
echo'<img src="/images/st/mod_w.gif"alt=""/>';
}
elseif($status == '2')
{
echo'<img src="/images/st/gmod_w.gif"alt=""/>';
}
elseif($status == '1')
{
echo'<img src="/images/st/admin_w.gif"alt=""/>';
}
}
}
else
{
if($pol == '1')
{
echo'<img src="/images/st/m_off.gif"alt=""/>';
}
elseif($pol == '0')
{
echo'<img src="/images/st/w_off.gif"alt=""/>';
}
}

$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 />";
if($status_in == '1' || $status_in == '2' || $status_in == '3')
{
echo"[<a href=\"user_podarki.php?act=del&amp;nick=$login1&amp;id=$i&amp;".session_name()."=".session_id()."\"onclick=\"return confirm('Подтверждаете удаление?')\">Удалить</a>]<br />";
}

	    echo'</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;login=$login1&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;login=$login1&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;login=$login1&amp;".session_name()."=".session_id()."\">$i</a>";
       }

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


      if($page_get > 1)
       {
        echo "<a href=\"user_podarki.php?page=$page_nazad&amp;login=$login1&amp;".session_name()."=".session_id()."\">Назад</a>";
       }
      echo " | ";
      if($stranic > $page_get)
       {
        echo "<a href=\"user_podarki.php?page=$page_dalee&amp;login=$login1&amp;".session_name()."=".session_id()."\">Дальше</a>";
       } 
      echo "</p>";
     }
   }
    else
   {
    echo"<p align=\"center\">Неправельный формат страницы!!!<br>";
   }
  echo"<p>Всего подарков: $users_count<br />";
echo"<a href=\"user_info.php?nick=$login1&amp;".session_name()."=".session_id()."\">Анкета $login1</a><br />";
  
 echo"<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")
{
$login = filter($_GET['nick']);

$bans = @file('../../data/users/'.$login.'_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/'.$login.'_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|Удалил подарок у пользователя $login\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?login='.$login.'&set=1&'.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><a href=\"../kabinet/index.php?".session_name()."=".session_id()."\">В кабинет</a><br></p>";
}
  include '../../templates/foot.php';
 }
####################
?>