Внедрение шаблонизатора.

This commit is contained in:
Igor Barkov (iwork) 2020-09-30 17:51:59 +03:00
parent f75a07aa07
commit 885300ab05

View File

@ -1,42 +1,44 @@
<?php <?php
session_start(); session_start();
if(empty($_SESSION['uid'])) { exit;} if (empty($_SESSION['uid'])) {
exit;
}
require_once "functions.php"; require_once "functions.php";
if($user->room == 51) { header('location: city.php'); exit; } if ($user->room == 51) {
header('location: city.php');
exit;
}
if($_GET['go'] == 'vixod') { if ($_GET['go'] == 'vixod') {
$les_login = mysql_fetch_array(mysql_query("SELECT `room` FROM `les_game` WHERE `owner` = '".$user['id']."' LIMIT 1")); $les_login = mysql_fetch_array(mysql_query("SELECT `room` FROM `les_game` WHERE `owner` = '" . $user['id'] . "' LIMIT 1"));
if($les_login['room'] == 'G8') { if ($les_login['room'] == 'G8') {
mysql_query("UPDATE `users`,`online` SET `users`.`room` = '51', `online`.`room` = '51' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '".$user['id']."'"); mysql_query("UPDATE `users`,`online` SET `users`.`room` = '51', `online`.`room` = '51' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '" . $user['id'] . "'");
mysql_query("DELETE FROM `les_res` WHERE `owner` = '".$user['id']."' LIMIT 1"); mysql_query("DELETE FROM `les_res` WHERE `owner` = '" . $user['id'] . "' LIMIT 1");
} }
} }
$tes = mysql_query("SELECT * FROM `les_res` WHERE `owner` = '".$user['id']."'"); $tes = mysql_query("SELECT * FROM `les_res` WHERE `owner` = '" . $user['id'] . "'");
if(!$les_res = mysql_fetch_array($tes)) { if (!$les_res = mysql_fetch_array($tes)) {
$i = 0; $i = 0;
while($i++ < 25) { while ($i++ < 25) {
$res = array('', 'Silver Nugget', 'Stem', 'Animal Bone', 'Suede', 'Iron Ore', 'Silver Nugget', 'Stem', 'Animal Bone', 'Suede', 'Iron Ore', 'Silver Nugget', 'Stem', 'Animal Bone', 'Suede', 'Iron Ore', 'Silver Nugget', 'Stem', 'Animal Bone', 'Suede', 'Iron Ore', 'Silver Nugget', 'Stem', 'Animal Bone', 'Suede', 'Iron Ore'); $res = ['', 'Silver Nugget', 'Stem', 'Animal Bone', 'Suede', 'Iron Ore', 'Silver Nugget', 'Stem', 'Animal Bone', 'Suede', 'Iron Ore', 'Silver Nugget', 'Stem', 'Animal Bone', 'Suede', 'Iron Ore', 'Silver Nugget', 'Stem', 'Animal Bone', 'Suede', 'Iron Ore', 'Silver Nugget', 'Stem', 'Animal Bone', 'Suede', 'Iron Ore'];
$img = array('', 'Silver_Nugget.jpg', 'Stem.jpg', 'Animal_Bone.jpg', 'Suede.jpg', 'Iron_Ore.jpg', 'Silver_Nugget.jpg', 'Stem.jpg', 'Animal_Bone.jpg', 'Suede.jpg', 'Iron_Ore.jpg', 'Silver_Nugget.jpg', 'Stem.jpg', 'Animal_Bone.jpg', 'Suede.jpg', 'Iron_Ore.jpg', 'Silver_Nugget.jpg', 'Stem.jpg', 'Animal_Bone.jpg', 'Suede.jpg', 'Iron_Ore.jpg', 'Silver_Nugget.jpg', 'Stem.jpg', 'Animal_Bone.jpg', 'Suede.jpg', 'Iron_Ore.jpg'); $img = ['', 'Silver_Nugget.jpg', 'Stem.jpg', 'Animal_Bone.jpg', 'Suede.jpg', 'Iron_Ore.jpg', 'Silver_Nugget.jpg', 'Stem.jpg', 'Animal_Bone.jpg', 'Suede.jpg', 'Iron_Ore.jpg', 'Silver_Nugget.jpg', 'Stem.jpg', 'Animal_Bone.jpg', 'Suede.jpg', 'Iron_Ore.jpg', 'Silver_Nugget.jpg', 'Stem.jpg', 'Animal_Bone.jpg', 'Suede.jpg', 'Iron_Ore.jpg', 'Silver_Nugget.jpg', 'Stem.jpg', 'Animal_Bone.jpg', 'Suede.jpg', 'Iron_Ore.jpg'];
$otdel = rand(1, 9); $otdel = rand(1, 9);
$komnata = rand(0, 7); $komnata = rand(0, 7);
$kmn[1] = array('A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'A8'); $kmn[1] = ['A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'A8'];
$kmn[2] = array('B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8'); $kmn[2] = ['B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8'];
$kmn[3] = array('C1', 'C2', 'C3', 'C4', 'C5', 'C6', 'C7', 'C8'); $kmn[3] = ['C1', 'C2', 'C3', 'C4', 'C5', 'C6', 'C7', 'C8'];
$kmn[4] = array('D1', 'D2', 'D3', 'D4', 'D5', 'D6', 'D7', 'D8'); $kmn[4] = ['D1', 'D2', 'D3', 'D4', 'D5', 'D6', 'D7', 'D8'];
$kmn[5] = array('E1', 'E2', 'E3', 'E4', 'E5', 'E6', 'E7', 'E8'); $kmn[5] = ['E1', 'E2', 'E3', 'E4', 'E5', 'E6', 'E7', 'E8'];
$kmn[6] = array('F1', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8'); $kmn[6] = ['F1', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8'];
$kmn[7] = array('G1', 'G2', 'G3', 'G4', 'G5', 'G6', 'G7', 'G8'); $kmn[7] = ['G1', 'G2', 'G3', 'G4', 'G5', 'G6', 'G7', 'G8'];
$kmn[8] = array('H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'H7', 'H8'); $kmn[8] = ['H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'H7', 'H8'];
$kmn[9] = array('I1', 'I2', 'I3', 'I4', 'I5', 'I6', 'I7', 'I8'); $kmn[9] = ['I1', 'I2', 'I3', 'I4', 'I5', 'I6', 'I7', 'I8'];
mysql_query("INSERT INTO les_res (`owner`, `name`, `img`, `kom`) VALUES ('".$user['id']."', '".$res[$i]."', '".$img[$i]."', '".$kmn[$otdel][$komnata]."')"); mysql_query("INSERT INTO les_res (`owner`, `name`, `img`, `kom`) VALUES ('" . $user['id'] . "', '" . $res[$i] . "', '" . $img[$i] . "', '" . $kmn[$otdel][$komnata] . "')");
} }
} }
#nick99($user['id']);
$rand = rand(25, 100); $rand = rand(25, 100);
$rbot = rand(1, 5); $rbot = rand(1, 5);
$bots[1] = 'Медведь'; $bots[1] = 'Медведь';
@ -44,189 +46,205 @@ $bots[2] = 'Заяц';
$bots[3] = 'Лось'; $bots[3] = 'Лось';
$bots[4] = 'Волк'; $bots[4] = 'Волк';
$bots[5] = 'Лесник'; $bots[5] = 'Лесник';
if($rand < 15 && $user['battle'] == 0) { if ($rand < 15 && $user['battle'] == 0) {
$sex = mysql_query("SELECT `id`, `maxhp` FROM `users` WHERE `login` = '".$bots[$rbot]."' LIMIT 1"); $sex = mysql_query("SELECT `id`, `maxhp` FROM `users` WHERE `login` = '" . $bots[$rbot] . "' LIMIT 1");
$dded = mysql_fetch_array($sex); $dded = mysql_fetch_array($sex);
mysql_query("INSERT INTO `bots` (`name`, `prototype`, `battle`, `hp`) VALUES ('".$bots[$rbot]."', '".$dded["id"]."', '', '".$dded["maxhp"]."')"); mysql_query("INSERT INTO `bots` (`name`, `prototype`, `battle`, `hp`) VALUES ('" . $bots[$rbot] . "', '" . $dded["id"] . "', '', '" . $dded["maxhp"] . "')");
$bot = mysql_insert_id(); $bot = mysql_insert_id();
$teams = array(); $teams = [];
$teams[$user['id']][$bot] = array(0, 0, time()); $teams[$user['id']][$bot] = [0, 0, time()];
$teams[$bot][$user['id']] = array(0, 0, time()); $teams[$bot][$user['id']] = [0, 0, time()];
mysql_query("INSERT INTO `battle`(`teams`, `timeout`, `type`, `status`, `t1`, `t2`, `to1`, `to2`) VALUES ('".serialize($teams)."', '3', '1', '0', '".$user['id']."', '".$bot."', '".time()."', '".time()."')"); mysql_query("INSERT INTO `battle`(`teams`, `timeout`, `type`, `status`, `t1`, `t2`, `to1`, `to2`) VALUES ('" . serialize($teams) . "', '3', '1', '0', '" . $user['id'] . "', '" . $bot . "', '" . time() . "', '" . time() . "')");
$id = mysql_insert_id(); $id = mysql_insert_id();
mysql_query("UPDATE `bots` SET `battle` = {$id} WHERE `id` = {$bot} LIMIT 1"); mysql_query("UPDATE `bots` SET `battle` = {$id} WHERE `id` = {$bot} LIMIT 1");
$rr = "<b>".Nick::id($user['id'])->full(1)."</b> и <b>".Nick::id($bot)->full(1)."</b>"; $rr = "<b>" . Nick::id($user['id'])->full(1) . "</b> и <b>" . Nick::id($bot)->full(1) . "</b>";
addlog($id,"Часы показывали <span class=date>".date("Y.m.d H.i")."</span>, когда ".$rr." бросили вызов друг другу. <br />"); addlog($id, "Часы показывали <span class=date>" . date("Y.m.d H.i") . "</span>, когда " . $rr . " бросили вызов друг другу. <br />");
mysql_query("UPDATE `users` SET `battle` = {$id}, `zayavka` = 0 WHERE `id` = '".$user['id']."' LIMIT 1"); mysql_query("UPDATE `users` SET `battle` = {$id}, `zayavka` = 0 WHERE `id` = '" . $user['id'] . "' LIMIT 1");
addchp ('<b style="color:#990000">Внимание!</b> На вас напал "'.$bots[$rbot].'". ','{[]}'.Nick::id($user["id"])->short().'{[]}'); addchp('<b style="color:#990000">Внимание!</b> На вас напал "' . $bots[$rbot] . '". ', '{[]}' . Nick::id($user["id"])->short() . '{[]}');
} }
if ($user['battle'] > 0) {
if($user['battle'] > 0) { header('location: fbattle.php'); exit; } header('location: fbattle.php');
exit;
$les_login = mysql_fetch_array(mysql_query("SELECT * FROM `les_game` WHERE `owner` = '".$user['id']."' LIMIT 1"));
$rooms = array("A1" => array('20', '', 'A2', '', 'B1'), "A2" => array('15', 'A1', 'A3', '', ''), "A3" => array('15', 'A2', '', '', ''), "A4" => array('15', '', 'A5', '', 'B4'), "A5" => array('15', 'A4', '', '', 'B5'), "A6" => array('15', '', 'A7', '', 'B6'), "A7" => array('15', 'A6', 'A8', '', ''), "A8" => array('15', 'A7', '', '', 'B8'), "B1" => array('20', '', '', 'A1', ''), "B2" => array('15', '', 'B3', '', 'C2'), "B3" => array('15', 'B2', 'B4', '', ''), "B4" => array('15', 'B3', '', 'A4', ''), "B5" => array('15', '', 'B6', 'A5', ''), "B6" => array('15', 'B5', 'B7', 'A6', ''), "B7" => array('15', 'B6', '', '', 'C7'), "B8" => array('15', '', '', 'A8', 'C8'), "C1" => array('20', '', '', '', 'D1'), "C2" => array('15', '', 'C3', 'B2', 'D2'), "C3" => array('15', 'C2', '', '', 'D3'), "C4" => array('15', '', '', '', 'D4'), "C5" => array('15', '', '', '', 'D5'), "C6" => array('15', '', 'C7', '', ''), "C7" => array('15', 'C6', 'C8', 'B7', ''), "C8" => array('15', 'C7', '', 'B8', 'D8'), "D1" => array('20', '', 'D2', 'C1', 'E1'), "D2" => array('15', 'D1', 'D3', 'C2', 'E2'), "D3" => array('15', 'D2', 'D4', 'C3', 'E3'), "D4" => array('15', 'D3', 'D5', 'C4', 'E4'), "D5" => array('15', 'D4', '', 'C5', ''), "D6" => array('15', '', 'D7', '', 'E6'), "D7" => array('15', 'D6', '', '', ''), "D8" => array('15', '', '', 'C8', 'E8'), "E1" => array('20', '', 'E2', 'D1', 'F1'), "E2" => array('15', 'E1', 'E3', 'D2', 'F2'), "E3" => array('15', 'E2', 'E4', 'D3', 'F3'), "E4" => array('15', 'E3', 'E5', 'D4', 'F4'), "E5" => array('15', 'E4', 'E6', '', 'F5'), "E6" => array('15', 'E5', '', 'D6', ''), "E7" => array('15', '', 'E8', '', 'F7'), "E8" => array('15', 'E7', '', 'D8', 'F8'), "F1" => array('20', '', 'F2', 'E1', 'G1'), "F2" => array('15', 'F1', 'F3', 'E2', 'G2'), "F3" => array('15', 'F2', 'F4', 'E3', 'G3'), "F4" => array('15', 'F3', 'F5', 'E4', 'G4'), "F5" => array('15', 'F4', '', 'E5', 'G5'), "F6" => array('15', '', '', '', 'G6'), "F7" => array('15', '', '', 'E7', 'G7'), "F8" => array('15', '', '', 'E8', 'G8'), "G1" => array('20', '', '', 'F1', 'H1'), "G2" => array('15', '', '', 'F2', ''), "G3" => array('15', '', '', 'F3', ''), "G4" => array('15', '', '', 'F4', ''), "G5" => array('15', '', 'G6', 'F5', ''), "G6" => array('15', 'G5', 'G7', 'F6', ''), "G7" => array('15', 'G6', 'G8', 'F7', ''), "G8" => array('15', 'G7', '', 'F8', 'H8'), "H1" => array('20', '', 'H2', 'G1', 'I1'), "H2" => array('15', 'H1', '', '', 'I2'), "H3" => array('15', '', '', '', 'I3'), "H4" => array('15', '', 'H5', '', 'I4'), "H5" => array('15', 'H4', '', '', 'I5'), "H6" => array('15', '', 'H7', '', 'I6'), "H7" => array('15', 'H6', '', '', 'I7'), "H8" => array('15', 'H7', '', 'G8', 'I8'), "I1" => array('20', '', 'I2', 'H1', ''), "I2" => array('15', 'I1', 'I3', 'H2', ''), "I3" => array('15', 'I2', 'I4', 'H3', ''), "I4" => array('15', 'I3', 'I5', 'H4', ''), "I5" => array('15', 'I4', 'I6', 'H5', ''), "I6" => array('15', 'I5', 'I7', 'H6', ''), "I7" => array('15', 'I6', 'I8', 'H7', ''), "I8" => array('15', 'I7', '', 'H8', ''));
$time = $_SESSION['time']-time();
if($time < 0) { $time = 0; }
if($_GET["v"] && $_GET["v"] != '' && $time <= 0 && $rooms[$les_login['room']][1] == $_GET["v"]) {
$_SESSION['time'] = time()+$rooms[$les_login['room']][0];
mysql_query("UPDATE `les_game` SET `room` = '".$_GET["v"]."' WHERE `owner` = '".$user['id']."' LIMIT 1");
$_GET["v"] = 0;
} }
if($_GET["n"] && $_GET["n"] != '' && $time <= 0 && $rooms[$les_login['room']][2] == $_GET["n"]) { $les_login = mysql_fetch_array(mysql_query("SELECT * FROM `les_game` WHERE `owner` = '" . $user['id'] . "' LIMIT 1"));
$_SESSION['time'] = time()+$rooms[$les_login['room']][0];
mysql_query("UPDATE `les_game` SET `room` = '".$_GET["n"]."' WHERE `owner` = '".$user['id']."' LIMIT 1"); $rooms = ["A1" => ['20', '', 'A2', '', 'B1'], "A2" => ['15', 'A1', 'A3', '', ''], "A3" => ['15', 'A2', '', '', ''], "A4" => ['15', '', 'A5', '', 'B4'], "A5" => ['15', 'A4', '', '', 'B5'], "A6" => ['15', '', 'A7', '', 'B6'], "A7" => ['15', 'A6', 'A8', '', ''], "A8" => ['15', 'A7', '', '', 'B8'], "B1" => ['20', '', '', 'A1', ''], "B2" => ['15', '', 'B3', '', 'C2'], "B3" => ['15', 'B2', 'B4', '', ''], "B4" => ['15', 'B3', '', 'A4', ''], "B5" => ['15', '', 'B6', 'A5', ''], "B6" => ['15', 'B5', 'B7', 'A6', ''], "B7" => ['15', 'B6', '', '', 'C7'], "B8" => ['15', '', '', 'A8', 'C8'], "C1" => ['20', '', '', '', 'D1'], "C2" => ['15', '', 'C3', 'B2', 'D2'], "C3" => ['15', 'C2', '', '', 'D3'], "C4" => ['15', '', '', '', 'D4'], "C5" => ['15', '', '', '', 'D5'], "C6" => ['15', '', 'C7', '', ''], "C7" => ['15', 'C6', 'C8', 'B7', ''], "C8" => ['15', 'C7', '', 'B8', 'D8'], "D1" => ['20', '', 'D2', 'C1', 'E1'], "D2" => ['15', 'D1', 'D3', 'C2', 'E2'], "D3" => ['15', 'D2', 'D4', 'C3', 'E3'], "D4" => ['15', 'D3', 'D5', 'C4', 'E4'], "D5" => ['15', 'D4', '', 'C5', ''], "D6" => ['15', '', 'D7', '', 'E6'], "D7" => ['15', 'D6', '', '', ''], "D8" => ['15', '', '', 'C8', 'E8'], "E1" => ['20', '', 'E2', 'D1', 'F1'], "E2" => ['15', 'E1', 'E3', 'D2', 'F2'], "E3" => ['15', 'E2', 'E4', 'D3', 'F3'], "E4" => ['15', 'E3', 'E5', 'D4', 'F4'], "E5" => ['15', 'E4', 'E6', '', 'F5'], "E6" => ['15', 'E5', '', 'D6', ''], "E7" => ['15', '', 'E8', '', 'F7'], "E8" => ['15', 'E7', '', 'D8', 'F8'], "F1" => ['20', '', 'F2', 'E1', 'G1'], "F2" => ['15', 'F1', 'F3', 'E2', 'G2'], "F3" => ['15', 'F2', 'F4', 'E3', 'G3'], "F4" => ['15', 'F3', 'F5', 'E4', 'G4'], "F5" => ['15', 'F4', '', 'E5', 'G5'], "F6" => ['15', '', '', '', 'G6'], "F7" => ['15', '', '', 'E7', 'G7'], "F8" => ['15', '', '', 'E8', 'G8'], "G1" => ['20', '', '', 'F1', 'H1'], "G2" => ['15', '', '', 'F2', ''], "G3" => ['15', '', '', 'F3', ''], "G4" => ['15', '', '', 'F4', ''], "G5" => ['15', '', 'G6', 'F5', ''], "G6" => ['15', 'G5', 'G7', 'F6', ''], "G7" => ['15', 'G6', 'G8', 'F7', ''], "G8" => ['15', 'G7', '', 'F8', 'H8'], "H1" => ['20', '', 'H2', 'G1', 'I1'], "H2" => ['15', 'H1', '', '', 'I2'], "H3" => ['15', '', '', '', 'I3'], "H4" => ['15', '', 'H5', '', 'I4'], "H5" => ['15', 'H4', '', '', 'I5'], "H6" => ['15', '', 'H7', '', 'I6'], "H7" => ['15', 'H6', '', '', 'I7'], "H8" => ['15', 'H7', '', 'G8', 'I8'], "I1" => ['20', '', 'I2', 'H1', ''], "I2" => ['15', 'I1', 'I3', 'H2', ''], "I3" => ['15', 'I2', 'I4', 'H3', ''], "I4" => ['15', 'I3', 'I5', 'H4', ''], "I5" => ['15', 'I4', 'I6', 'H5', ''], "I6" => ['15', 'I5', 'I7', 'H6', ''], "I7" => ['15', 'I6', 'I8', 'H7', ''], "I8" => ['15', 'I7', '', 'H8', '']];
$_GET["n"] = 0;
$time = $_SESSION['time'] - time();
if ($time < 0) {
$time = 0;
} }
if($_GET["l"] && $_GET["l"] != '' && $time <= 0 && $rooms[$les_login['room']][3] == $_GET["l"]) { if ($_GET["v"] && $_GET["v"] != '' && $time <= 0 && $rooms[$les_login['room']][1] == $_GET["v"]) {
$_SESSION['time'] = time()+$rooms[$les_login['room']][0]; $_SESSION['time'] = time() + $rooms[$les_login['room']][0];
mysql_query("UPDATE `les_game` SET `room` = '".$_GET["l"]."' WHERE `owner` = '".$user['id']."' LIMIT 1"); mysql_query("UPDATE `les_game` SET `room` = '" . $_GET["v"] . "' WHERE `owner` = '" . $user['id'] . "' LIMIT 1");
$_GET["l"] = 0; $_GET["v"] = 0;
} }
if($_GET["p"] && $_GET["p"] != '' && $time <= 0 && $rooms[$les_login['room']][4] == $_GET["p"]) { if ($_GET["n"] && $_GET["n"] != '' && $time <= 0 && $rooms[$les_login['room']][2] == $_GET["n"]) {
$_SESSION['time'] = time()+$rooms[$les_login['room']][0]; $_SESSION['time'] = time() + $rooms[$les_login['room']][0];
mysql_query("UPDATE `les_game` SET `room` = '".$_GET["p"]."' WHERE `owner` = '".$user['id']."' LIMIT 1"); mysql_query("UPDATE `les_game` SET `room` = '" . $_GET["n"] . "' WHERE `owner` = '" . $user['id'] . "' LIMIT 1");
$_GET["p"] = 0; $_GET["n"] = 0;
} }
if ($_GET["l"] && $_GET["l"] != '' && $time <= 0 && $rooms[$les_login['room']][3] == $_GET["l"]) {
$_SESSION['time'] = time() + $rooms[$les_login['room']][0];
mysql_query("UPDATE `les_game` SET `room` = '" . $_GET["l"] . "' WHERE `owner` = '" . $user['id'] . "' LIMIT 1");
$_GET["l"] = 0;
}
if ($_GET["p"] && $_GET["p"] != '' && $time <= 0 && $rooms[$les_login['room']][4] == $_GET["p"]) {
$_SESSION['time'] = time() + $rooms[$les_login['room']][0];
mysql_query("UPDATE `les_game` SET `room` = '" . $_GET["p"] . "' WHERE `owner` = '" . $user['id'] . "' LIMIT 1");
$_GET["p"] = 0;
}
///////////////Сбор///////////// ///////////////Сбор/////////////
if($_GET['res']) { if ($_GET['res']) {
$gss = mysql_fetch_array(mysql_query("SELECT * FROM `les_res` WHERE `owner` = '".$user['id']."' AND `id` = '".mysql_real_escape_string($_GET['res'])."' AND `kom` = '".$les_login['room']."' LIMIT 1")); $gss = mysql_fetch_array(mysql_query("SELECT * FROM `les_res` WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($_GET['res']) . "' AND `kom` = '" . $les_login['room'] . "' LIMIT 1"));
if($gss) { if ($gss) {
$f = mysql_query("SELECT `koll` FROM `inventory` WHERE `owner` = '".$user['id']."' AND `type` = '200' AND `name` = '".$gss['name']."' LIMIT 1"); $f = mysql_query("SELECT `koll` FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `type` = '200' AND `name` = '" . $gss['name'] . "' LIMIT 1");
if($g = mysql_fetch_array($f)) { if ($g = mysql_fetch_array($f)) {
mysql_query("UPDATE `inventory` SET `koll` = (`koll`+1), `massa` = (`massa`+0.1) WHERE `owner` = '".$user['id']."' AND `type` = '200' AND `name` = '".$gss['name']."' LIMIT 1"); mysql_query("UPDATE `inventory` SET `koll` = (`koll`+1), `massa` = (`massa`+0.1) WHERE `owner` = '" . $user['id'] . "' AND `type` = '200' AND `name` = '" . $gss['name'] . "' LIMIT 1");
} else {
$fo = mysql_query("INSERT INTO `inventory`(`name`, `koll`, `img`, `owner`, `type`, `massa`, `isrep`, `podzem`, `maxdur`, `present`) VALUES ('" . $gss['name'] . "', '1', '" . $gss['img'] . "', '" . $user['id'] . "', '200', '0.1', '0', '1', '1', 'Лес')");
}
mysql_query("DELETE FROM `les_res` WHERE `id` = '" . $gss['id'] . "' LIMIT 1");
addchp('<b style="color:#990000">Внимание!</b> <b>' . $user["login"] . '</b>, поднял предмет "' . $gss['name'] . '".', '{[]}' . Nick::id($user["id"])->short() . '{[]}');
echo "<font style='color:#990000'>Вы подняли <b>'" . $gss['name'] . "'</b>.</font>";
} else { } else {
$fo = mysql_query("INSERT INTO `inventory`(`name`, `koll`, `img`, `owner`, `type`, `massa`, `isrep`, `podzem`, `maxdur`, `present`) VALUES ('".$gss['name']."', '1', '".$gss['img']."', '".$user['id']."', '200', '0.1', '0', '1', '1', 'Лес')"); echo "&nbsp;<font style='font-size:12px; color:cc0000;'>Кто-то оказался быстрее!</font>";
} }
mysql_query("DELETE FROM `les_res` WHERE `id` = '".$gss['id']."' LIMIT 1");
addchp ('<b style="color:#990000">Внимание!</b> <b>'.$user["login"].'</b>, поднял предмет "'.$gss['name'].'".', '{[]}'.Nick::id($user["id"])->short().'{[]}');
echo "<font style='color:#990000'>Вы подняли <b>'".$gss['name']."'</b>.</font>";
} else {
echo "&nbsp;<font style='font-size:12px; color:cc0000;'>Кто-то оказался быстрее!</font>";}
} }
Template::header('Лес');
?> ?>
<html>
<head>
<META HTTP-EQUIV=imagetoolbar CONTENT=no>
<script src="i/forest/char1.32.js"></script> <script src="i/forest/char1.32.js"></script>
<script src="i/forest/funcs1.6.js"></script> <script src="i/forest/funcs1.6.js"></script>
</head>
<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor="#e2e0e0" onLoad="top.setHP(<?=$user['hp']?>,<?=$user['maxhp']?>,<? if (!$user['battle']){echo"10";}else{echo"0";}?>)">
<center><h4>Лес</h4></center> <center><h4>Лес</h4></center>
<dd> <dd>
<table cellspacing=2 cellpadding=0>
<dd><table cellspacing=2 cellpadding=0> <tr>
<tr> <td>
<td> <center>
<center><table width="450" border="0" cellspacing="1" cellpadding="0" bgcolor="#000000"> <table width="450" border="0" cellspacing="1" cellpadding="0" bgcolor="#000000">
<tr> <tr>
<td background="i/forest/bg_scroll_01.gif" align="center">Имя</td> <td background="i/forest/bg_scroll_01.gif" align="center">Имя</td>
<td background="i/forest/bg_scroll_01.gif" align="center">Hp</td> <td background="i/forest/bg_scroll_01.gif" align="center">Hp</td>
<td background="i/forest/bg_scroll_01.gif" align="center">Расположение</td> <td background="i/forest/bg_scroll_01.gif" align="center">Расположение</td>
</tr> </tr>
<? <?
$rog = mysql_query("SELECT * FROM `les_game` WHERE `owner` = '".$user['id']."'"); $rog = mysql_query("SELECT * FROM `les_game` WHERE `owner` = '" . $user['id'] . "'");
while($more = mysql_fetch_array($rog)) { while ($more = mysql_fetch_array($rog)) {
$big = mysql_fetch_array(mysql_query("SELECT `hp`, `maxhp`, `id`, `login` FROM `users` WHERE `id` = '".$more['owner']."'")); $big = mysql_fetch_array(mysql_query("SELECT `hp`, `maxhp`, `id`, `login` FROM `users` WHERE `id` = '" . $more['owner'] . "'"));
?> ?>
<tr> <tr>
<td background="i/forest/bg_scroll_05.gif" align="center"> <td background="i/forest/bg_scroll_05.gif" align="center">
<a href=inf.php?<?=$big['id']?> target=_blank title="Информация о <?=$big['login']?>"><?=$big['login']?></a></td> <a href=inf.php?<?= $big['id'] ?> target=_blank
<td background="i/forest/bg_scroll_05.gif" align="center"><?=$big['hp']?>/<?=$big['maxhp']?> </td> title="Информация о <?= $big['login'] ?>"><?= $big['login'] ?></a></td>
<td background="i/forest/bg_scroll_05.gif" align="center"><?=$more['room']?></td> <td background="i/forest/bg_scroll_05.gif" align="center"><?= $big['hp'] ?>
<? /<?= $big['maxhp'] ?> </td>
echo "</tr>"; <td background="i/forest/bg_scroll_05.gif" align="center"><?= $more['room'] ?></td>
} <?
?> echo "</tr>";
</table></center> }
</td> ?>
</tr> </table>
</table> </center>
</td>
<table cellpadding=5 width=100%><tr valign=top><td> </tr>
<table align=center width=95% height=100% cellpadding=5> </table>
<tr valign=top>
<td width=100%>
<table width=100%><tr> <table cellpadding=5 width=100%>
<tr valign=top>
<td>
<table align=center width=95% height=100% cellpadding=5>
<tr valign=top>
<td width=100%>
<td align=center colspan=2 id="navtbl"> <table width=100%>
<? <tr>
if($rooms[$les_login['room']][1] != '') {
echo "<input style=\"width: 150px; height: 20;\" type=\"button\" class=\"btn\" onclick=\"location.href='?v=".$rooms[$les_login['room']][1]."';\" value=\"На север\" />"; <td align=center colspan=2 id="navtbl">
} else { <?
echo "<input style=\"width: 150px; height: 20;\" type=\"button\" class=\"btn\" onclick=\"location.href='?v=".$rooms[$les_login['room']][1]."';\" value=\"\" />"; if ($rooms[$les_login['room']][1] != '') {
} echo "<input style=\"width: 150px; height: 20;\" type=\"button\" class=\"btn\" onclick=\"location.href='?v=" . $rooms[$les_login['room']][1] . "';\" value=\"На север\" />";
?> } else {
<br /><br /> echo "<input style=\"width: 150px; height: 20;\" type=\"button\" class=\"btn\" onclick=\"location.href='?v=" . $rooms[$les_login['room']][1] . "';\" value=\"\" />";
<? }
if($rooms[$les_login['room']][3] != '') { ?>
echo "<input style=\"width: 150px; height: 20;\" type=\"button\" class=\"btn\" onclick=\"location.href='?l=".$rooms[$les_login['room']][3]."';\" value=\"На запад\" />"; <br/><br/>
} else { <?
echo "<input style=\"width: 150px; height: 20;\" type=\"button\" class=\"btn\" onClick=\"location.href='?l=".$rooms[$les_login['room']][3]."';\" value=\"\" />"; if ($rooms[$les_login['room']][3] != '') {
} echo "<input style=\"width: 150px; height: 20;\" type=\"button\" class=\"btn\" onclick=\"location.href='?l=" . $rooms[$les_login['room']][3] . "';\" value=\"На запад\" />";
?> } else {
&nbsp; echo "<input style=\"width: 150px; height: 20;\" type=\"button\" class=\"btn\" onClick=\"location.href='?l=" . $rooms[$les_login['room']][3] . "';\" value=\"\" />";
<? }
if($rooms[$les_login['room']][4] != '') { ?>
echo "<input style=\"width: 150px; height: 20;\" type=\"button\" class=\"btn\" onclick=\"location.href='?p=".$rooms[$les_login['room']][4]."';\" value=\"На восток\" />"; &nbsp;
} else { <?
echo "<input style=\"width: 150px; height: 20;\" type=\"button\" class=\"btn\" onclick=\"location.href='?p=".$rooms[$les_login['room']][4]."';\" value=\"\" />"; if ($rooms[$les_login['room']][4] != '') {
} echo "<input style=\"width: 150px; height: 20;\" type=\"button\" class=\"btn\" onclick=\"location.href='?p=" . $rooms[$les_login['room']][4] . "';\" value=\"На восток\" />";
?>&nbsp; } else {
<br /><br /> echo "<input style=\"width: 150px; height: 20;\" type=\"button\" class=\"btn\" onclick=\"location.href='?p=" . $rooms[$les_login['room']][4] . "';\" value=\"\" />";
<? }
if($rooms[$les_login['room']][2] != '') { ?>&nbsp;
echo "<input style=\"width: 150px; height: 20;\" type=\"button\" class=\"btn\" onclick=\"location.href='?n=".$rooms[$les_login['room']][2]."';\" value=\"На юг\" />"; <br/><br/>
} else { <?
echo "<input style=\"width: 150px; height: 20;\" type=\"button\" class=\"btn\" onclick=\"location.href='?n=".$rooms[$les_login['room']][2]."';\" value=\"\" />"; if ($rooms[$les_login['room']][2] != '') {
} echo "<input style=\"width: 150px; height: 20;\" type=\"button\" class=\"btn\" onclick=\"location.href='?n=" . $rooms[$les_login['room']][2] . "';\" value=\"На юг\" />";
?> } else {
<br /><br /> echo "<input style=\"width: 150px; height: 20;\" type=\"button\" class=\"btn\" onclick=\"location.href='?n=" . $rooms[$les_login['room']][2] . "';\" value=\"\" />";
}
?>
<br/><br/>
<? if($les_login['room'] == 'G8') { ?> <? if ($les_login['room'] == 'G8') { ?>
<input class=btn style="width:150px;height:20" type="button" value="Выйти из леса" onclick="location.href='?go=vixod';" /><br /><br /> <input class=btn style="width:150px;height:20" type="button"
<? } ?> value="Выйти из леса" onclick="location.href='?go=vixod';"/><br/>
</td> <br/>
<? $les = mysql_query("SELECT `id` FROM `les_res` WHERE `owner` = '".$user['id']."'"); ?> <? } ?>
</tr> </td>
<tr valign=top> <? $les = mysql_query("SELECT `id` FROM `les_res` WHERE `owner` = '" . $user['id'] . "'"); ?>
<td width="40%" valign="top"> </tr>
<a href='i/forest/les.jpg' target="_blank">Карта</a> <tr valign=top>
<br /> <td width="40%" valign="top">
<span>Расположение : <b><?=$les_login['room']?></b></span><br /> <a href='i/forest/les.jpg' target="_blank">Карта</a>
<span>Не собрано ресурсов : <b><?=$col = mysql_num_rows($les);?></b></span><br /><span id="moveid"></span> <br/>
<? <span>Расположение : <b><?= $les_login['room'] ?></b></span><br/>
$time = ($_SESSION['time']-time()); <span>Не собрано ресурсов : <b><?= $col = mysql_num_rows($les); ?></b></span><br/><span
if($time < 0) { $time = 0; } id="moveid"></span>
?> <?
<script>go_timer_on(<?=$time?>,200);</script> $time = ($_SESSION['time'] - time());
</td> if ($time < 0) {
<td width="60%" align=right valign="bottom"> $time = 0;
<? }
$le = mysql_query("SELECT `id`, `img`, `name`, `owner`, `kom` FROM `les_res` WHERE `owner` = '".$user['id']."' AND `kom` = '".$les_login['room']."'"); ?>
while($res = mysql_fetch_array($le)) { <script>go_timer_on(<?=$time?>, 200);</script>
echo "<a href='forest.php?res=".$res['id']."'><img src=\"i/sh/".$res['img']."\" title=\"".$res['name']."\" border=0 /></a>"; </td>
} <td width="60%" align=right valign="bottom">
?> <?
</td> $le = mysql_query("SELECT `id`, `img`, `name`, `owner`, `kom` FROM `les_res` WHERE `owner` = '" . $user['id'] . "' AND `kom` = '" . $les_login['room'] . "'");
</tr> while ($res = mysql_fetch_array($le)) {
</table> echo "<a href='forest.php?res=" . $res['id'] . "'><img src=\"i/sh/" . $res['img'] . "\" title=\"" . $res['name'] . "\" border=0 /></a>";
<? }
$img = rand(1, 24); ?>
?> </td>
<td align=center><div id=bgid style="background-color:#cccccc;border:#666666 1px solid;position:relative;width:450px;height:300px"><img class=img2 height=300 src="forest/<?=$img?>.jpg" /></div></td> </tr>
</tr> </table>
</table></td></tr></table> <?
</body> $img = rand(1, 24);
</html> ?>
<td align=center>
<div id=bgid
style="background-color:#cccccc;border:#666666 1px solid;position:relative;width:450px;height:300px">
<img class=img2 height=300 src="forest/<?= $img ?>.jpg"/></div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</dd>