1016 lines
42 KiB
PHP
1016 lines
42 KiB
PHP
<?php
|
||
header('Location: city.php?strah');
|
||
die();
|
||
session_start();
|
||
if (!($_SESSION['uid'] > 0)) header("Location: index.php");
|
||
include "config.php";
|
||
include "functions.php";
|
||
if ($user['room'] != 34) header("Location: main.php");
|
||
$d = mysql_fetch_array(mysql_query("SELECT sum(`massa`) FROM `inventory` WHERE `owner` = '{$user['id']}' AND `dressed` = 0 AND `setsale` = 0 ; "));
|
||
if ($user['battle'] != 0) {
|
||
header('location: fbattle.php');
|
||
die();
|
||
}
|
||
$_GET['otdel'] = 1;
|
||
|
||
if (!$_SESSION['flowers']) {
|
||
$_SESSION['flowers'] = [];
|
||
}
|
||
|
||
if ($_GET['add']) {
|
||
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$_GET['add']}' AND `owner` = '{$_SESSION['uid']}' LIMIT 1;"));
|
||
//destructitem($dress['id']);
|
||
//mysql_query("UPDATE `users` set `money` = `money`+ '".(round(($dress['cost']/2)-$dress['duration']*($dress['cost']/($dress['maxdur']*10)),2))."' WHERE id = {$_SESSION['uid']}");
|
||
//echo "<font color=red><b>Вы продали \"{$dress['name']}\".</b></font>";
|
||
if ($dress) {
|
||
$_SESSION['flowers'][$dress['id']] = [$dress['img'], $dress['id'], $dress['name']];
|
||
}
|
||
}
|
||
if ($_POST['delflower']) {
|
||
unset($_SESSION['flowers'][$_POST['flower']]);
|
||
}
|
||
|
||
|
||
if (($_GET['set'] OR $_POST['set'])) {
|
||
if ($_GET['set']) {
|
||
$set = $_GET['set'];
|
||
}
|
||
if ($_POST['set']) {
|
||
$set = $_POST['set'];
|
||
}
|
||
if (!$_POST['count']) $_POST['count'] = 1;
|
||
if (!is_numeric($_POST['count']) || $_POST['count'] != ((int)$_POST['count'])) {
|
||
$_POST['count'] = 0;
|
||
$count_ok = 0;
|
||
} elseif ($_POST['count'] < 1) {
|
||
$_POST['count'] = 1;
|
||
} else $count_ok = 1;
|
||
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `fshop` WHERE `id` = '{$set}' LIMIT 1;"));
|
||
if ($count_ok == 0) {
|
||
echo "<font color=red><b>Неправильно введено количество</b></font>";
|
||
//$good = 0;
|
||
} elseif (($dress['massa'] * $_POST['count'] + $d[0]) > (get_meshok())) {
|
||
echo "<font color=red><b>Недостаточно места в рюкзаке.</b></font>";
|
||
//$good = 0;
|
||
} elseif ($count_ok == 1 && ($user['money'] >= ($dress['cost'] * $_POST['count'])) && ($dress['count'] >= $_POST['count'])) {
|
||
|
||
for ($k = 1; $k <= $_POST['count']; $k++) {
|
||
if (mysql_query("INSERT INTO `inventory`
|
||
(`prototype`,`owner`,`name`,`type`,`massa`,`cost`,`img`,`maxdur`,`isrep`,
|
||
`gsila`,`glovk`,`ginta`,`gintel`,`ghp`,`gnoj`,`gtopor`,`gdubina`,`gmech`,`gfire`,`gwater`,`gair`,`gearth`,`glight`,`ggray`,`gdark`,`needident`,`nsila`,`nlovk`,`ninta`,`nintel`,`nmudra`,`nvinos`,`nnoj`,`ntopor`,`ndubina`,`nmech`,`nfire`,`nwater`,`nair`,`nearth`,`nlight`,`ngray`,`ndark`,
|
||
`mfkrit`,`mfakrit`,`mfuvorot`,`mfauvorot`,`bron1`,`bron2`,`bron3`,`bron4`,`maxu`,`minu`,`magic`,`nlevel`,`nalign`,`dategoden`,`goden`,`otdel`,`gmp`,`gmeshok`,`encicl`,`artefact`
|
||
)
|
||
VALUES
|
||
('{$dress['id']}','{$user['id']}','{$dress['name']}','{$dress['type']}',{$dress['massa']},{$dress['cost']},'{$dress['img']}',{$dress['maxdur']},{$dress['isrep']},'{$dress['gsila']}','{$dress['glovk']}','{$dress['ginta']}','{$dress['gintel']}','{$dress['ghp']}','{$dress['gnoj']}','{$dress['gtopor']}','{$dress['gdubina']}','{$dress['gmech']}','{$dress['gfire']}','{$dress['gwater']}','{$dress['gair']}','{$dress['gearth']}','{$dress['glight']}','{$dress['ggray']}','{$dress['gdark']}','{$dress['needident']}','{$dress['nsila']}','{$dress['nlovk']}','{$dress['ninta']}','{$dress['nintel']}','{$dress['nmudra']}','{$dress['nvinos']}','{$dress['nnoj']}','{$dress['ntopor']}','{$dress['ndubina']}','{$dress['nmech']}','{$dress['nfire']}','{$dress['nwater']}','{$dress['nair']}','{$dress['nearth']}','{$dress['nlight']}','{$dress['ngray']}','{$dress['ndark']}',
|
||
'{$dress['mfkrit']}','{$dress['mfakrit']}','{$dress['mfuvorot']}','{$dress['mfauvorot']}','{$dress['bron1']}','{$dress['bron3']}','{$dress['bron2']}','{$dress['bron4']}','{$dress['maxu']}','{$dress['minu']}','{$dress['magic']}','{$dress['nlevel']}','{$dress['nalign']}','" . (($dress['goden']) ? ($dress['goden'] * 24 * 60 * 60 + time()) : "") . "','{$dress['goden']}','{$dress['razdel']}','{$dress['gmp']}','{$dress['gmeshok']}','{$dress['encicl']}','{$dress['artefact']}'
|
||
) ;")) {
|
||
$good = 1;
|
||
} else {
|
||
$good = 0;
|
||
}
|
||
}
|
||
if ($good) {
|
||
mysql_query("UPDATE `fshop` SET `count`=`count`-{$_POST['count']} WHERE `id` = '{$set}' LIMIT 1;");
|
||
echo "<font color=red><b>Вы купили {$_POST['count']} шт. \"{$dress['name']}\".</b></font>";
|
||
mysql_query("UPDATE `users` set `money` = `money`- '" . ($_POST['count'] * $dress['cost']) . "' WHERE id = {$user['id']} ;");
|
||
$user['money'] -= $_POST['count'] * $dress['cost'];
|
||
$limit = $_POST['count'];
|
||
$invdb = mysql_query("SELECT `id` FROM `inventory` WHERE `name` = '" . $dress['name'] . "' ORDER by `id` DESC LIMIT " . $limit . " ;");
|
||
if ($limit == 1) {
|
||
$dressinv = mysql_fetch_array($invdb);
|
||
$dressid = "cap" . $dressinv['id'];
|
||
$dresscount = " ";
|
||
} else {
|
||
$dressid = "";
|
||
while ($dressinv = mysql_fetch_array($invdb)) {
|
||
$dressid .= "cap" . $dressinv['id'] . ",";
|
||
}
|
||
$dresscount = "(x" . $_POST['count'] . ") ";
|
||
}
|
||
$allcost = $_POST['count'] * $dress['cost'];
|
||
mysql_query("INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`) VALUES ('','0','{$user['id']}','\"" . $user['login'] . "\" купил товар: \"" . $dress['name'] . "\" " . $dresscount . "id:(" . $dressid . ") [0/" . $dress['maxdur'] . "] за " . $allcost . " кр. ',1,'" . time() . "');");
|
||
}
|
||
} else {
|
||
echo "<font color=red><b>Недостаточно денег или нет вещей в наличии.</b></font>";
|
||
}
|
||
}
|
||
|
||
?>
|
||
<HTML lang="ru">
|
||
<HEAD>
|
||
<link rel=stylesheet href="css/main.css">
|
||
<meta charset="utf-8">
|
||
<SCRIPT LANGUAGE="JavaScript">
|
||
function AddCount(name, txt) {
|
||
document.all("hint3").innerHTML = '<form method=post style="margin:0; padding:0;"><table border=0 width=100% cellspacing=1 cellpadding=0 bgcolor="#CCC3AA"><tr><td align=center><B>Купить неск. штук</td><td width=20 align=right valign=top style="cursor: hand" onclick="closehint3();"><BIG><B>x</TD></tr><tr><td colspan=2>' +
|
||
'<table border=0 width=100% cellspacing=0 cellpadding=0 bgcolor="#FFF6DD"><tr><INPUT TYPE="hidden" name="set" value="' + name + '"><td colspan=2 align=center><B><I>' + txt + '</td></tr><tr><td width=80% align=right>' +
|
||
'Количество (шт.) <INPUT TYPE="text" NAME="count" size=4 ></td><td width=20%> <INPUT TYPE="submit" value=" »» ">' +
|
||
'</TD></TR></TABLE></td></tr></table></form>';
|
||
document.all("hint3").style.visibility = "visible";
|
||
document.all("hint3").style.left = 100;
|
||
document.all("hint3").style.top = 100;
|
||
document.all("count").focus();
|
||
}
|
||
|
||
// Закрывает окно
|
||
function closehint3() {
|
||
document.all("hint3").style.visibility = "hidden";
|
||
}
|
||
</SCRIPT>
|
||
</HEAD>
|
||
<body>
|
||
<TABLE border=0 width=100% cellspacing="0" cellpadding="0">
|
||
|
||
<tr>
|
||
<td><h3>Цветочный магазин</td>
|
||
<td align=right>
|
||
<FORM action="city.php" method=GET>
|
||
<INPUT TYPE="button" value="Подсказка" style="background-color:#A9AFC0"
|
||
onclick="window.open('help/shop.html', 'help', 'height=300,width=500,location=no,menubar=no,status=no,toolbar=no,scrollbars=yes')">
|
||
<INPUT TYPE="submit" value="Вернуться" name="strah">
|
||
</td>
|
||
</tr>
|
||
</FORM>
|
||
</table>
|
||
<?
|
||
if ($_POST['docompare']) {
|
||
$bukets = [
|
||
"Букет тюльпанов 1" => [
|
||
"Тюльпан" => 1,
|
||
"Трава для оформления 1" => 1
|
||
],
|
||
"Букет тюльпанов 3" => [
|
||
"Тюльпан" => 3,
|
||
"Трава для оформления 1" => 1
|
||
],
|
||
"Букет тюльпанов 5" => [
|
||
"Тюльпан" => 5,
|
||
"Трава для оформления 2" => 1
|
||
],
|
||
"Букет тюльпанов 7" => [
|
||
"Тюльпан" => 7,
|
||
"Трава для оформления 3" => 1
|
||
],
|
||
"Букет тюльпанов 9" => [
|
||
"Тюльпан" => 9,
|
||
"Трава для оформления 4" => 1
|
||
],
|
||
"Букет тюльпанов 21" => [
|
||
"Тюльпан" => 21,
|
||
"Трава для оформления 5" => 1
|
||
],
|
||
"Букет нарциссов 1" => [
|
||
"Нарцисс" => 1,
|
||
"Трава для оформления 1" => 1
|
||
],
|
||
"Букет нарциссов 3" => [
|
||
"Нарцисс" => 3,
|
||
"Трава для оформления 1" => 1
|
||
],
|
||
"Букет нарциссов 5" => [
|
||
"Нарцисс" => 5,
|
||
"Трава для оформления 2" => 1
|
||
],
|
||
"Букет нарциссов 7" => [
|
||
"Нарцисс" => 7,
|
||
"Трава для оформления 3" => 1
|
||
],
|
||
"Букет нарциссов 9" => [
|
||
"Нарцисс" => 9,
|
||
"Трава для оформления 4" => 1
|
||
],
|
||
"Букет нарциссов 21" => [
|
||
"Нарцисс" => 21,
|
||
"Трава для оформления 5" => 1
|
||
],
|
||
"Букет сирени 3" => [
|
||
"Сирень" => 3,
|
||
"Трава для оформления 1" => 1
|
||
],
|
||
"Букет сирени 5" => [
|
||
"Сирень" => 5,
|
||
"Трава для оформления 2" => 1
|
||
],
|
||
"Букет сирени 7" => [
|
||
"Сирень" => 7,
|
||
"Трава для оформления 3" => 1
|
||
],
|
||
"Букет сирени 9" => [
|
||
"Сирень" => 9,
|
||
"Трава для оформления 4" => 1
|
||
],
|
||
"Букет сирени 21" => [
|
||
"Сирень" => 21,
|
||
"Трава для оформления 5" => 1
|
||
],
|
||
"Букет рихардий 3" => [
|
||
"Рихардия" => 3,
|
||
"Трава для оформления 1" => 1
|
||
],
|
||
"Букет рихардий 5" => [
|
||
"Рихардия" => 5,
|
||
"Трава для оформления 2" => 1
|
||
],
|
||
"Букет рихардий 7" => [
|
||
"Рихардия" => 7,
|
||
"Трава для оформления 3" => 1
|
||
],
|
||
"Букет рихардий 9" => [
|
||
"Рихардия" => 9,
|
||
"Трава для оформления 4" => 1
|
||
],
|
||
"Букет рихардий 21" => [
|
||
"Рихардия" => 21,
|
||
"Трава для оформления 5" => 1
|
||
],
|
||
"Букет хризантем 3" => [
|
||
"Хризантема" => 3,
|
||
"Трава для оформления 1" => 1
|
||
],
|
||
"Букет хризантем 5" => [
|
||
"Хризантема" => 5,
|
||
"Трава для оформления 2" => 1
|
||
],
|
||
"Букет хризантем 7" => [
|
||
"Хризантема" => 7,
|
||
"Трава для оформления 3" => 1
|
||
],
|
||
"Букет хризантем 9" => [
|
||
"Хризантема" => 9,
|
||
"Трава для оформления 4" => 1
|
||
],
|
||
"Букет хризантем 21" => [
|
||
"Хризантема" => 21,
|
||
"Трава для оформления 5" => 1
|
||
],
|
||
"Букет желтых роз 3" => [
|
||
"Желтая роза" => 3,
|
||
"Трава для оформления 1" => 1
|
||
],
|
||
"Букет желтых роз 5" => [
|
||
"Желтая роза" => 5,
|
||
"Трава для оформления 2" => 1
|
||
],
|
||
"Букет желтых роз 7" => [
|
||
"Желтая роза" => 7,
|
||
"Трава для оформления 3" => 1
|
||
],
|
||
"Букет желтых роз 9" => [
|
||
"Желтая роза" => 9,
|
||
"Трава для оформления 4" => 1
|
||
],
|
||
"Букет желтых роз 21" => [
|
||
"Желтая роза" => 21,
|
||
"Трава для оформления 5" => 1
|
||
],
|
||
"Букет гортензий 3" => [
|
||
"Гортензия" => 3,
|
||
"Трава для оформления 1" => 1
|
||
],
|
||
"Букет гортензий 5" => [
|
||
"Гортензия" => 5,
|
||
"Трава для оформления 2" => 1
|
||
],
|
||
"Букет гортензий 7" => [
|
||
"Гортензия" => 7,
|
||
"Трава для оформления 3" => 1
|
||
],
|
||
"Букет гортензий 9" => [
|
||
"Гортензия" => 9,
|
||
"Трава для оформления 4" => 1
|
||
],
|
||
"Букет гортензий 21" => [
|
||
"Гортензия" => 21,
|
||
"Трава для оформления 5" => 1
|
||
],
|
||
"Букет влюбленного" => [
|
||
"Фиолетовый цветок" => 3,
|
||
"Трава для оформления 1" => 1
|
||
],
|
||
"Букет поклонника" => [
|
||
"Фиолетовый цветок" => 5,
|
||
"Трава для оформления 2" => 1
|
||
],
|
||
"Букет любовника" => [
|
||
"Фиолетовый цветок" => 7,
|
||
"Трава для оформления 3" => 1
|
||
],
|
||
"Букет супруга" => [
|
||
"Фиолетовый цветок" => 9,
|
||
"Трава для оформления 4" => 1
|
||
],
|
||
"Букет романтика" => [
|
||
"Фиолетовый цветок" => 21,
|
||
"Трава для оформления 5" => 1
|
||
],
|
||
"Букет влюбленной" => [
|
||
"Желтый цветок" => 3,
|
||
"Трава для оформления 1" => 1
|
||
],
|
||
"Букет поклонницы" => [
|
||
"Желтый цветок" => 5,
|
||
"Трава для оформления 2" => 1
|
||
],
|
||
"Букет любовницы" => [
|
||
"Желтый цветок" => 7,
|
||
"Трава для оформления 3" => 1
|
||
],
|
||
"Букет супруги" => [
|
||
"Желтый цветок" => 9,
|
||
"Трава для оформления 4" => 1
|
||
],
|
||
"Букет счастья" => [
|
||
"Желтый цветок" => 21,
|
||
"Трава для оформления 5" => 1
|
||
],
|
||
];
|
||
$resultbuk = [
|
||
"Букет тюльпанов 1" => [
|
||
"name" => "Букет тюльпанов 1",
|
||
'maxdur' => 1,
|
||
"img" => "tulip1.gif",
|
||
'minu' => 1,
|
||
'maxu' => 2,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет тюльпанов 3" => [
|
||
"name" => "Букет тюльпанов 3",
|
||
'maxdur' => 3,
|
||
"img" => "tulip3.gif",
|
||
'minu' => 1,
|
||
'maxu' => 3,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет тюльпанов 5" => [
|
||
"name" => "Букет тюльпанов 5",
|
||
'maxdur' => 5,
|
||
"img" => "tulip5.gif",
|
||
'minu' => 1,
|
||
'maxu' => 5,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет тюльпанов 7" => [
|
||
"name" => "Букет тюльпанов 7",
|
||
'maxdur' => 7,
|
||
"img" => "tulip7.gif",
|
||
'minu' => 1,
|
||
'maxu' => 7,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет тюльпанов 9" => [
|
||
"name" => "Букет тюльпанов 9",
|
||
'maxdur' => 9,
|
||
"img" => "tulip9.gif",
|
||
'minu' => 1,
|
||
'maxu' => 9,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 1,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет тюльпанов 21" => [
|
||
"name" => "Букет тюльпанов 21",
|
||
'maxdur' => 10,
|
||
"img" => "tulip21.gif",
|
||
'minu' => 1,
|
||
'maxu' => 21,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 5,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет нарциссов 1" => [
|
||
"name" => "Букет нарциссов 1",
|
||
'maxdur' => 1,
|
||
"img" => "narcissus1.gif",
|
||
'minu' => 1,
|
||
'maxu' => 2,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет нарциссов 3" => [
|
||
"name" => "Букет нарциссов 3",
|
||
'maxdur' => 3,
|
||
"img" => "narcissus3.gif",
|
||
'minu' => 1,
|
||
'maxu' => 3,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет нарциссов 5" => [
|
||
"name" => "Букет нарциссов 5",
|
||
'maxdur' => 5,
|
||
"img" => "narcissus5.gif",
|
||
'minu' => 1,
|
||
'maxu' => 5,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет нарциссов 7" => [
|
||
"name" => "Букет нарциссов 7",
|
||
'maxdur' => 7,
|
||
"img" => "narcissus7.gif",
|
||
'minu' => 1,
|
||
'maxu' => 7,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет нарциссов 9" => [
|
||
"name" => "Букет нарциссов 9",
|
||
'maxdur' => 9,
|
||
"img" => "narcissus9.gif",
|
||
'minu' => 1,
|
||
'maxu' => 9,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 1,
|
||
'goden' => 10],
|
||
"Букет нарциссов 21" => [
|
||
"name" => "Букет нарциссов 21",
|
||
'maxdur' => 10,
|
||
"img" => "narcissus21.gif",
|
||
'minu' => 1,
|
||
'maxu' => 21,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 5,
|
||
'goden' => 10],
|
||
"Букет сирени 3" => [
|
||
"name" => "Букет сирени 3",
|
||
'maxdur' => 3,
|
||
"img" => "siren_3.gif",
|
||
'minu' => 3,
|
||
'maxu' => 5,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет сирени 5" => [
|
||
"name" => "Букет сирени 5",
|
||
'maxdur' => 5,
|
||
"img" => "siren_5.gif",
|
||
'minu' => 3,
|
||
'maxu' => 7,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет сирени 7" => [
|
||
"name" => "Букет сирени 7",
|
||
'maxdur' => 7,
|
||
"img" => "siren_7.gif",
|
||
'minu' => 3,
|
||
'maxu' => 9,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 15,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет сирени 9" => [
|
||
"name" => "Букет сирени 9",
|
||
'maxdur' => 9,
|
||
"img" => "siren_9.gif",
|
||
'minu' => 3,
|
||
'maxu' => 15,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 15,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет сирени 21" => [
|
||
"name" => "Букет сирени 21",
|
||
'maxdur' => 10,
|
||
"img" => "siren_21.gif",
|
||
'minu' => 3,
|
||
'maxu' => 25,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 15,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет рихардий 3" => [
|
||
"name" => "Букет рихардий 3",
|
||
'maxdur' => 3,
|
||
"img" => "cally_3.gif",
|
||
'minu' => 3,
|
||
'maxu' => 5,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет рихардий 5" => [
|
||
"name" => "Букет рихардий 5",
|
||
'maxdur' => 5,
|
||
"img" => "cally_5.gif",
|
||
'minu' => 3,
|
||
'maxu' => 7,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 1,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет рихардий 7" => [
|
||
"name" => "Букет рихардий 7",
|
||
'maxdur' => 7,
|
||
"img" => "cally_7.gif",
|
||
'minu' => 3,
|
||
'maxu' => 10,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 10,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет рихардий 9" => [
|
||
"name" => "Букет рихардий 9",
|
||
'maxdur' => 9,
|
||
"img" => "cally_9.gif",
|
||
'minu' => 3,
|
||
'maxu' => 15,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 15,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет рихардий 21" => [
|
||
"name" => "Букет рихардий 21",
|
||
'maxdur' => 10,
|
||
"img" => "cally_21.gif",
|
||
'minu' => 3,
|
||
'maxu' => 25,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 20,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет хризантем 3" => [
|
||
"name" => "Букет хризантем 3",
|
||
'maxdur' => 3,
|
||
"img" => "chrysanthemum3.gif",
|
||
'minu' => 2,
|
||
'maxu' => 6,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет хризантем 5" => [
|
||
"name" => "Букет хризантем 5",
|
||
'maxdur' => 5,
|
||
"img" => "chrysanthemum5.gif",
|
||
'minu' => 2,
|
||
'maxu' => 8,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет хризантем 7" => [
|
||
"name" => "Букет хризантем 7",
|
||
'maxdur' => 7,
|
||
"img" => "chrysanthemum7.gif",
|
||
'minu' => 2,
|
||
'maxu' => 10,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет хризантем 9" => [
|
||
"name" => "Букет хризантем 9",
|
||
'maxdur' => 9,
|
||
"img" => "chrysanthemum9.gif",
|
||
'minu' => 2,
|
||
'maxu' => 12,
|
||
'mfkrit' => 5,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет хризантем 21" => [
|
||
"name" => "Букет хризантем 21",
|
||
'maxdur' => 10,
|
||
"img" => "chrysanthemum21.gif",
|
||
'minu' => 2,
|
||
'maxu' => 24,
|
||
'mfkrit' => 10,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет желтых роз 3" => [
|
||
"name" => "Букет желтых роз 3",
|
||
'maxdur' => 3,
|
||
"img" => "flove3.gif",
|
||
'minu' => 3,
|
||
'maxu' => 7,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет желтых роз 5" => [
|
||
"name" => "Букет желтых роз 5",
|
||
'maxdur' => 5,
|
||
"img" => "flove5.gif",
|
||
'minu' => 3,
|
||
'maxu' => 9,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет желтых роз 7" => [
|
||
"name" => "Букет желтых роз 7",
|
||
'maxdur' => 7,
|
||
"img" => "flove7.gif",
|
||
'minu' => 3,
|
||
'maxu' => 11,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет желтых роз 9" => [
|
||
"name" => "Букет желтых роз 9",
|
||
'maxdur' => 9,
|
||
"img" => "flove9.gif",
|
||
'minu' => 3,
|
||
'maxu' => 13,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 5,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет желтых роз 21" => [
|
||
"name" => "Букет желтых роз 21",
|
||
'maxdur' => 10,
|
||
"img" => "flove21.gif",
|
||
'minu' => 3,
|
||
'maxu' => 25,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 10,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет гортензий 3" => [
|
||
"name" => "Букет гортензий 3",
|
||
'maxdur' => 3,
|
||
"img" => "hydrangea3.gif",
|
||
'minu' => 3,
|
||
'maxu' => 7,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет гортензий 5" => [
|
||
"name" => "Букет гортензий 5",
|
||
'maxdur' => 5,
|
||
"img" => "hydrangea5.gif",
|
||
'minu' => 3,
|
||
'maxu' => 9,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет гортензий 7" => [
|
||
"name" => "Букет гортензий 7",
|
||
'maxdur' => 7,
|
||
"img" => "hydrangea7.gif",
|
||
'minu' => 3,
|
||
'maxu' => 11,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет гортензий 9" => [
|
||
"name" => "Букет гортензий 9",
|
||
'maxdur' => 9,
|
||
"img" => "hydrangea9.gif",
|
||
'minu' => 3,
|
||
'maxu' => 13,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 10,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет гортензий 21" => [
|
||
"name" => "Букет гортензий 21",
|
||
'maxdur' => 10,
|
||
"img" => "hydrangea21.gif",
|
||
'minu' => 3,
|
||
'maxu' => 25,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 10,
|
||
'mfauvorot' => 10,
|
||
'goden' => 10],
|
||
"Букет влюбленного" => [
|
||
"name" => "Букет влюбленного",
|
||
'maxdur' => 3,
|
||
"img" => "love3.gif",
|
||
'minu' => 1,
|
||
'maxu' => 3,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет поклонника" => [
|
||
"name" => "Букет поклонника",
|
||
'maxdur' => 5,
|
||
"img" => "love5.gif",
|
||
'minu' => 1,
|
||
'maxu' => 5,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет любовника" => [
|
||
"name" => "Букет любовника",
|
||
'maxdur' => 7,
|
||
"img" => "love7.gif",
|
||
'minu' => 1,
|
||
'maxu' => 7,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет супруга" => [
|
||
"name" => "Букет супруга",
|
||
'maxdur' => 9,
|
||
"img" => "love9.gif",
|
||
'minu' => 1,
|
||
'maxu' => 9,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 1,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет романтика" => [
|
||
"name" => "Букет романтика",
|
||
'maxdur' => 10,
|
||
"img" => "love21.gif",
|
||
'minu' => 1,
|
||
'maxu' => 21,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 5,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет влюбленной" => [
|
||
"name" => "Букет влюбленной",
|
||
'maxdur' => 3,
|
||
"img" => "flove3.gif",
|
||
'minu' => 1,
|
||
'maxu' => 3,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет поклонницы" => [
|
||
"name" => "Букет поклонницы",
|
||
'maxdur' => 5,
|
||
"img" => "flove5.gif",
|
||
'minu' => 1,
|
||
'maxu' => 5,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет любовницы" => [
|
||
"name" => "Букет любовницы",
|
||
'maxdur' => 7,
|
||
"img" => "flove7.gif",
|
||
'minu' => 1,
|
||
'maxu' => 7,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 0,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет супруги" => [
|
||
"name" => "Букет супруги",
|
||
'maxdur' => 9,
|
||
"img" => "flove9.gif",
|
||
'minu' => 1,
|
||
'maxu' => 9,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 1,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
"Букет счастья" => [
|
||
"name" => "Букет счастья",
|
||
'maxdur' => 10,
|
||
"img" => "flove21.gif",
|
||
'minu' => 1,
|
||
'maxu' => 21,
|
||
'mfkrit' => 0,
|
||
'mfakrit' => 0,
|
||
'mfuvorot' => 5,
|
||
'mfauvorot' => 0,
|
||
'goden' => 10],
|
||
];
|
||
foreach ($_SESSION['flowers'] as $v) {
|
||
$errs[$v[2]]++;
|
||
}
|
||
foreach ($bukets as $k => $v) {
|
||
$zbor = true;
|
||
foreach ($v as $name => $count) {
|
||
if ($errs[$name] != $count) {
|
||
$zbor = false;
|
||
}
|
||
//unset ($errs[$name]);
|
||
}
|
||
//if(count($errs) > 0) { $zbor = false; }
|
||
if ($zbor) {
|
||
$dress = $resultbuk[$k];
|
||
if (mysql_query("INSERT INTO `inventory`
|
||
(`prototype`,`owner`,`name`,`type`,`massa`,`cost`,`img`,`maxdur`,`isrep`,
|
||
`mfkrit`,`mfakrit`,`mfuvorot`,`mfauvorot`,`maxu`,`minu`,`dategoden`,`goden`
|
||
)
|
||
VALUES
|
||
('','{$_SESSION['uid']}','{$dress['name']}','3',1,0,'{$dress['img']}',{$dress['maxdur']},0,
|
||
'{$dress['mfkrit']}','{$dress['mfakrit']}','{$dress['mfuvorot']}','{$dress['mfauvorot']}',
|
||
'{$dress['maxu']}','{$dress['minu']}','" . (($dress['goden']) ? ($dress['goden'] * 24 * 60 * 60 + time()) : "") . "','{$dress['goden']}'
|
||
) ;")) {
|
||
$buket_id = mysql_insert_id();
|
||
$good = 1;
|
||
} else {
|
||
$good = 0;
|
||
}
|
||
|
||
if ($good) {
|
||
echo '<B><font color=red>Удачно составлен букет <img src="i/sh/', $dress['img'], '"><BR>(находится у вас в рюкзаке)</font>';
|
||
foreach ($_SESSION['flowers'] as $k => $v) {
|
||
$dressid .= "cap" . $k . ",";
|
||
mysql_query("DELETE FROM `inventory` WHERE `id` = '" . $k . "' LIMIT 1;");
|
||
}
|
||
mysql_query("INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`) VALUES ('','0','{$_SESSION['uid']}','\"" . $user['login'] . "\" получила предмет: \"" . $dress['name'] . "\" " . $dresscount . "id:(cap" . $buket_id . ") [0/" . $dress['maxdur'] . "] за id:(" . $dressid . ") ',1,'" . time() . "');");
|
||
} else {
|
||
echo '<B><font color=red>Произошла ошибка!</font>';
|
||
}
|
||
}
|
||
}
|
||
if (!$good) {
|
||
foreach ($_SESSION['flowers'] as $k => $v) {
|
||
$fname = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '" . $k . "' LIMIT 1;"));
|
||
mysql_query("DELETE FROM `inventory` WHERE `id` = '" . $k . "' LIMIT 1;");
|
||
mysql_query("INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`) VALUES ('','0','{$_SESSION['uid']}','Утерян предмет \"" . $fname['name'] . "\" id:(cap" . $k . ") [" . $fname['duration'] . "/" . $fname['maxdur'] . "] у \"" . $user['login'] . "\" ',1,'" . time() . "');");
|
||
}
|
||
}
|
||
$_SESSION['flowers'] = [];
|
||
|
||
}
|
||
?>
|
||
<TABLE border=0 width=100% cellspacing="0" cellpadding="4">
|
||
<TR>
|
||
<FORM METHOD=POST ACTION="fshop.php">
|
||
<INPUT TYPE="hidden" name="sid" value="">
|
||
<INPUT TYPE="hidden" name="id" value="1">
|
||
<TD valign=top align=left>
|
||
<!--Магазин-->
|
||
<TABLE border=0 width=100% cellspacing="0" cellpadding="0" bgcolor="#A5A5A5">
|
||
<TR>
|
||
<TD align=center>
|
||
<B><?php
|
||
if ($_REQUEST['compare'] && !$_REQUEST['common']) echo "Составление подарочного букета";
|
||
else echo "Цветы. Общий зал.";
|
||
?>
|
||
</B>
|
||
</TD>
|
||
</TR>
|
||
<TR>
|
||
<TD><!--Рюкзак-->
|
||
<TABLE BORDER=0 WIDTH=100% CELLSPACING="1" CELLPADDING="2" BGCOLOR="#A5A5A5">
|
||
<?php if ($_REQUEST['compare'] && !$_REQUEST['common']) { ?>
|
||
</table>
|
||
<TABLE BORDER=0 WIDTH=100% CELLSPACING="1" CELLPADDING="2" BGCOLOR="#D5D5D5">
|
||
<tr>
|
||
<input type="hidden" value="1" name="compare">
|
||
<td width=150px valign=top>
|
||
<b>Цветы для букета:</b><BR>
|
||
<div align="right">
|
||
<input type="submit" onclick="if(!confirm('Внимание! Если не удастся собрать букет - цветы пропадут. Подходите разумно к составлению букета.\nНапример, не рекомендуется использовать четное количество цветов.\nСоставить букет?')) { return false; }"
|
||
value="Собрать букет" name="docompare"></div>
|
||
</td>
|
||
<td valign=top>
|
||
<?
|
||
unset($errs);
|
||
foreach ($_SESSION['flowers'] as $v) {
|
||
if ($v[2] == "Тюльпан" OR $v[2] == "Нарцисс" OR $v[2] == "Хризантема" OR $v[2] == "Сирень" OR $v[2] == "Рихардия" OR $v[2] == "Желтая роза" OR $v[2] == "Гортензия") {
|
||
$errs[$v[2]]++;
|
||
}
|
||
}
|
||
if (count($errs) > 1) {
|
||
echo '<font color=red>Букет можно собрать только из цветов одного типа!</font>';
|
||
}
|
||
|
||
if (!$_SESSION['flowers']) {
|
||
echo 'Добавляйте сюда цветы, из которых хотите составить букет';
|
||
} else {
|
||
foreach ($_SESSION['flowers'] as $k => $v) {
|
||
echo '<form method="post" style="margin:0; padding:0;"><div style="float: left;" align="center"><img src="i/sh/', $v[0], '" align="center"><BR><input type="hidden" name="flower" value="', $k, '"><input type="hidden" value="1" name="compare"><input type="submit" value="Убрать" name="delflower"></div></form>';
|
||
}
|
||
}
|
||
?>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<div style="text-align: center; font-weight: bold;">Цветы у вас в рюкзаке</div>
|
||
|
||
<TABLE BORDER=0 WIDTH=100% CELLSPACING="1" CELLPADDING="2" BGCOLOR="#A5A5A5">
|
||
<?
|
||
$data = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$_SESSION['uid']}' AND `dressed` = 0 AND (
|
||
`name` LIKE 'Трава%' OR
|
||
`name` LIKE 'Тюльпан%' OR
|
||
`name` LIKE 'Нарцисс%' OR
|
||
`name` LIKE 'Хризантема%' OR
|
||
`name` LIKE 'Желтая роза%' OR
|
||
`name` LIKE 'Гортензия%' OR
|
||
`name` LIKE 'Фиолетовый цветок' OR
|
||
`name` LIKE 'Желтый цветок' OR
|
||
`name` LIKE 'Сирень' OR
|
||
`name` LIKE 'Рихардия'
|
||
) AND `setsale`=0 ORDER by `update` DESC; ");
|
||
while ($row = mysql_fetch_array($data)) {
|
||
if (!in_array($row['id'], array_keys($_SESSION['flowers']))) {
|
||
echo "<TR><TD align=center style='width:150px'><IMG SRC=\"i/sh/{$row['img']}\" BORDER=0>";
|
||
?>
|
||
<BR><A HREF="fshop.php?add=<?= $row['id'] ?>&sid=&compare=1">добавить в
|
||
букет</A>
|
||
</TD>
|
||
<?php
|
||
echo "<TD valign=top> Тут был showitem($row);";
|
||
|
||
echo "</TD></TR>";
|
||
}
|
||
}
|
||
} else {
|
||
$data = mysql_query("SELECT * FROM `fshop` WHERE `count` > 0 AND `razdel` = '{$_GET['otdel']}' ORDER by `cost` ASC");
|
||
while ($row = mysql_fetch_array($data)) {
|
||
echo "<TR bgcolor={$color}><TD align=center style='width:150px'><IMG SRC=\"i/sh/{$row['img']}\" BORDER=0>";
|
||
?>
|
||
<BR><A HREF="fshop.php?otdel=<?= $_GET['otdel'] ?>&set=<?= $row['id'] ?>&sid=">купить</A>
|
||
</TD>
|
||
<?php
|
||
echo "<TD valign=top> Тут был showitem($row);";
|
||
|
||
echo "</TD></TR>";
|
||
}
|
||
}
|
||
?>
|
||
</TABLE>
|
||
</TD>
|
||
</TR>
|
||
</TABLE>
|
||
</TD>
|
||
<TD valign=top width=280>
|
||
|
||
<CENTER><B>Масса всех ваших вещей: <?= getItemsMassaInfo() ?><BR>
|
||
У вас в наличии: <FONT COLOR="#339900"><?= $user['money'] ?></FONT> кр.</B></CENTER>
|
||
<div style="MARGIN-LEFT:15px; MARGIN-TOP: 10px;">
|
||
<form method="post">
|
||
<INPUT TYPE="submit" value="Общий зал" name="common"><BR>
|
||
<INPUT TYPE="submit" value="Составление букета" name="compare"><BR>
|
||
</div>
|
||
</form>
|
||
<div id="hint3" class="ahint"></div>
|
||
</TD>
|
||
</FORM>
|
||
</TR>
|
||
</TABLE>
|
||
</BODY>
|
||
</HTML>
|