Вход Регистрация
Файл: public_html/light_podarok.php
Строк: 632
<?
define
('PROTECTOR'1);
defined('index') or die('Error: restricted access');

$head 'podarok';//фикс. места
$textl 'Подарки';

include_once(
'files/db.php');
include_once(
'files/auth.php');
include_once(
'include.php');
include_once(
'files/vip.php');
include_once(
'files/online.php');
include_once(
'files/sql.php');
include_once(
'files/lvl.php');
include_once(
'files/func.php');
include_once(
'files/regeneration.php');


auth();



$close_mysql mysql_fetch_assocmysql_query_new("SELECT `$head` FROM `close` LIMIT 1"));
if(
$close_mysql["$head"]==1){
    include_once(
'files/head.php');
    include_once(
'files/zag.php');
    
location_exit("$textl");
    include_once(
'files/down.php'); exit;
}




### Переменные ###
if(empty($usdata['id'])){
    
$usId $udata['id'];
    
$usdata['id'] = $udata['id'];
} else {
    
$usId $usdata['id'];
    
$usdata['id'] = $usdata['id'];
}
$h1 "<h1 class='center'>".($usId==$udata['id'] ? "Ваши подарки" "Подарки ".us("us_url{".$usdata['id']."}")."" )."</h1>";
##################









switch($_GET['mod']){
default:
    include_once(
'files/head.php');
    include_once(
'files/zag.php');

    
    if (
$_GET['page']<=1){$_GET['page'] = 1;}
    
$num obnul(($_GET['page']-1) * 5);
    
$a=$num;
    
    if(
$_default)
    {
$width=80$_desk=20;}else
    {
$width=55$_desk=15;}    

$_echo "
<table border='0' cellpadding='0' cellspacing='0' width='100%'>
<tr align='center'>"
;
if(
$_GET['act']!='groups'){
    
$_echo.="n <td width='50%' class='td_sw selected'><div class='sw_link selected'>Подарки</div></td>";
    
$_echo.="n <td width='50%' class='td_sw _left'><a class='sw_link' href='?$_get_r$_get_mod$_get_user&act=groups'>Группировать</a></td>";    }
else{
    
$_echo.="n <td width='50%' class='td_sw'><a href='?$_get_r$_get_mod$_get_user' class='sw_link'>Подарки</a></td>"
    
$_echo.="n <td width='50%' class='td_sw _left selected'> <div class='sw_link selected'>Группировать</div></td>";
    }
$_echo.="n</tr>n</table>";


if(
$_GET['act']!='groups'){
    
$_mysql "SELECT * FROM `podarok_users` WHERE `usr`='$usId' and `delete`='0' ORDER BY `id` DESC ";
} else {
    
$_mysql "SELECT *, COUNT(*) AS `total` FROM `podarok_users` WHERE `usr`='$usId' and `delete`='0' GROUP BY `id_podarok` ORDER BY `total` DESC";
}

    
    
$avto mysql_num_rowsmysql_query_new("$_mysql"));
    
$req mysql_query_new("$_mysql LIMIT $num,5");
    
echo 
"
$h1
$balka
$_echo
"
;
$_echo null;


while(
$_podarok mysql_fetch_array($req)){
    
$podarok mysql_fetch_assocmysql_query_new("SELECT * FROM `podarok_all` WHERE `id`='$_podarok[id_podarok]'"));
    
$podarok_bonus mysql_fetch_assocmysql_query_new("SELECT * FROM `podarok_bonus` WHERE `id_podarok`='$_podarok[id]' and `usr`='$usdata[id]' and `time`>'$time'"));
    
$podarok_bonus_num mysql_num_rowsmysql_query_new("SELECT * FROM `podarok_bonus` WHERE `usr`='$usdata[id]' and `time`>'$time'"));
    
$_td_bonus=null;
    
$_bonus_tr=null;
    
$_prime4anie=null;

    
    
