Файл: test.masteram.us/games/kaktuz/index.php
Строк: 112
<?php
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';
$set['title']='Кактусомания';
include_once '../../sys/inc/thead.php';
title();
if(!isset($user)){
header("Location:/aut.php");
break;
}
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));
$time_1="$dayfield дней";
return $time_1;
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `kaktuz` WHERE `id_u`='".$user['id']."'"),0)=='0'){
mysql_query("INSERT INTO `kaktuz`(`id_u`, `time_l`, `date_r`) VALUES('".$user['id']."', '".time()."', '".time()."')");
header("location:index.php?".$passgen."");
exit;
}
$kaktuz_kol=mysql_result(mysql_query("SELECT COUNT(*) FROM `kaktuz` WHERE `id_u`='".$user['id']."'"),0);
$k_page=k_page($kaktuz_kol,1);
$page=page($k_page);
$start=1*$page-1;
$all_kaktuz=mysql_fetch_array(mysql_query("SELECT * FROM `kaktuz` WHERE `id_u`='".$user['id']."' LIMIT $start,1"));
if($all_kaktuz['zdor']>='80'){
$ras='.png';
}
elseif($all_kaktuz['zdor']<='79' && $all_kaktuz['zdor']>='50'){
$ras='_n.png';
}
elseif($all_kaktuz['zdor']<='49'){
$ras='_y.png';
}
if(time()-$all_kaktuz['time_l']>='172800'){
mysql_query("UPDATE `kaktuz` SET `zdor`=`zdor`-20 WHERE `id`='".$all_kaktuz['id']."' LIMIT 1");
}
elseif(time()-$all_kaktuz['time_l']>='691200'){
mysql_query("UPDATE `kaktuz` SET `zdor`=`zdor`-100 WHERE `id`='".$all_kaktuz['id']."' LIMIT 1");
}
mysql_query("UPDATE `kaktuz` SET `time_l`='".time()."' WHERE `id`='".$all_kaktuz['id']."' LIMIT 1");
if($all_kaktuz['zdor']<='0'){
mysql_query("DELETE FROM `kaktuz` WHERE `id`='".$all_kaktuz['id']."' LIMIT 1");
header("location:index.php?$passgen");
exit;
}
echo "<div class='aut'><center>";
if($all_kaktuz['time_p']<time()){
echo "<a href='poliv.php?id=".$all_kaktuz['id']."'><img src='img/pol.png' alt='полив'/></a>";
}
else
{
echo "<a href='poliv.php?id=".$all_kaktuz['id']."'><img src='img/pol_isp.png' alt='полив'/></a>";
}
if($all_kaktuz['time_y']<time()){
echo "<a href='ydob.php?id=".$all_kaktuz['id']."'><img src='img/yd.png' alt='удоб'/></a>";
}
else
{
echo "<a href='ydob.php?id=".$all_kaktuz['id']."'><img src='img/yd_isp.png' alt='удоб'/></a>";
}
if($all_kaktuz['time_r']<time()){
echo "<a href='rez.php?id=".$all_kaktuz['id']."'><img src='img/rez.png' alt='подстричь'/></a>";
}
else
{
echo "<a href='rez.php?id=".$all_kaktuz['id']."'><img src='img/rez_isp.png' alt='подстричь'/></a>";
}
if($all_kaktuz['tekila']!='0'){
echo "<a href='tekila.php?id=".$all_kaktuz['id']."'><img src='img/tek.png' alt='текила'/></a>";
}
else
{
echo "<a href='tekila.php?id=".$all_kaktuz['id']."'><img src='img/tek_isp.png' alt='текила'/></a>";
}
if($all_kaktuz['vitamin']!='0'){
echo "<a href='v.php?id=".$all_kaktuz['id']."'><img src='img/vit.png' alt='витамин'/></a>";
}
else
{
echo "<a href='v.php?id=".$all_kaktuz['id']."'><img src='img/vit_isp.png' alt='витамин'/></a>";
}
echo "</center></div>";
if($all_kaktuz['rost']<='10'){
echo '<center><table width="210" height="155" style="color: white; background-image: url(img/background.png);" border="0">';
echo "<td valign='bottom'><a href='kaktuz.php?id=".$all_kaktuz['id']."'><img src='img/kaktuz_small_small".$ras."' alt='kaktuz'/></a><br/><b>Высота вашего кактуса : ".$all_kaktuz['rost']." см, и ему уже ".sictime(time()-$all_kaktuz['date_r'])."</b></td></table></center>";
}
elseif($all_kaktuz['rost']>'10' && $all_kaktuz['rost']<='100'){
echo '<center><table width="210" height="155" style="color: white; background-image: url(img/background.png);" border="0">';
echo "<td valign='bottom'><a href='kaktuz.php?id=".$all_kaktuz['id']."'><img src='img/kaktuz_small".$ras."' alt='kaktuz'/></a><br/><b>Высота вашего кактуса : ".$all_kaktuz['rost']." см, и ему уже ".sictime(time()-$all_kaktuz['date_r'])."</b></td></table></center>";
}
elseif($all_kaktuz['rost']>'100' && $all_kaktuz['rost']<='200'){
echo '<center><table width="210" height="155" style="color: white; background-image: url(img/background.png);" border="0">';
echo "<td valign='bottom'><a href='kaktuz.php?id=".$all_kaktuz['id']."'><img src='img/kaktuz_normal".$ras."' alt='kaktuz'/></a><br/><b>Высота вашего кактуса : ".$all_kaktuz['rost']." см, и ему уже ".sictime(time()-$all_kaktuz['date_r'])."</b></td></table></center>";
}
elseif($all_kaktuz['rost']>'200'){
echo '<center><table width="210" height="155" style="color: white; background-image: url(img/background.png);" border="0">';
echo "<td valign='bottom'><a href='kaktuz.php?id=".$all_kaktuz['id']."'><img src='img/kaktuz_big".$ras."' alt='kaktuz'/></a><br/><b>Высота вашего кактуса : ".$all_kaktuz['rost']." см, и ему уже ".sictime(time()-$all_kaktuz['date_r'])."</b></td></table></center>";
}
if($k_page>1)str('?',$k_page,$page);
echo "<div class='aut'>Действия</div>";
echo "<img src='img/top.png' alt='kaktuz'/><a href='top.php'>Топ</a><br/>";
echo "<img src='img/add.png' alt='kaktuz'/><a href='new.php'>Купить кактус</a><br/>";
echo "<img src='img/buy.png' alt='kaktuz'/><a href='buy.php?id=".$all_kaktuz['id']."'>Магазин</a><br/>";
include_once '../../sys/inc/tfoot.php';
?>