Вход Регистрация
Файл: setk/mpets/index.php
Строк: 412
<?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';

$titles='Удивительные питомцы';
include_once 
'head.php'//Шапка

////Создания питомца
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `mpets` WHERE `id_user` = '$user[id]'"),0) == '0'){
mysql_query("INSERT INTO `mpets` (`id_user`,`opit_dop`) VALUES  ( '".$user['id']."','3') ");

mysql_query("INSERT INTO `mpets_veshi` (`id_user`,`nomer`,`vid`) VALUES  ( '".$user['id']."','1','1') ");
mysql_query("INSERT INTO `mpets_veshi` (`id_user`,`nomer`,`vid`) VALUES  ( '".$user['id']."','2','1') ");
mysql_query("INSERT INTO `mpets_veshi` (`id_user`,`nomer`,`vid`) VALUES  ( '".$user['id']."','3','2') ");
mysql_query("INSERT INTO `mpets_veshi` (`id_user`,`nomer`,`vid`) VALUES  ( '".$user['id']."','4','2') ");
mysql_query("INSERT INTO `mpets_veshi` (`id_user`,`nomer`,`vid`) VALUES  ( '".$user['id']."','5','3') ");
mysql_query("INSERT INTO `mpets_veshi` (`id_user`,`nomer`,`vid`) VALUES  ( '".$user['id']."','6','3') ");

header("Location: info.php?a=name");
exit;
}

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;
}


$eda=mysql_fetch_array(mysql_query("SELECT * FROM `mpets_eda` WHERE `id`='$mpets[eda]'"));
$igra=mysql_fetch_array(mysql_query("SELECT * FROM `mpets_igra` WHERE `id`='$mpets[igra]'"));
if(
$mpets['konkurs']!=0)
$konkurs_zvz=", `konkurs_zvz` = '".($mpets['konkurs_zvz']+1)."'";


//////Разбудить питомца
if (isset($_GET['razbudit']))
{
if (
$mpets['monet']<25){
echo 
'<div class="warning-block large_orange"><span class="succes blocks">У вас не достаточно монет!</span></div>';
}else {
mysql_query("UPDATE `mpets` SET `ustal` = '0', `monet` = '".($mpets['monet']-25)."', `igra_time` = '".time()."', `eda_time` = '".time()."' WHERE `id_user` = '".$user['id']."' LIMIT 1");
header("Location: index.php?");
}
}

//////Добавление игр
if (isset($_GET['igra']))
{
if (
$mpets['igra_time']>=time()){
header("Location: index.php?");
exit;
}
$bonus_magaz_igra=mysql_fetch_array(mysql_query("SELECT * FROM `mpets_bonus` WHERE `id`='".intval($mpets['bonus'])."'"));
$mpets_bonus_proc_igra=$igra['opit']/100*$bonus_magaz_igra['proc'];
if(
$mpets['bonus_time']>=time())
$mpets_bonus_igra=$igra['opit']+$mpets_bonus_proc_igra;
else 
$mpets_bonus_igra=$igra['opit'];

if (isset(
$_GET['ok'])){
echo 
'<div class="warning-block large_orange"> <img class="price_img" src="img/icons/heart.png" /> Сердечки +'.$igra['serd'].' <img class="price_img" src="img/icons/expirience.png" /> Опыт +'.$mpets_bonus_igra.' </div>';
}else{
mysql_query("UPDATE `mpets` SET `serd` = '".($mpets['serd']+$igra['serd'])."', `opit` = '".($mpets['opit']+$mpets_bonus_igra)."', `igra_proc` = '".($mpets['igra_proc']+20)."',`ustal` = '".($mpets['ustal']+1)."'$konkurs_zvz WHERE `id_user` = '".$user['id']."' LIMIT 1");
header("Location: index.php?igra&ok");
}
}



////Добавление еды
if (isset($_GET['eda']))
{
if (
$mpets['eda_time']>=time()){
header("Location: index.php?");
exit;
}

if(
$mpets['eda_proc']>=100){
mysql_query("UPDATE `mpets` SET `eda_proc` = '0', `eda_time` = '".(time()+60)."' WHERE `id_user` = '".$user['id']."' LIMIT 1");
header("Location: index.php?");
}
$bonus_magaz=mysql_fetch_array(mysql_query("SELECT * FROM `mpets_bonus` WHERE `id`='".intval($mpets['bonus'])."'"));
$mpets_bonus_proc=$eda['opit']/100*$bonus_magaz['proc'];
if(
$mpets['bonus_time']>=time())
$mpets_bonus=$eda['opit']+$mpets_bonus_proc;
else 
$mpets_bonus=$eda['opit'];

if (isset(
$_GET['ok'])){
echo 
'<div class="warning-block large_orange"> <img class="price_img" src="img/icons/heart.png" /> Сердечки +'.$eda['serd'].' <img class="price_img" src="img/icons/expirience.png" /> Опыт +'.$mpets_bonus.' </div>';
}else{
mysql_query("UPDATE `mpets` SET `serd` = '".($mpets['serd']+$igra['serd'])."', `opit` = '".($mpets['opit']+$mpets_bonus)."', `eda_proc` = '".($mpets['eda_proc']+20)."',`ustal` = '".($mpets['ustal']+1)."'$konkurs_zvz WHERE `id_user` = '".$user['id']."' LIMIT 1");
header("Location: index.php?eda&ok");
}
}



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">'
;
if(
$mpets['eda_time']>=time())
echo 
'<div class="text_disabled">
                                <span class="span1">Захочу есть через '
