Вход Регистрация
Файл: setk/mpets/info.php
Строк: 895
<?php
# МОД Удивительный питомец
# kiper
error_reporting(0);
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';



$action=htmlspecialchars(trim($_GET['a']));
switch (
$action){
default:
$titles='Мой питомец';
include_once 
'head.php';

if (isset(
$_GET['id']))$q_mpets['id_user']=intval($_GET['id']);
else 
$q_mpets['id_user']=$mpets['id_user'];
$q_mpets=mysql_fetch_array(mysql_query("SELECT * FROM `mpets` WHERE `id_user`='".$q_mpets['id_user']."'"));
$q_user=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id`='".$q_mpets['id_user']."'"));

echo 
'
<div class="c-block large center nopad">
            <table class="pet_profile">
'
;
echo 
'<tr>';
$res mysql_query("SELECT * FROM `mpets_veshi` WHERE `id_user` = '".$q_mpets['id_user']."' ORDER BY `nomer` ASC LIMIT 6");
while (
$post mysql_fetch_array($res)){
echo 
'<td> 
<a class="item" href="?a=veshi&id='
.$q_user['id'].'"><img class="item_icon" src="img/veshi/'.$post['vesh'].'.png" /></a>
</td>'
;

if (
$post['nomer']==1){
if (
$q_mpets['vid_pets']==0)
echo
'<td rowspan="3" colspan="2"><img src="img/avatar'.$q_mpets['pol'].'.png" /></td>';
else echo
'<td rowspan="3" colspan="2"><img src="img/avatar/avatarik'.$q_mpets['vid_pets'].'.png" /></td>';
}
if(
$post['nomer']==2) echo '</tr><tr>';
if(
$post['nomer']==4) echo '</tr><tr>';
if(
$post['nomer']==6) echo '</tr><tr>';
}

echo 
'</table></div>';

//Кубки пользователя 
$count_res_konk=mysql_result(mysql_query("SELECT COUNT(*) FROM `mpets_konk` WHERE `pobed`='".$q_mpets['id_user']."'"),0);

if(
$count_res_konk>0){

echo 
'<div class="c-block green center">';
$res_konk mysql_query("select * from `mpets_konk` WHERE `pobed`='".$q_mpets['id_user']."' ORDER BY `time` DESC  LIMIT 4");
while (
$post_konk mysql_fetch_array($res_konk)){
echo 
'<a href="konkurs.php?a=info&id='.$post_konk['id'].'"><img class="item_icon" src="img/kub/'.$post_konk['kub'].'.png" /></a>';
}
if(
$count_res_konk>4)
echo 
'<br /><a class="pad_5r expand_link" href="konkurs.php?a=user&id='.$post_konk['id'].'"><img class="price_img" src="img/icons/arrow_down_small.png" /> развернуть <img class="price_img" src="img/icons/arrow_down_small.png" /></a>';
echo 
'</div>';

}
//Конец Кубки

echo'        
        
        
        
        <div class="c-block large orange_dark2">
            <span class="nowrap"><img  class="price_img" src="img/avatar_s'
.$q_user['pol'].'.png" />'
if (!
$q_mpets['name'])$q_mpets_name=$q_user['nick'];
else 
$q_mpets_name=htmlspecialchars($q_mpets['name']);
echo 
'<a class="darkgreen_link" href="'.( ($q_mpets['id_user']==$user['id']) ? '?a=name' '?id='.$q_user['id'].'' ).'"> '.$q_mpets_name.' </a> ['.( ($q_mpets['pol']!=0) ? 'М' 'Ж' ).'], '.$q_mpets['urov'].' уровень</span><br />
            <span class="nowrap"><img class="price_img" src="img/icons/beauty.png" /> Красота: '
.$q_mpets['krasota'].'</span><br />

            <span class="nowrap"><img class="price_img" src="img/icons/coin.png" /> Монеты: '
.$q_mpets['monet'].'</span><br />
            <span class="nowrap"><img class="price_img" src="img/icons/heart.png" /> Сердечки: '
.$q_mpets['serd'].'</span>';
$bonus_magaz=mysql_fetch_array(mysql_query("SELECT * FROM `mpets_bonus` WHERE `id`='".intval($mpets['bonus'])."'"));
if(
$q_mpets['bonus_time']>=time())echo '<br /><span class="nowrap"><img class="price_img" src="img/icons/expirience.png" /> Бонусы: <img class="item_icon_small" src="img/bonus/'.$mpets['bonus'].'.png" /> +'.$bonus_magaz['proc'].'%</span>';
if(
$user['level']>=3)echo '<br /><a class="item" href="?a=edit&id='.$q_user['id'].'"><span class="nowrap"><img class="price_img" src="img/icons/gtk-edit.png" /> Изменить питомца</span></a>';


echo 
'</div>';
if(
$q_user['id']==$user['id'])
echo 
'<div class="simple-block green"><div class="block-top"><div class="in1">&nbsp;</div><div class="in2">&nbsp;</div><div class="in3">&nbsp;</div></div><div class="block-mid"><div class="in1"><div class="in2"><a class="item" href="info.php?a=veshi&id='.$q_user['id'].'"><img src="img/icons/slots.png" />Мои вещи ('.mysql_result(mysql_query("SELECT COUNT(*) FROM `mpets_veshi` WHERE `id_user`='".$q_user['id']."' AND `vesh`!='0' ",$db), 0).' из '.mysql_result(mysql_query("SELECT COUNT(*) FROM `mpets_veshi` WHERE `id_user`='".$q_user['id']."' ",$db), 0).')</a></div></div></div><div class="block-bot"><div class="in1">&nbsp;</div><div class="in2">&nbsp;</div><div class="in3">&nbsp;</div></div></div>';
echo 
'<div class="simple-block green"><div class="block-top"><div class="in1">&nbsp;</div><div class="in2">&nbsp;</div><div class="in3">&nbsp;</div></div><div class="block-mid"><div class="in1"><div class="in2"><a class="item" href="info.php?a=bonus&id='.$q_user['id'].'"><img src="img/icons/effect.png" />Бонусы </a></div></div></div><div class="block-bot"><div class="in1">&nbsp;</div><div class="in2">&nbsp;</div><div class="in3">&nbsp;</div></div></div>';
echo 
'<div class="simple-block green"><div class="block-top"><div class="in1">&nbsp;</div><div class="in2">&nbsp;</div><div class="in3">&nbsp;</div></div><div class="block-mid"><div class="in1"><div class="in2"><a class="item" href="info.php?a=tren&id='.$q_user['id'].'"><img src="img/icons/train.png" />Тренировка </a></div></div></div><div class="block-bot"><div class="in1">&nbsp;</div><div class="in2">&nbsp;</div><div class="in3">&nbsp;</div></div></div>';

break;
case 
'veshi':
$titles='Мои вещи';
include_once 
'head.php';

if (isset(
$_GET['id']))$q_mpets['id_user']=intval($_GET['id']);
else 
$q_mpets['id_user']=$mpets['id_user'];
$q_mpets=mysql_fetch_array(mysql_query("SELECT * FROM `mpets` WHERE `id_user`='".$q_mpets['id_user']."'"));
$q_user=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id`='".$q_mpets['id_user']."'"));




if (isset(
$_GET['prod']))
{
$prod_vesh=mysql_fetch_array(mysql_query("SELECT * FROM `mpets_veshi` WHERE `id`='".intval($_GET['prod'])."'"));
$eda_ok=mysql_fetch_array(mysql_query("SELECT * FROM `mpets_veshi_magaz` WHERE `id`='".intval($prod_vesh['vesh'])."'"));

if (
$mpets['monet']>=$eda_ok['cena']&&$prod_vesh['id_user']==$user['id']){
mysql_query("UPDATE `mpets` SET `monet` = '".intval($mpets['monet']+$eda_ok['cena'])."', `krasota` = '".intval($mpets['krasota']-$eda_ok['krasota'])."' WHERE `id_user` = '".$user['id']."' LIMIT 1");
mysql_query("UPDATE `mpets_veshi` SET `vesh` = '0' WHERE `id` = '".$prod_vesh['id']."' LIMIT 1");

header("Location: info.php?a=veshi");
}else{
echo 
'<div class="warning-block large_orange">Не ваща вешь!</div>';
}

}





$res mysql_query("SELECT * FROM `mpets_veshi` WHERE  `id_user` = '".$q_user['id']."' ORDER BY `nomer` ASC  LIMIT 6");
while (
$q_post mysql_fetch_array($res))
{
$post=mysql_fetch_array(mysql_query("SELECT * FROM `mpets_veshi_magaz` WHERE `id`='".intval($q_post['vesh'])."'"));

echo 
'
                                    <div class="simple-block">
                        <div class="block-top">
                            <div class="in1">&nbsp;</div><div class="in2">&nbsp;</div><div class="in3">&nbsp;</div>
                        </div>
                        <div class="block-mid">
                            <div class="in1"><div class="in2">
                                                                    <img class="item_icon" src="img/veshi/'
.$q_post['vesh'].'.png" />
                                                            <div class="text_item">
'
;


if (
$q_post['vesh']!=0)
echo 
'<span class="span1">'.$post['name'].'</span>';
else if(
$q_post['vid']==1)echo '<span class="span1"><b>Одежда</b></span>';
elseif(
$q_post['vid']==2)echo '<span class="span1"><b>Аксессуар</b></span>';
else echo 
'<span class="span1"><b>Украшение</b></span>';



echo 
'<span class="span2">';
if(
$q_post['vid']==1&&$q_post['vesh']!=0)
echo 
'Одежда,';
elseif(
$q_post['vid']==2&&$q_post['vesh']!=0)
echo 
'Аксессуар,';
elseif (
$q_post['vesh']!=0) echo 'Украшение,';
else if(
$q_user['id']==$user['id'])echo 'Ничего не надето<br />Купите вещи в магазине';
else echo 
'Ничего не надето';

if (
$q_post['vesh']!=0)
echo 
'+<img class="price_img" src="img/icons/beauty.png" />'.$post['krasota'].'';
echo 
'<br />';
if(
$q_user['id']==$user['id']&&$q_post['vesh']!=0)echo '<a class="sell_link" href="?a=veshi&prod='.$q_post['id'].'">Продать</a> за <img src="img/icons/coin.png" class="price_img"/>'.$post['cena'].'</span>';


echo 
'</div>
</div>
</div>
</div>
            <div class="block-bot">
                <div class="in1">&nbsp;</div><div class="in2">&nbsp;</div><div class="in3">&nbsp;</div>
            </div>
        </div>

'
;
}


break;
case 
'tren':
$titles='Тренировка навыков';
include_once 
'head.php';

if (isset(
$_GET['id']))$q_mpets['id_user']=intval($_GET['id']);
else 
$q_mpets['id_user']=$mpets['id_user'];
$q_mpets=mysql_fetch_array(mysql_query("SELECT * FROM `mpets` WHERE `id_user`='".$q_mpets['id_user']."'"));
$q_user=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id`='".$q_mpets['id_user']."'"));
$tren_1=$q_mpets['tren_1']*100+50;
$tren_2=$q_mpets['tren_2']*100+50;
$tren_3=$q_mpets['tren_3']*100+50;



if (isset(
$_GET['tren']))
{

if (
$mpets['serd']>=$tren_1&&$q_user['id']==$user['id']&&$_GET['tren']==1){
mysql_query("UPDATE `mpets` SET `serd` = '".intval($mpets['serd']-$tren_1)."', `krasota` = '".intval($mpets['krasota']+1)."', `glamur` = '".intval($mpets['glamur']+1)."', `tren_1` = '".intval($mpets['tren_1']+1)."' WHERE `id_user` = '".$user['id']."' LIMIT 1");
header("Location: info.php?a=tren");
}elseif (
$mpets['serd']>=$tren_2&&$q_user['id']==$user['id']&&$_GET['tren']==2){
mysql_query("UPDATE `mpets` SET `serd` = '".intval($mpets['serd']-$tren_2)."', `krasota` = '".intval($mpets['krasota']+1)."', `glamur` = '".intval($mpets['glamur']+1)."', `tren_2` = '".intval($mpets['tren_2']+1)."' WHERE `id_user` = '".$user['id']."' LIMIT 1");
header("Location: info.php?a=tren");
}if (
$mpets['serd']>=$tren_3&&$q_user['id']==$user['id']&&$_GET['tren']==3){
mysql_query("UPDATE `mpets` SET `serd` = '".intval($mpets['serd']-$tren_3)."', `krasota` = '".intval($mpets['krasota']+1)."', `glamur` = '".intval($mpets['glamur']+1)."', `tren_3` = '".intval($mpets['tren_3']+1)."' WHERE `id_user` = '".$user['id']."' LIMIT 1");
header("Location: info.php?a=tren");
}else{
echo 
'<div class="warning-block large_orange">Недастаточно красоты!</div>';
}

}


echo 
'
<div class="simple-block"><div class="block-top"><div class="in1">&nbsp;</div><div class="in2">&nbsp;</div><div class="in3">&nbsp;</div></div><div class="block-mid"><div class="in1"><div class="in2"><span class="page_title">'
.$titles.'</span></div></div></div><div class="block-bot"><div class="in1">&nbsp;</div><div class="in2">&nbsp;</div><div class="in3">&nbsp;</div></div></div>
'
;

echo 
'<div class="c-block center"><span class="train_glamour">Гламур: <img src="img/icons/glamour.png" class="price_img" />'.$q_mpets['glamur'].'</span></div>';



echo 
'
<div class="simple-block">
                        <div class="block-top">
                            <div class="in1">&nbsp;</div><div class="in2">&nbsp;</div><div class="in3">&nbsp;</div>
                        </div>
                        <div class="block-mid">
                            <div class="in1">
                                <div class="in2">
                                    <img class="item_icon" src="img/glamur/1.png" />                                    <div class="text_item_slot">
                                        <span class="span1">
                                            Одежда <span class="darkgreen_link font_15">+<img src="img/icons/beauty.png" class="price_img" />'
.$q_mpets['tren_1'].'</span>                                        </span>
                                        <span class="span2">
                                            <span class="text_small">Вся одежда дают на +<img class="price_img" src="img/icons/beauty.png" />'
.$q_mpets['tren_1'].' больше красоты</span><br />Уровень: '.$q_mpets['tren_1'].' из 50<br />
                                        </span>
                                    </div>
                                    <span class="span3">
'
;
if(
$q_user['id']==$user['id']&&$q_mpets['tren_1']<=50)echo '<a href="?a=tren&tren=1" class="train_link"><span class="button_cont_full">Тренировать  за <img src="img/icons/heart.png" class="price_img"/>'.$tren_1.'</span></a></span>';
echo 
'
                    </div>
                </div>
            </div>
            <div class="block-bot">
                <div class="in1">&nbsp;</div><div class="in2">&nbsp;</div><div class="in3">&nbsp;</div>
            </div>
        </div>

'
;

/////Акксесуары 

echo '
<div class="simple-block">
                        <div class="block-top">
                            <div class="in1">&nbsp;</div><div class="in2">&nbsp;</div><div class="in3">&nbsp;</div>
                        </div>
                        <div class="block-mid">
                            <div class="in1">
                                <div class="in2">
                                    <img class="item_icon" src="img/glamur/2.png" />                                    <div class="text_item_slot">
                                        <span class="span1">
                                            Аксессуары <span class="darkgreen_link font_15">+<img src="img/icons/beauty.png" class="price_img" />'
.$q_mpets['tren_2'].'</span>                                        </span>
                                        <span class="span2">
                                            <span class="text_small">Все аксессуары дают на +<img class="price_img" src="img/icons/beauty.png" />'
.$q_mpets['tren_2'].' больше красоты</span><br />Уровень: '.$q_mpets['tren_2'].' из 50<br />
                                        </span>
                                    </div>
                                    <span class="span3">
'
;
if(
$q_user['id']==$user['id']&&$q_mpets['tren_2']<=50)echo '<a href="?a=tren&tren=2" class="train_link"><span class="button_cont_full">Тренировать  за <img src="img/icons/heart.png" class="price_img"/>'.$tren_2.'</span></a></span>';
echo 
'
                    </div>
                </div>
            </div>
            <div class="block-bot">
                <div class="in1">&nbsp;</div><div class="in2">&nbsp;</div><div class="in3">&nbsp;</div>
            </div>
        </div>

'
;
/////Украшения

echo '
<div class="simple-block">
                        <div class="block-top">
                            <div class="in1">&nbsp;</div><div class="in2">&nbsp;</div><div class="in3">&nbsp;</div>
                        </div>
                        <div class="block-mid">
                            <div class="in1">
                                <div class="in2">
                                    <img class="item_icon" src="img/glamur/3.png" />                                    <div class="text_item_slot">
                                        <span class="span1">
                                            Украшения <span class="darkgreen_link font_15">+<img src="img/icons/beauty.png" class="price_img" />'
.$q_mpets['tren_3'].'</span>                                        </span>
                                        <span class="span2">
                                            <span class="text_small">Все украшение дают на +<img class="price_img" src="img/icons/beauty.png" />'
.$q_mpets['tren_3'].' больше красоты</span><br />Уровень: '.$q_mpets['tren_3'].' из 50<br />
                                        </span>
                                    </div>
                                    <span class="span3">
'
;
if(
$q_user['id']==$user['id']&&$q_mpets['tren_3']<=50)echo '<a href="?a=tren&tren=3" class="train_link"><span class="button_cont_full">Тренировать  за <img src="img/icons/heart.png" class="price_img"/>'.$tren_3.'</span></a></span>';
echo 
'
                    </div>
                </div>
            </div>
            <div class="block-bot">
                <div class="in1">&nbsp;</div><div class="in2">&nbsp;</div><div class="in3">&nbsp;</div>
            </div>
        </div>

'
;


echo 
'<div class="c-block comment">Каждая тренировка одежды, аксессуаров и украшений увеличивает <span class="nowrap"><img src="img/icons/beauty.png" /> красоту</span> и <span class="nowrap"><img src="img/icons/glamour.png" /> гламур</span> на +1</div>';

break;
case 
'bonus':
$titles='Действующие бонусы';
include_once 
'head.php';

if (isset(
$_GET['id']))$q_mpets['id_user']=intval($_GET['id']);
else 
$q_mpets['id_user']=$mpets['id_user'];
$q_mpets=mysql_fetch_array(mysql_query("SELECT * FROM `mpets` WHERE `id_user`='".$q_mpets['id_user']."'"));
$q_user=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id`='".$q_mpets['id_user']."'"));
$q_bonus=mysql_fetch_array(mysql_query("SELECT * FROM `mpets_bonus` WHERE `id`='".$q_mpets['bonus']."'"));
function 
sictime($timediff){
$oneMinute=60
$oneHour=60*60
$oneDay=60*60*24
$dayfield=floor($timediff/$oneDay); 
$hourfield=floor(($timediff-$dayfield*$oneDay)/$oneHour); 
$minutefield=floor(($timediff-$dayfield*$oneDay-$hourfield*$oneHour)/$oneMinute); 
$secondfield=floor(($timediff-$dayfield*$oneDay-$hourfield*$oneHour-$minutefield*$oneMinute)); 
if(
$dayfield>0)$day=$dayfield.'д. ';
if(
$hourfield>0)$hour=$hourfield.'ч. ';
if(
$minutefield>0)$minut=$minutefield.'м. ';

$time_1="".$day.$hour." ".$minut." ".$secondfield." сек.";
return 
$time_1;
}




echo 
'<div class="simple-block"><div class="block-top"><div class="in1">&nbsp;</div><div class="in2">&nbsp;</div><div class="in3">&nbsp;</div></div><div class="block-mid"><div class="in1"><div class="in2"><span class="page_title">Действующие бонусы</span></div></div></div><div class="block-bot"><div class="in1">&nbsp;</div><div class="in2">&nbsp;</div><div class="in3">&nbsp;</div></div></div>';

if(
$q_mpets['bonus']!=0)
echo 
'
                                            <div class="simple-block">
                        <div class="block-top">
                            <div class="in1">&nbsp;</div><div class="in2">&nbsp;</div><div class="in3">&nbsp;</div>
                        </div>
                        <div class="block-mid">
                            <div class="in1"><div class="in2">
                            <img class="item_icon" src="img/bonus/'
.$q_mpets['bonus'].'.png" />
                            <div class="text_item">
                                <span class="span1">
                                    '
.$q_bonus['name'].'
                                </span>
                                <span class="span2">
                                    Осталось '
.sictime($q_mpets['bonus_time']-time()).'                                </span>
                            </div>
                        </div>
                        </div>
                </div>
            <div class="block-bot">
                <div class="in1">&nbsp;</div><div class="in2">&nbsp;</div><div class="in3">&nbsp;</div>
            </div>
        </div>
'
;
else echo 
'<div class="c-block large">Нет бонусов действующих в данный момент.</div>';



echo 
'<div class="c-block comment">Бонусы позволяют зарабатывать больше опыта и быстрее получать новые уровни.</div>';
echo 
'<div class="simple-block green"><div class="block-top"><div class="in1">&nbsp;</div><div class="in2">&nbsp;</div><div class="in3">&nbsp;</div></div><div class="block-mid"><div class="in1"><div class="in2"><a href="magaz.php"><img src="img/icons/shop.gif" />Магазины</a></div></div></div><div class="block-bot"><div class="in1">&nbsp;</div><div class="in2">&nbsp;</div><div class="in3">&nbsp;</div></div></div>';
break;
case 
'progul':
$titles='Прогулки';
include_once 
'head.php';

$q_progul=$mpets['progul']*30;
function 
sictime($timediff){
$oneMinute=60
$oneHour=60*60
$oneDay=60*60*24
$dayfield=floor($timediff/$oneDay); 
$hourfield=floor(($timediff-$dayfield*$oneDay)/$oneHour); 
$minutefield=floor(($timediff-$dayfield*$oneDay-$hourfield*$oneHour)/$oneMinute); 
$secondfield=floor(($timediff-$dayfield*$oneDay-$hourfield*$oneHour-$minutefield*$oneMinute)); 
if(
$dayfield>0)$day=$dayfield.'д. ';
if(
$hourfield>0)$hour=$hourfield.'ч. ';
if(
$minutefield>0)$minut=$minutefield.'м. ';

$time_1="".$day.$hour." ".$minut." ".$secondfield." сек.";
return 
$time_1;
}


if (isset(
$_GET['id']))
{
mysql_query("UPDATE `mpets` SET `progul` = '".intval($_GET['id'])."', `progul_time` = '".(time()+$_GET['id']*60*60)."' WHERE `id_user` = '".$user['id']."' LIMIT 1");
header("Location: info.php?a=progul");
}



echo 
'<div class="simple-block"><div class="block-top"><div class="in1">&nbsp;</div><div class="in2">&nbsp;</div><div class="in3">&nbsp;</div></div><div class="block-mid"><div class="in1"><div class="in2"><span class="page_title"><span class="orange_dark">'.$titles.'</span></span></div></div></div><div class="block-bot"><div class="in1">&nbsp;</div><div class="in2">&nbsp;</div><div class="in3">&nbsp;</div></div></div>';
if(
$mpets['progul_time']<=time()&&$mpets['progul']==0){
echo 
'<div class="c-block small orange_dark2">На прогулках питомец получает опыт . Чем дольше прогулка, тем больше награда!</div>';
echo 
'
<div class="c-block center large orange">
            <img src="img/travel.jpg" /><br />

                            <div class="travel">
                                                <a class="green_button_s2" href="?a=progul&id=1">Во двор</a>
                            <br />1 час                         <br />
                                                <a class="green_button_s2" href="?a=progul&id=2">В парк</a>
                            <br />2 часа                         <br />
                                                <a class="green_button_s2" href="?a=progul&id=3">В город</a>
                            <br />3 часа                         <br />
                                    </div>
                    </div>

'

}else if(
$mpets['progul_time']>=time()&&$mpets['progul']!=0)
echo 
'
                <div class="c-block center large orange">
            <img src="img/travel.jpg" /><br />

            <span class="blue_dark font_16">Питомец гуляет.<br />До конца прогулки осталось '
.sictime($mpets['progul_time']-time()).'</span>        </div>
'
;if($mpets['progul_time']<=time()&&$mpets['progul']!=0){
mysql_query("UPDATE `mpets` SET `progul` = '0',`opit` = '".($mpets['opit']+$q_progul)."' WHERE `id_user` = '".$user['id']."' LIMIT 1");

echo 
'
        
        <div class="warning-block large_orange"><span class="succes"><b>Прогулка завершена!</b></span><br /><span class="succes mar7t ib"><b>Награда:</b></span><span class="succes"><img class="price_img" src="img/icons/expirience.png" />'
.$q_progul.'<br /><span class="orange mar2">Предметов не найдено</span><br /><span class="ib mar7t"><a class="green_button_s" href="?a=progul">Гулять дальше</a></span></div>
'
;
}

break;
case 
'on':
$titles='Лучшие';
include_once 
'head.php';

$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `mpets`"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
echo 
'<div class="c-block large">';

$res mysql_query("select * from `mpets` ORDER BY `urov` DESC  LIMIT $start$set[p_str];");
while (
$post mysql_fetch_array($res)){
$ank=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id`='".$post['id_user']."'"));
if (!
$post['name'])$post_name=$ank['nick'];
else 
$post_name=htmlspecialchars($post['name']);

echo 
'<img class="price_img" src="img/avatar_s'.$ank['pol'].'.png" /> <a href="info.php?id='.$ank['id'].'" class="online_pet">'.$post_name.'</a> <img src="img/icons/up.png" />'.$post['urov'].'<br />';

}
echo 
'<center><div class="paging">';
if (
$k_page>1)str("?a=on&",$k_page,$page); // Вывод страниц
echo '</div></center>';
echo 
'</div>';

echo 
'<div class="c-block comment">Всего игроков - <span class="succes"><b>'.$k_post.'</b></span></div>';
break;
case 
'edit':
$titles='Изменить питомца';
include_once 
'head.php';

if(
$user['level']<3)header("Location: info.php?");
if (isset(
$_GET['id']))$q_mpets['id_user']=intval($_GET['id']);
else 
$q_mpets['id_user']=$mpets['id_user'];
$q_mpets=mysql_fetch_array(mysql_query("SELECT * FROM `mpets` WHERE `id_user`='".$q_mpets['id_user']."'"));
$q_user=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id`='".$q_mpets['id_user']."'"));
if (isset(
$_GET['vipolneno']))
echo 
'<div class="warning-block large_orange"><span class="succes">Успешно изменены</span></div>';

echo 
'<div class="c-block large">';

if (isset(
$_GET['set']) && isset($_POST['ok']))
{
mysql_query("UPDATE `mpets` SET `serd` = '".intval($_POST['serd'])."', `monet` = '".intval($_POST['monet'])."', `urov` = '".intval($_POST['urov'])."', `opit` = '".intval($_POST['opit'])."', `krasota` = '".intval($_POST['krasota'])."', `glamur` = '".intval($_POST['glamur'])."' WHERE `id_user` = '".$q_user['id']."' LIMIT 1");
header("Location: ?a=edit&id=".$q_user['id']."&vipolneno");
}

echo 
"<form method='post' action='?a=edit&id=$q_user[id]&set'>n";
echo 
"Сердец : <input type='text' name='serd' value='".$q_mpets['serd']."' maxlength='50' size='2' /><br />";
echo 
"Монет : <input type='text' name='monet' value='".$q_mpets['monet']."' maxlength='6'  size='2' /><br />";
echo 
"Уровень : <input type='text' name='urov' value='".$q_mpets['urov']."' maxlength='6'  size='2' /><br />";
echo 
"Опыт : <input type='text' name='opit' value='".$q_mpets['opit']."' maxlength='6'  size='2' /><br />";
echo 
"Красота : <input type='text' name='krasota' value='".$q_mpets['krasota']."' maxlength='6'  size='2' /><br />";
echo 
"Гламур : <input type='text' name='glamur' value='".$q_mpets['glamur']."' maxlength='6'  size='2' /><br />";
echo 
"<input type='submit' name='ok' value='Изменить' />n";
echo 
'</div><div class="c-block large">';
echo 
'<span class="nowrap"><img  class="price_img" src="img/avatar_s'.$q_user['pol'].'.png" /> Назад : <a class="darkgreen_link" href="info.php?id='.$q_user['id'].'">'.$q_user['nick'].'</a></span>';
echo 
'</div>';
break;
case 
'chat':
$titles='Чат';
include_once 
'head.php';

if (isset(
$_GET['del'])&&$user['level']>=3)
{
mysql_query("DELETE FROM `mpets_chat` WHERE `id` = '".intval($_GET['del'])."'");
echo 
'<div class="warning-block large_orange"><span class="succes">Успешно удалено!</span></div>';
}
if (isset(
$_POST['msg']))
{
if (
strlen2($_POST['msg'])<3){echo '<div class="warning-block large_orange"><span class="succes">Пустое сообшения!</span></div>';}
else{
mysql_query("INSERT INTO `mpets_chat` (id_user, time, msg) values('$user[id]', '$time', '".my_esc($_POST['msg'])."')");
mysql_query("UPDATE `user` SET `balls` = '".($user['balls']+1)."' WHERE `id` = '$user[id]' LIMIT 1");
}
}

echo 
'<div class="content"><div class="warning-block">';



$q_user=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id`='".mysql_real_escape_string($_GET['id'])."'"));
echo 
'<form action="?a=chat&'.$passgen.'" method="POST">';

if (isset(
$_GET['id'])&& $user['id']!=$_GET['id'])
echo 
'<input type="text" class="send_message" value="'.$q_user[nick].', " name="msg"/>';
else echo 
'<input type="text" class="send_message" value="" name="msg"/>';

echo
'
                <input type="hidden" name="page" value="2"/>
                <input type="hidden" name="club_id" value="0"/>
                <input type="submit" class="green" value="Отправить"/>
                <a class="refresh_link large" href="?a=chat&'
.$passgen.'">Обновить</a>
            </form>
'
;

$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `mpets_chat`"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
echo 
'<div class="posts">';
if (
$k_post==0)
{
echo 
'<div class="post_chat">Нет сообщений , будь первым!</div>';
}

$q=mysql_query("SELECT * FROM `mpets_chat` ORDER BY id DESC LIMIT $start$set[p_str]");
while (
$post mysql_fetch_assoc($q))
{
$ank=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id`='".mysql_real_escape_string($post['id_user'])."'"));

echo 
'<div class="post_chat"><img src="img/avatar_s'.$ank['pol'].'.png" class="pet_icon" /> <a href="info.php?id='.$ank['id'].'" class="pet_name">'.$ank['nick'].'</a>';

if (
$ank['date_last']>time()-600)
echo 
' <img class="price_img" src="img/icons/online.png" />';
if (
$user['id']!=$ank['id'])
echo 
' <a class="blue_color2" href="?a=chat&id='.$ank['id'].'">(»)</a>';
echo 
' : ';
echo 
output_text(htmlspecialchars($post['msg']))."n";
if (
$user['level']>=3)echo '[<a href="?a=chat&del='.$post['id'].'"><font color="red">уд.</font></a>]';

echo 
'</div>';
}
echo 
'<center><div class="paging">';
if (
$k_page>1)str("?a=chat&",$k_page,$page); // Вывод страниц
echo '</div></center>';

echo 
'</div></div></div>';
break;
case 
'bank':
$titles='Банк';
include_once 
'head.php';

if (isset(
$_GET['vipolneno']))echo '<div class="warning-block large_orange"><span class="succes">Успешно выполнено!</span></div>';
echo 
'<div class="c-block large">';
if (isset(
$_GET['set']) && isset($_POST['ok']))
{
$monet=intval($_POST['monet'])*100;
if (
$monet<0)$err='Короткое цена!';
if (
$user['balls']<$monet)$err='Недостаточно баллов!';
if (!isset(
$err))
{
mysql_query("UPDATE `mpets` SET `monet` = '".intval($mpets['monet']+$_POST['monet'])."' WHERE `id_user` = '".$user['id']."' LIMIT 1");
mysql_query("UPDATE `user` SET `balls` = '".intval($user['balls']-$monet)."' WHERE `id` = '".$user['id']."' LIMIT 1");
header("Location: ?a=bank&vipolneno");
}
}
err();
echo 
"<form method='post' action='?a=bank&set'>n";
echo 
"У вас $user[balls] баллов и $mpets[monet] монет.<br /> Поменять монеты по курсу 1 монета = 100 баллов<br />";
echo 
"Монет :<br /><input type='text' name='monet' value='' maxlength='10' /><br />";
echo 
"<input class='doctor' type='submit' name='ok' value='Купить' />n";


echo 
'</div>';

break;
case 
'name':
$titles='Настройки питомца';
include_once 
'head.php';

if (isset(
$_GET['vipolneno']))echo '<div class="warning-block large_orange"><span class="succes">Успешно выполнено!</span></div>';

if (!
$mpets['name'])
echo 
'
<div class="c-block large orange_dark2"><center>
                    <img src="img/welcome.png" />                <br />
                Привет! Я твой питомец, люби и ухаживай за мной и я отплачу тебе любовью, преданностью и победами на конкурсах!
            </centter></div>
'
;

if (isset(
$_GET['set']) && isset($_POST['ok']))
{
$name=mysql_real_escape_string(htmlspecialchars($_POST['name']));
if(
strlen2($name)<3)$err[]='<div class="warning-block large_orange"><span class="succes">Название не менее 3 символов</span></div>';
if(
strlen2($name)>20)$err[]='<div class="warning-block large_orange"><span class="succes">Название не более 20 символов</span></div>';
if (!isset(
$err))
{
mysql_query("UPDATE `mpets` SET `name` = '".$name."', `pol` = '".intval($_POST['pol'])."' WHERE `id_user` = '".$user['id']."' LIMIT 1");
header("Location: index.php");
}
}
err();

echo 
'<div class="c-block large">';
echo 
"<form method='post' action='?a=name&set'>n";
echo 
"Имя питомца <br /><input type='text' name='name' value='".$mpets['name']."' maxlength='20' /><br />";
echo 
"Пол питомца :<br/> <select name='pol'><option value='1'>Мужской</option><option value='0'>Женский</option></select><br/>";
echo 
"<input class='doctor' type='submit' name='ok' value='Сохранить' />n";


echo 
'</div>';
break;
exit;
}
include_once 
'foot.php';
?>
Онлайн: 2
Реклама