Файл: test.masteram.us/games/kaktuz/kaktuz.php
Строк: 101
<?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:/index.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 д. $hourfield ч. $minutefield м. $secondfield c. ";
return $time_1;
}
$id=abs(intval($_GET['id']));
echo "<div class='aut'>Кактусомания</div>";
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `kaktuz` WHERE `id`='".$id."'"),0)!='0'){
$id=abs(intval($_GET['id']));
$all_kaktuz=mysql_fetch_array(mysql_query("SELECT * FROM `kaktuz` WHERE `id`='".$id."'"));
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;
}
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>";
}
echo "<div class='aut'>Информация</div>";
echo "Хозяин : <a href='/info.php?id=".$all_kaktuz['id_u']."'>".mysql_result(mysql_query("SELECT `nick` FROM `user` WHERE `id`='".$all_kaktuz['id_u']."'"),0)."</a><br/>
Здоровье : ".$all_kaktuz['zdor']." %<br/>";
echo "Стоимость : ".intval($all_kaktuz['rost']*5)." монет<br/>";
if($all_kaktuz['id_u']==$user['id']){
echo "<a href='prodat.php?id=".$all_kaktuz['id']."'>Продать</a><br/>";
}
}
echo "<div class='aut'><a href='index.php'>Назад</a></div>";
include_once '../../sys/inc/tfoot.php';
?>