$a++;

    if(
$_GET['act']=='groups'){
        
$sender_or_search "<b>Найдено</b>:<span class='rightw'>[<b>".abs($_podarok['total'])."</b>]</span>"; }
    elseif(empty(
$_podarok['anonim'])){
        
$sender_or_search "".us("user{".$_podarok['sender']."}"); }
    else{
        
$sender_or_search "<i><tt>(Анон)</tt></i>"; }
        
    if(
$_GET['act']=='groups'){
        
$date_podarok "
          <tr valign='top'> 
          <td style='padding: 4px;' colspan='8'>
            <u><b>Последний</b></u>:
            <span class='rightw'><i>
$imgtime(".sek_nazad($_podarok['time'],0).")</i></span></td>
          </tr>"
; }
    else{
        
$date_podarok "
          <tr valign='top'> 
          <td style='padding: 4px;' colspan='8'>
          <i><u>Время:</u></i>
          <span class='rightw'>
$imgtime".sek_nazad($_podarok['time'],0)."</span></td>
          </tr>"
; }


    if(!empty(
$podarok['strength'])){
        
$_td_bonus.="
          <td>
$imgudar$podarok[strength]</td>";}
    if(!empty(
$podarok['dexterity'])){
        
$_td_bonus.="
          <td>
$imglovk$podarok[dexterity]</td>";}
    if(!empty(
$podarok['critical'])){
        
$_td_bonus.="
          <td>
$imgcrit$podarok[critical]</td>";}
    if(!empty(
$podarok['defence'])){
        
$_td_bonus.="
          <td>
$imgdefence$podarok[defence]</td>";}
    if(!empty(
$podarok['uron'])){
        
$_td_bonus.="
          <td>
$imgdamage$podarok[uron]</td>";}
     
     
    if(!empty(
$_td_bonus) and $_GET['act']!='groups'){
        
$_bonus_tr="
          <tr valign='top'>
          <td colspan='8'><b>Бонусы:</b> <span class='rightw'>
$imgtime".sekund($podarok['time_bonus'])."</span></td>
          </tr>
          <tr valign='top'>
          
$_td_bonus
          </tr>
     "
;}
          
          
          
    if(empty(
$_podarok['anonim']) and !empty($_podarok['text']) and $_GET['act']!='groups'){
        
$description mb_strlen(trim(mb_strtolower(($_podarok['text']),'utf-8')));
        
$_podarok['text'] = mb_substr($_podarok['text'], 0200);
        
$part = ($description 200) ? '...' NULL;
        
$_podarok['text']=str_replace(mb_substr($_podarok['text'], 0$_desk), mb_substr($_podarok['text'], 0$_desk)." "$_podarok['text']);
        
$_prime4anie "
          <tr valign='top'> 
          <td style='padding: 4px;' colspan='8'>
          <u><i>Смс:</i></u>
          <div class='gray_italic' style='
          background: #eee;
          border: 1px solid #ddd;
          padding: 5px;
          border-radius: 5px;
          '> "
.antimat(us(smiles($_podarok['text'])))."$part</div>
          </tr>"
; }
    elseif(
$_GET['act']=='groups' and !empty($podarok['opys'])){
        
$_prime4anie "
          <tr valign='top'> 
          <td style='padding: 4px;' colspan='8'>
          <div class='gray_italic'> "
.antimat(us(smiles($podarok['opys'])))."</div>
          </tr>"
;
    }

        if(
$_podarok['usr']==$udata['id'] and $_GET['act']=='groups'){
            
$_url_name=$podarok['name'];
        } elseif(
$_podarok['usr']==$udata['id']) {
            
$_url_name="<a href='/index.php?$_get_r&mod=info_podarok$_get_user&id=$_podarok[id]'>$podarok[name]</a>";
        } else {
            
$_url_name="<a href='/index.php?$_get_r&mod=new_podarok$_get_user&act=go&id=$podarok[id]'>$podarok[name]</a>";
        }


$_echo .= "
<div>
   <div class='boss_title' "
.($a!=($num+1) ? "style='border-radius: 8px 8px 0 0'" "style='border-radius: 0'").">
   <b>
$_url_name</b> 
   <span class='rightw'> 
$sender_or_search </span>
   </div>

    <table width='100%' border='0' cellspacing='0' style='border-radius: 0 0 8px 8px' class='"
.($a%'inner_content_clans_mod_list_1' 'inner_content_clans_mod_list_2')."'>
    <tr valign='top'>  
        <td width='55' rowspan='6' style='padding: 1px;'>
            <img src='"
.image($podarok['img'])."' style='width:55px;'>
        </td>
    </tr>
        
$date_podarok
        
$_bonus_tr
        
$_prime4anie
    </table>
</div>
<div style='padding-bottom: 5px;'></div>
"
;
}


if(
$a==$num){
    echo
"$inner <center> <i> Ничего не найдено. </i></center> </div> $balka";
} else {
    echo 
$_echo;
}
$_echo null;

if(
$avto>5){
    
pager(5$avto"/index.php?$_get_r$_get_mod$_get_user$_get_act");
}

if(
$udata['id']!=$usdata['id']){
    if(
$avto) echo $balka;
    echo
"$inner
    <a href='/index.php?
$_get_r&mod=new_podarok$_get_user' class='margin0 bttn_green'>Подарить подарок</a></div>";
}

echo
"
<a href='/index.php?
$_get_r$_get_user' class='margin0 bttn_sea'>В профиль</a>";

break;








case 
'info_podarok':
$_podarok mysql_fetch_assocmysql_query_new("SELECT * FROM `podarok_users` WHERE `id`='$_GET[id]'"));
$podarok_all mysql_fetch_assocmysql_query_new("SELECT * FROM `podarok_all` WHERE `id`='$_podarok[id_podarok]'"));


if(empty(
$_podarok['id'])){
    
$_SESSION['msg']="$baloon <center> Подарок не найден! </center> </div>";
    
header("Location: /index.php?$_get_r&mod=podarok$_get_user"); exit;
}
elseif(
$_podarok['usr']!=$udata['id']){
    
$_SESSION['msg']="$baloon <center> Это не Ваш подарок! </center> </div>";
    
header("Location: /index.php?$_get_r&mod=podarok$_get_user"); exit; 
}
elseif(
$_podarok['delete']==1){
    
$_SESSION['msg']="$baloon <center> Подарок не найден! </center> </div>";
    
header("Location: /index.php?$_get_r&mod=podarok$_get_user"); exit; 
}

include_once(
'files/head.php'); 
include_once(
'files/zag.php'); 

$_bonus_tr=null;

if(empty(
$_podarok['anonim'])){
    
$sender_or_search "".us("user{".$_podarok['sender']."}"); }
else{
    
$sender_or_search "<i><tt>(Анон)</tt></i>"; }


    
if(!empty(
$podarok_all['strength'])){
    
$_td_bonus.="
      <td>
$imgudar$podarok_all[strength]</td>";}
if(!empty(
$podarok_all['dexterity'])){
    
$_td_bonus.="
      <td>
$imglovk$podarok_all[dexterity]</td>";}
if(!empty(
$podarok_all['critical'])){
    
$_td_bonus.="
      <td>
$imgcrit$podarok_all[critical]</td>";}
if(!empty(
$podarok_all['defence'])){
    
$_td_bonus.="
      <td>
$imgdefence$podarok_all[defence]</td>";}
if(!empty(
$podarok_all['uron'])){
    
$_td_bonus.="
      <td>
$imgdamage$podarok_all[uron]</td>";}
 
 
 
if(!empty(
$_td_bonus)){
    
$_bonus_tr="
      <tr valign='top'>
      <td colspan='8'><b>Бонусы:</b> <span class='rightw'>
$imgtime".sekund($podarok_all['time_bonus'])."</span></td>
      </tr>
      <tr valign='top'>
      
$_td_bonus
      </tr>
 "
;}



 
if(!empty(
$_podarok['text'])){
    
$_prime4anie "
      <tr valign='top'> 
      <td colspan='8'>
      <b>Смс:</b>
      <div class='gray_italic' style='
        background: #eee;
        border: 1px solid #ddd;
        padding: 5px;
        border-radius: 5px;
        '>"
.antimat(us(smiles($_podarok['text'])))."</div>
      </tr>"
; }

 
 
      
echo
"
   <div class='boss_title' style='border-radius: 0px'>
   <b>
$podarok_all[name]</b> 
   <span class='rightw'> 
$imgtime".sek_nazad($_podarok['time'],0)." </span>
   </div>

<div class='inner_content_clans_mod_list_1'>
   <table width='100%' border='0' cellspacing='0'>
      <tr valign='top'>  
      <td width='55' rowspan='6' style='padding: 1px;'>
      <img src='"
.image($podarok_all['img'])."' style='width:55px;'>
      </td>
      </tr>
      
      <tr valign='top'>  
      <td>
      <b>Тип:</b> "
.($_podarok['anonim']=='Анонимный' 'Публичный')."
      </td>
      </tr>
      
      <tr valign='top'>  
      <td>
      <b>От:</b> "
.us("us{".$_podarok['sender']."}")."
      </td>
      </tr>
      
      
$_bonus_tr
      
$_prime4anie
   </table>
   "
.($_podarok['usr']==$udata['id'] ? "
   <a href='?
$_get_r&mod=redPodarok$_get_user$_get_id' class='bttn' style='margin: 10px 35px 0px 35px'>Сделать ".($_podarok['anonim']=='публичным' 'анонимным')."</a>
   <a href='?
$_get_r&mod=redPodarok&go=del$_get_user$_get_id' class='bttn_red' style='margin: 0px 35px 10px 35px'>Удалить</a>
   " 
null)."
</div>


<a href='/index.php?
$_get_r&mod=podarok$_get_user' class='margin0 bttn_green'> В подарки </a>
<a href='/index.php?
$_get_r$_get_user$bt_s> В профиль </a>
"
;
break;







case 
'redPodarok':
$_podarok mysql_fetch_assocmysql_query_new("SELECT * FROM `podarok_users` WHERE `id`='$_GET[id]'"));
$podarok_all mysql_fetch_assocmysql_query_new("SELECT * FROM `podarok_all` WHERE `id`='$_podarok[id_podarok]'"));
if(empty(
$_podarok['id'])){
    
$_SESSION['msg']="$baloon <center> Подарок не найден! </center> </div>";
    
header("Location: /index.php?$_get_r&mod=podarok$_get_user"); exit;
}
elseif(
$_podarok['usr']!=$udata['id']){
    
$_SESSION['msg']="$baloon <center> Это не Ваш подарок! </center> </div>";
    
header("Location: /index.php?$_get_r&mod=podarok$_get_user"); exit; 
}
elseif(
$_podarok['delete']==1){
    
$_SESSION['msg']="$baloon <center> Подарок не найден! </center> </div>";
    
header("Location: /index.php?$_get_r&mod=podarok$_get_user"); exit; 
}

if(!isset(
$_POST['yes'])){
    include_once(
'files/head.php');
    include_once(
'files/zag.php');
    echo
"
    
$imbal 
       Ты уверен что хочешь "
.($_GET['go']=='del' 'удалить' 'сделать '.($_podarok['anonim']=='публичным' 'анонимным').'' )." подарок «<b>$podarok_all[name]</b>» ???
       <form method='post'>
       <input class='margin0 bttn' name='yes' type='submit' value='Уверен'/>
       <a href='?
$_get_r&mod=info_podarok$_get_id$_get_user$bt_r> Нет я передумал!</a>
       </form>
    </div>
    <a href='/index.php?
$_get_r$_get_user$bt_s> В профиль </a>
    "
;
} else {
    if(
$_GET['go']=='del'){
        
mysql_query_new("UPDATE `podarok_users` SET `delete`='1' WHERE `id`='$_GET[id]'");
        
$_SESSION['msg'] = "$baloon <center>Успешно удалено.</center></div>";
        
header("Location: ?$_get_r&mod=podarok$_get_user"); exit; 
    } else {
        
mysql_query_new("UPDATE `podarok_users` SET `anonim`='".($_podarok['anonim']==)."' WHERE `id`='$_GET[id]'");
        
$_SESSION['msg'] = "$baloon <center>Успешно отредатировано.</center></div>";
        
header("Location: ?$_get_r&mod=info_podarok$_get_id$_get_user"); exit; 
    }
    
}
break;



















case 
'new_podarok':
$h1_and_panel "
<h1 class='center'>Дарим подарок "
.us("us_url{".$usdata['id']."}")."</h1>
$balka
    <div class='switcher_link left'><a href='/index.php?
$_get_r&mod=podarok$_get_user'>Подарки</a></div>
    <div class='switcher_link right'><a href='/index.php?
$_get_r&mod=podarok$_get_user&act=groups'>Групировать</a></div>";

    if(
$_default)
    {
$width=80;}else
    {
$width=55;}    
    
$limit_podarkov 5;
    

    
switch(
$_GET['act']){
default:
/////////////////////
if(!empty($_GET['cat'])){
    
$cat mysql_fetch_assocmysql_query_new("SELECT * FROM `podarok_cats` WHERE `id`='$_GET[cat]'"));
    if(
$cat['prava']>$udata['prava']){
        
$_SESSION['msg']="$baloon <center> Каталог не найден! </div>";
        
header("Location: /index.php?$_get_r$_get_mod$_get_user"); exit; }
    elseif(
$cat['status']==0){
        
$_SESSION['msg']="$baloon <center> Каталог не активен! </div>";
        
header("Location: /index.php?$_get_r$_get_mod$_get_user"); exit; }}
/////////////////////


include_once('files/head.php'); 
include_once(
'files/zag.php');

    if (
$_GET['page']<=1){ $_GET['page']=1;}
    
$num obnul(($_GET['page']-1) * 10);
    
$a=$num;
    
    if(!empty(
$_GET['cat'])){ $_and_cat "and `cat`='$_GET[cat]'"; }
    
$_mysql_ "SELECT * FROM `podarok_all` WHERE `lvl_min`<='$udata[lvl]' and `lvl_max`>='$udata[lvl]$_and_cat";
    
$avto mysql_num_rowsmysql_query_new("$_mysql_"));
    
$req mysql_query_new("$_mysql_ LIMIT $num,10") or die(baloon('Error'));


//-------------- Меню ---------------//
$req_cats mysql_query_new("SELECT * FROM `podarok_cats` WHERE `prava`<='$udata[prava]' and `status`='1'") or die(baloon('Error'));
echo
"$h1_and_panel
$inner
    <b> Каталог: </b> <select name='act' onchange='top.location.href = this.options[this.selectedIndex].value;'>
    <option value = '/index.php?
$_get_r$_get_mod$_get_user'> **** </option>";
while(
$cats mysql_fetch_assoc($req_cats)){
    if(
$_GET['cat']==$cats['id']){$_select_act 'selected'; }else{ $_select_act null; }
    echo
"n        <option value='/index.php?$_get_r$_get_mod$_get_user&cat=$cats[id]$_select_act>$cats[name]</option>";}
echo 
"n    </select>
</div>
$balka";
##-------------- Меню ---------------##


//-------------- Подарки ---------------//
while($podarok mysql_fetch_assoc($req)){
    
$podarok_users mysql_fetch_assocmysql_query_new("SELECT * FROM `podarok_users` WHERE `id_podarok`='$podarok[id]' and `usr`='$usdata[id]' and `delete`='0'"));
$podarok_bonus mysql_fetch_assocmysql_query_new("SELECT * FROM `podarok_bonus` WHERE `id_podarok`='$podarok_users[id]' and `usr`='$usdata[id]' and `time`>'$time'"));
$podarok_bonus_num mysql_num_rowsmysql_query_new("SELECT * FROM `podarok_bonus` WHERE `usr`='$usdata[id]' and `time`>'$time'"));
    
    
$_td_bonus=null;
    
$_bonus_tr=null;
    
$a++;
    
$b=floor($a/2)*2;
    if(
$b==$a)
    {
$inner_content_ ="<div class='inner_content_clans_mod_list_1'>";}else
    {
$inner_content_ ="<div class='inner_content_clans_mod_list_2'>";}

    if(
$podarok['price_type']=='almaz'){ $img_prise=$imgdoc; }
    elseif(
$podarok['price_type']=='money'){ $img_prise=$imglave2; }

echo
"
$inner_content_

<table width='100%' border='0' cellpadding='0' cellspacing='0'>
  <tr valign='top'>
    <td width='
$width' rowspan='6'><img src='".image($podarok['img'])."' width='$width'></td>
    <td colspan='7'><b>
$podarok[name]</b></td>
  </tr>"
;
  
  
if(!empty(
$podarok['opys'])){
echo
"
  <tr valign='top'>
   <td colspan='7'><tt><i>
$podarok[opys]</i></tt></td>
 </tr>
 "
;
}
 
if(!empty(
$podarok['strength'])){
    
$_td_bonus.="
      <td>
$imgudar$podarok[strength]</td>";}
if(!empty(
$podarok['dexterity'])){
    
$_td_bonus.="
      <td>
$imglovk$podarok[dexterity]</td>";}
if(!empty(
$podarok['critical'])){
    
$_td_bonus.="
      <td>
$imgcrit$podarok[critical]</td>";}
if(!empty(
$podarok['defence'])){
    
$_td_bonus.="
      <td>
$imgdefence$podarok[defence]</td>";}
if(!empty(
$podarok['uron'])){
    
$_td_bonus.="
      <td>
$imgdamage$podarok[uron]</td>";}
 
 
if(!empty(
$_td_bonus) and $_GET['act']!='groups'){
    
$_bonus_tr="
      <tr valign='top'>
      <td colspan='8'><b>Бонусы:</b> <span class='rightw'>
$imgtime".sekund($podarok['time_bonus'])."</span></td>
      </tr>
      <tr valign='top'>
      
$_td_bonus
      </tr>
 "
;}
 
 
 

echo
"n$_bonus_tr
</table>"
;

if(!empty(
$podarok_bonus['id'])){
    echo
"<a class='bttn_gray'>Уже есть такой бонус</a>"; }
elseif(
$podarok_bonus_num>=$limit_podarkov){
    echo
"<a class='bttn_gray'>Лимит подарков</a>"; }
else{
echo
"n<a href='/index.php?$_get_r$_get_mod$_get_user$_get_cat&act=go&id=$podarok[id]' class='bttn_green'>Подарить за  $img_prise".okr($podarok['price'])."</a>"; }

echo
"n</div>
"
;}
##-------------- Подарки ---------------##

if($a==$num){echo"n$inner <center> <i> Ничего не найдено. </i></center> </div>";}
if(
$avto>10){
    echo
"n$balka";
    
pager(10$avto"/index.php?$_get_r$_get_mod$_get_user$_get_cat"); }
break;














case
'go':
$podarok mysql_fetch_assocmysql_query_new("SELECT * FROM `podarok_all` WHERE `id`='$_GET[id]'"));
$cat mysql_fetch_assocmysql_query_new("SELECT * FROM `podarok_cats` WHERE `id`='$podarok[id_cat]'"));
$podarok_users mysql_fetch_assocmysql_query_new("SELECT * FROM `podarok_users` WHERE `id_podarok`='$podarok[id]' and `usr`='$usdata[id]' and `delete`='0'"));
$podarok_bonus mysql_fetch_assocmysql_query_new("SELECT * FROM `podarok_bonus` WHERE `id_podarok`='$podarok_users[id]' and `usr`='$usdata[id]' and `time`>'$time'"));
$podarok_bonus_num mysql_num_rowsmysql_query_new("SELECT * FROM `podarok_bonus` WHERE `usr`='$usdata[id]' and `time`>'$time'"));
    
$limit_podarkov 5;

if(
$usdata['id']==$udata['id']){
    
$_SESSION['msg']="$baloon <center> Нельзя дарить подарок самому себе! </center> </div>";
    
header("Location: /index.php?$_get_r$_get_mod$_get_user"); exit; }
elseif(empty(
$podarok['id']) or $cat['prava']>$udata['prava']){
    
$_SESSION['msg']="$baloon <center> Подарок не найден! </div>";
    
header("Location: /index.php?$_get_r$_get_mod$_get_user"); exit; }
elseif(
$podarok['lvl_min']>$udata['lvl'] or $podarok['lvl_max']<$udata['lvl']){
    
$_SESSION['msg']="$baloon <center> Вам нельзя дарить этот подарок! Ограничение уровня! </div>";
    
header("Location: /index.php?$_get_r$_get_mod$_get_user"); exit; }
elseif(empty(
$_POST['buy'])){
    include_once(
'files/head.php');
    include_once(
'files/zag.php');

    if(
$podarok['price_type']=='almaz'){ $img_prise=$imgdoc; }
    elseif(
$podarok['price_type']=='money'){ $img_prise=$imglave2; }
    
echo 
$h1_and_panel;
echo
"
$inner

<table width='100%' border='0' cellpadding='0' cellspacing='0'>
  <tr valign='top'>
    <td width='"
.($width)."' rowspan='5'><img src='".image($podarok['img'])."' width='".($width+8)."'></td>
    <td colspan='6'><b>
$podarok[name]</b></td>
  </tr>"
;
if(!empty(
$podarok['strength'])){
    
$_td_bonus.="
    <td>
$imgudar+$podarok[strength]</td>";}
if(!empty(
$podarok['dexterity'])){
    
$_td_bonus.="
    <td>
$imglovk+$podarok[dexterity]</td>";}
if(!empty(
$podarok['critical'])){
    
$_td_bonus.="
    <td>
$imgcrit+$podarok[critical]</td>";}
if(!empty(
$podarok['defence'])){
    
$_td_bonus.="
    <td>
$imgdefence+$podarok[defence]</td>";}
if(!empty(
$podarok['uron'])){
    
$_td_bonus.="
    <td>
$imgdamage+$podarok[uron]</td>";}
 
if(!empty(
$podarok['opys'])){echo"
 <tr valign='top'>
   <td colspan='6'><tt><i>
$podarok[opys]</i></tt></td>
 </tr>"
;}
 
if(!empty(
$_td_bonus)){echo"
 <tr valign='top'>
   <td width='5%'><b>Бонусы: </b></td>
   
$_td_bonus
 </tr>
 <tr valign='top'>
   <td colspan='6'><b>Время бонуса:</b> <span class='rightw'>
$imgtime".sekund($podarok['time_bonus'])."</span></td>
 </tr>
 "
;}
 
echo
"  
</table>

<form method='post'>
<b>Оставить сообщение</b>:
<br>
<textarea name='text' maxlength='250' width='100%' wrap='off'></textarea>
<br>
<input type='checkbox' name='anonim' value='1'>Анонимно от остальных"
;

if(!empty(
$podarok_bonus['id'])){
    echo
"<a class='bttn_gray'>Уже есть такой бонус</a>"; }
elseif(
$podarok_bonus_num>=$limit_podarkov){
    echo
"<a class='bttn_gray'>Лимит подарков</a>"; }
else{
    echo
"<button type='submit' name='buy' class='margin0 bttn_green' value='1'>Подарить за $img_prise".okr($podarok['price'])." </button>"; }


echo
"
</form>
</div>
"
;
}

elseif(!empty(
$podarok_bonus['id'])){
    
$_SESSION['msg']="$baloon <center> У игрока уже есть активный бонус от такого подарка! </div>";
    
header("Location: /index.php?$_get_r$_get_mod$_get_user$_get_act$_get_id"); exit; }
    
elseif(
$podarok_bonus_num>=$limit_podarkov){
    
$_SESSION['msg']="$baloon <center> У игрока уже есть один активный бонус! </div>";
    
header("Location: /index.php?$_get_r$_get_mod$_get_user$_get_act$_get_id"); exit; }
elseif(
$podarok['price_type']=='almaz' and $udata['almaz']<$podarok['price']){
    
$_SESSION['msg']=$_MALO_DOC;
    
header("Location: /index.php?$_get_r$_get_mod$_get_user$_get_act$_get_id"); exit; }
elseif(
$podarok['price_type']=='money' and $udata['money']<$podarok['price']){
    
$_SESSION['msg']=$_MALO_LAVE;
    
header("Location: /index.php?$_get_r$_get_mod$_get_user$_get_act$_get_id"); exit; }
else{
    if(
$podarok['price_type']=='almaz'){
        
$_text_logs_="Подарил игроку us{".$usdata['id']."} подарок «<b>$podarok[name]</b>» за {doc}$podarok[price]"$_mesto "Рубины";}
    elseif(
$podarok['price_type']=='money'){
        
$_text_logs_="Подарил игроку us{".$usdata['id']."} подарок «<b>$podarok[name]</b>» за {lave}".okr($podarok['price']).""$_mesto "Лаве";}
        
    
$_POST['text']=br($_POST['text'],$udata['prava']);
    
mysql_query("INSERT INTO `podarok_users` SET 
    `usr`='
$usdata[id]',
    `sender`='
$udata[id]',
    `id_podarok`='
$podarok[id]',
    `time`='
$time',
    `anonim`='
$_POST[anonim]',
    `text`='
$_POST[text]'") or die('Error');
    
$last_id mysql_insert_id();
    if(!empty(
$podarok['strength']) or !empty($podarok['dexterity']) or !empty($podarok['critical']) or !empty($podarok['defence']) or !empty($podarok['uron']))
    {
        
mysql_query_new("INSERT INTO `podarok_bonus` SET 
        `usr`='
$usdata[id]',
        `id_podarok`='
$last_id',
        `strength`='
$podarok[strength]',
        `dexterity`='
$podarok[dexterity]',
        `critical`='
$podarok[critical]',
        `defence`='
$podarok[defence]',
        `uron`='
$podarok[uron]',
        `time`='"
.($time+$podarok['time_bonus'])."'");
    }

    
$text_new_podarok "<center> Вам подарили <a href="/index.php?r=podarok&mod=info_podarok&user=$usdata[id]&id=$last_id">подарок</a>. </center>";
    
mysql_query_new("INSERT INTO `messages` SET `ot`='$admin_set[sms]', `komy`='$usdata[id]',`time` = '$time', `read`='1', `text`='$text_new_podarok'");
    
mysql_query_new("INSERT INTO `logs` SET `usr`='$udata[id]',`mesto`='$_mesto', `time` = '$time', `text`='$_text_logs_'");
    
mysql_query_new("INSERT INTO `logs` SET `usr`='$udata[id]',`mesto`='Подарки', `time` = '$time', `text`='$_text_logs_'");
    
mysql_query_new("UPDATE `users` SET `".$podarok['price_type']."`=`".$podarok['price_type']."`-'".$podarok['price']."' WHERE `id`='$udata[id]'");
    
mysql_query_new("UPDATE `stats_users` SET `kolvo`=`kolvo`+'1' WHERE `usr`='$udata[id]' and `stats_quest_id`='4'  LIMIT 1");
    
$_SESSION['msg']="$baloon <center> Вы успешно подарили «<b>$podarok[name]</b>» игроку - ".us("us_url{".$usdata['id']."}").". </div>";
    
header("Location: /index.php?$_get_r$_get_mod$_get_user$_get_act$_get_id"); exit; }

break;
}


echo
"
<a href='/index.php?
$_get_r$_get_user' class='margin0 bttn_sea'>В профиль</a>";
include_once(
'files/down.php');
exit;
break;







}



include_once(
'files/down.php');
?>
Онлайн: 0
Реклама