.sictime($mpets['eda_time']-time()).' </span>';


else{
echo 
'                                                        <a href="?eda"><img src="img/eda/'.$mpets['eda'].'.png" /></a>                            <div class="text">
                                <span class="span1"><a class="food_color" href="?eda">'
.$eda['name_vid'].'</a><span class="light_blue">Сытость '.$mpets['eda_proc'].'%<br /></span>
'
;
$eda_new_kypit=mysql_fetch_array(mysql_query("SELECT * FROM `mpets_eda` WHERE `id`='".($mpets['eda']+1)."'"));
if(
$mpets['urov']>=$eda_new_kypit['urov'])
echo 
'<span class="play_new">Нужно купить <a class="play_new" href="magaz.php?a=eda">'.$eda_new_kypit['name'].'</a></span>';
}

echo 
'<span class="food_new"></span></span>                            </div>


'
;


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>
'
;


if(
$mpets['igra_proc']>=100){
mysql_query("UPDATE `mpets` SET `igra_proc` = '0', `igra_time` = '".(time()+60)."' WHERE `id_user` = '".$user['id']."' LIMIT 1");
header("Location: index.php?");
}
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">'
;
if(
$mpets['igra_time']>=time())
echo 
'<div class="text_disabled">
                                <span class="span1">Захочу играть через '
.sictime($mpets['igra_time']-time()).' </span>';


else{
echo 
'                                                        <a href="?igra"><img src="img/igra/'.$mpets['igra'].'.png" /></a>                            <div class="text">
                                <span class="span1"><a class="food_color" href="?igra">'
.$igra['name_vid'].'</a><span class="light_blue">Настроение '.$mpets['igra_proc'].'%<br /></span>
'
;

$igra_new_kypit=mysql_fetch_array(mysql_query("SELECT * FROM `mpets_igra` WHERE `id`='".($mpets['igra']+1)."'"));
if(
$mpets['urov']>=$igra_new_kypit['urov'])
echo 
'<span class="play_new">Нужно купить <a class="play_new" href="magaz.php?a=igra">'.$igra_new_kypit['name'].'</a></span>';
}

echo 
'<span class="food_new"></span></span>                            </div>
'
;

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>
'
;


////Конкурсы
if($mpets['konkurs']!=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">'
;
$konkurss=mysql_fetch_array(mysql_query("SELECT * FROM `mpets_konk` WHERE `id`='".$mpets['konkurs']."'"));
if (
$mpets['konkurs_zvz']>=$konkurss['zvez'])header("Location: konkurs.php?a=info&id=".$mpets['konkurs']."");
echo 
'                                                        <a href="konkurs.php?a=info&id='.$mpets['konkurs'].'"><img src="img/kub/'.$konkurss['kub'].'.png" /></a>                            <div class="text">
<span class="span1"><a class="food_color" href="konkurs.php?a=info&id='
.$mpets['konkurs'].'">'.$konkurss['name'].'</a>
<span class="light_blue">У вас '
.$mpets['konkurs_zvz'].' <img class="price_img" src="img/zvezda.png" /><br /></span>
<span class="light_blue">Нужно собрать '
.$konkurss['zvez'].' <img class="price_img" src="img/zvezda.png" /><br /></span>

'
;


echo 
'<span class="food_new"></span></span>                            </div>
'
;

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>
'
;
}
////Конец конкурсы



if($mpets['ustal']=='-1')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="nd" href="?razbudit"> <div class="text_disabled"> <span class="span1"><span class="green_color">Разбудить за <img class="price_img" src="img/icons/coin.png" />25</span></span>    </div></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="konkurs.php?"><img src="img/zvezda.png" />Конкурсы ('.mysql_result(mysql_query("SELECT COUNT(*) FROM `mpets_konk` WHERE `pobed`='0'"),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=progul"><img src="img/icons/travel.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"><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>';
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>';
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="info.php?a=on"><img src="img/icons/best.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 href="info.php?a=bank"><img src="img/icons/coin.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 href="info.php?a=chat"><img src="img/icons/talk.png" />Игровой чат ('.mysql_result(mysql_query("SELECT COUNT(*) FROM `mpets_chat` ",$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>';



include_once 
'foot.php';//Ноги 



?> /
Онлайн: 1
Реклама