Правка нерабочего html
This commit is contained in:
parent
ac5acc661d
commit
f201934dc4
@ -125,7 +125,7 @@ if (isset($_GET['set']) OR isset($_POST['set'])) {
|
||||
echo "Составление подарочного букета";
|
||||
} else {
|
||||
switch ($_GET['otdel']) {
|
||||
case null:
|
||||
default:
|
||||
echo "Оружие: кастеты,ножи";
|
||||
$_GET['otdel'] = 1;
|
||||
break;
|
||||
|
677
shop.php
677
shop.php
@ -1,357 +1,366 @@
|
||||
<?php
|
||||
ob_start();
|
||||
session_start();
|
||||
if(!isset($_SESSION['uid'])) { header("Location: index.php"); }
|
||||
if (!isset($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
}
|
||||
include("config.php");
|
||||
include("functions.php");
|
||||
|
||||
$d = mysql_fetch_array(mysql_query("SELECT SUM(`massa`) FROM `inventory` WHERE `owner` = '{$user['id']}' AND `dressed` = 0 AND `setsale` = 0"));
|
||||
if($user['room'] != 22) { header("Location: main.php"); die(); }
|
||||
if($user['battle'] != 0) { header('location: fbattle.php'); die(); }
|
||||
|
||||
if($_GET['sort'] == 1) {
|
||||
$_SESSION['type_sort'] = 1;
|
||||
} elseif($_GET['sort'] == 2) {
|
||||
$_SESSION['type_sort'] = 2;
|
||||
if ($user['room'] != 22) {
|
||||
header("Location: main.php");
|
||||
die();
|
||||
}
|
||||
if ($user['battle'] != 0) {
|
||||
header('location: fbattle.php');
|
||||
die();
|
||||
}
|
||||
|
||||
if($_GET['sed']) {
|
||||
$dress = mysql_fetch_array(mysql_query("SELECT `id`, `name`, `cost`, `type`, `duration`, `maxdur`, `goden`, `dategoden`, `koll` FROM `inventory` WHERE `dressed` = 0 AND `id` = '".(int)$_GET['sed']."' AND `owner` = '{$user['id']}' LIMIT 1"));
|
||||
$price = $dress['cost']*1;
|
||||
$kols = '';
|
||||
if($dress['koll']) {
|
||||
$price*$dress['koll'];
|
||||
$kols = '(x'.$dress['koll'].')';
|
||||
}
|
||||
destructitem($dress['id']);
|
||||
if($dress['type'] == 12) {
|
||||
$allcost = round($price*(1-$dress['duration']/$dress['maxdur']), 2);
|
||||
} else {
|
||||
$allcost = round($price-$dress['duration']*($dress['cost']/($dress['maxdur']*10)), 2);
|
||||
}
|
||||
|
||||
if($dress['goden'] != 0) {
|
||||
$goden_max = $dress['goden']*24*60;
|
||||
$goden_left = ($dress['dategoden']-time())/60;
|
||||
$per = $goden_left/$goden_max;
|
||||
$allcost = round(($allcost*$per), 2);
|
||||
}
|
||||
$user['money'] += $allcost;
|
||||
mysql_query("UPDATE `users` SET `money` = '".$user['money']."' WHERE `id` = {$user['id']} LIMIT 1");
|
||||
mysql_query("INSERT INTO `delo` (`author`, `pers`, `text`, `type`, `date`) VALUES ('0', '{$user['id']}', '\"".$user['login']."\" продал в магазин товар : \"".$dress['name']."\" $kols id:(cap".$dress['id'].") [".$dress['duration']."/".$dress['maxdur']."] за ".$allcost." кр. ', '1', '".time()."')");
|
||||
echo "<font color=red><b>Вы продали \"{$dress['name']}\" $kols за ".$allcost." кр.</b></font>";
|
||||
if ($_GET['sort'] == 1) {
|
||||
$_SESSION['type_sort'] = 1;
|
||||
} elseif ($_GET['sort'] == 2) {
|
||||
$_SESSION['type_sort'] = 2;
|
||||
}
|
||||
|
||||
|
||||
if(($_GET['set'] || $_POST['set'])) {
|
||||
if($_GET['set']) { $set = $_GET['set']; }
|
||||
if($_POST['set']) { $set = $_POST['set']; }
|
||||
if(!$_GET['count']) { $_GET['count'] = 1; }
|
||||
if(!is_numeric($_GET['count']) || $_GET['count'] != ((int)$_GET['count'])) {
|
||||
$_GET['count'] = 0;
|
||||
$count_ok = 0;
|
||||
} elseif($_GET['count'] < 1) {
|
||||
$_GET['count'] = 0; $count_ok = 0;
|
||||
} else {
|
||||
$count_ok = 1;
|
||||
}
|
||||
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `shop` WHERE `id` = '".(int)$set."' LIMIT 1"));
|
||||
if($count_ok == 0) {
|
||||
echo "<font color=red><b>Неправильно введено количество</b></font>";
|
||||
} elseif(($dress['massa']*$_GET['count']+$d[0]) > (get_meshok())) {
|
||||
echo "<font color=red><b>Недостаточно места в рюкзаке.</b></font>";
|
||||
} elseif($count_ok == 1 && ($user['money'] >= ($dress['cost']*$_GET['count'])) && ($dress['count'] >= $_GET['count'])) {
|
||||
|
||||
for($k = 1; $k <= $_GET['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`,`koll`) 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['bron2']}','{$dress['bron3']}','{$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']}','{$dress[koll]}')")) {
|
||||
$good = 1;
|
||||
} else {
|
||||
$good = 0;
|
||||
}
|
||||
if ($_GET['sed']) {
|
||||
$dress = mysql_fetch_array(mysql_query("SELECT `id`, `name`, `cost`, `type`, `duration`, `maxdur`, `goden`, `dategoden`, `koll` FROM `inventory` WHERE `dressed` = 0 AND `id` = '" . (int)$_GET['sed'] . "' AND `owner` = '{$user['id']}' LIMIT 1"));
|
||||
$price = $dress['cost'] * 1;
|
||||
$kols = '';
|
||||
if ($dress['koll']) {
|
||||
$price * $dress['koll'];
|
||||
$kols = '(x' . $dress['koll'] . ')';
|
||||
}
|
||||
destructitem($dress['id']);
|
||||
if ($dress['type'] == 12) {
|
||||
$allcost = round($price * (1 - $dress['duration'] / $dress['maxdur']), 2);
|
||||
} else {
|
||||
$allcost = round($price - $dress['duration'] * ($dress['cost'] / ($dress['maxdur'] * 10)), 2);
|
||||
}
|
||||
|
||||
if($good) {
|
||||
mysql_query("UPDATE `shop` SET `count` = (`count`-'".(int)$_GET['count']."') WHERE `id` = '{$set}' LIMIT 1");
|
||||
echo "<font color=red><b>Вы купили {$_GET['count']} шт. \"{$dress['name']}\".</b></font>";
|
||||
$user['money'] -= (int)$_GET['count']*$dress['cost'];
|
||||
mysql_query("UPDATE `users` set `money` = '".$user['money']."' WHERE `id` = {$user['id']} LIMIT 1");
|
||||
$limit = (int)$_GET['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".$_GET['count'].") ";
|
||||
}
|
||||
$allcost = (int)$_GET['count']*$dress['cost'];
|
||||
mysql_query("INSERT INTO `delo` (`author`, `pers`, `text`, `type`, `date`) VALUES ('0', '{$user['id']}', '\"".$user['login']."\" купил товар : \"".$dress['name']."\" ".$dresscount." id:(".$dressid.") [0/".$dress['maxdur']."] за ".$allcost." кр.', '1', '".time()."')");
|
||||
if ($dress['goden'] != 0) {
|
||||
$goden_max = $dress['goden'] * 24 * 60;
|
||||
$goden_left = ($dress['dategoden'] - time()) / 60;
|
||||
$per = $goden_left / $goden_max;
|
||||
$allcost = round(($allcost * $per), 2);
|
||||
}
|
||||
} else {
|
||||
echo "<font color=red><b>Недостаточно денег или нет вещей в наличии.</b></font>";
|
||||
}
|
||||
$user['money'] += $allcost;
|
||||
mysql_query("UPDATE `users` SET `money` = '" . $user['money'] . "' WHERE `id` = {$user['id']} LIMIT 1");
|
||||
mysql_query("INSERT INTO `delo` (`author`, `pers`, `text`, `type`, `date`) VALUES ('0', '{$user['id']}', '\"" . $user['login'] . "\" продал в магазин товар : \"" . $dress['name'] . "\" $kols id:(cap" . $dress['id'] . ") [" . $dress['duration'] . "/" . $dress['maxdur'] . "] за " . $allcost . " кр. ', '1', '" . time() . "')");
|
||||
echo "<font color=red><b>Вы продали \"{$dress['name']}\" $kols за " . $allcost . " кр.</b></font>";
|
||||
}
|
||||
|
||||
|
||||
if (($_GET['set'] || $_POST['set'])) {
|
||||
if ($_GET['set']) {
|
||||
$set = $_GET['set'];
|
||||
}
|
||||
if ($_POST['set']) {
|
||||
$set = $_POST['set'];
|
||||
}
|
||||
if (!$_GET['count']) {
|
||||
$_GET['count'] = 1;
|
||||
}
|
||||
if (!is_numeric($_GET['count']) || $_GET['count'] != ((int)$_GET['count'])) {
|
||||
$_GET['count'] = 0;
|
||||
$count_ok = 0;
|
||||
} elseif ($_GET['count'] < 1) {
|
||||
$_GET['count'] = 0;
|
||||
$count_ok = 0;
|
||||
} else {
|
||||
$count_ok = 1;
|
||||
}
|
||||
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `shop` WHERE `id` = '" . (int)$set . "' LIMIT 1"));
|
||||
if ($count_ok == 0) {
|
||||
echo "<font color=red><b>Неправильно введено количество</b></font>";
|
||||
} elseif (($dress['massa'] * $_GET['count'] + $d[0]) > (get_meshok())) {
|
||||
echo "<font color=red><b>Недостаточно места в рюкзаке.</b></font>";
|
||||
} elseif ($count_ok == 1 && ($user['money'] >= ($dress['cost'] * $_GET['count'])) && ($dress['count'] >= $_GET['count'])) {
|
||||
|
||||
for ($k = 1; $k <= $_GET['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`,`koll`) 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['bron2']}','{$dress['bron3']}','{$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']}','{$dress[koll]}')")) {
|
||||
$good = 1;
|
||||
} else {
|
||||
$good = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ($good) {
|
||||
mysql_query("UPDATE `shop` SET `count` = (`count`-'" . (int)$_GET['count'] . "') WHERE `id` = '{$set}' LIMIT 1");
|
||||
echo "<font color=red><b>Вы купили {$_GET['count']} шт. \"{$dress['name']}\".</b></font>";
|
||||
$user['money'] -= (int)$_GET['count'] * $dress['cost'];
|
||||
mysql_query("UPDATE `users` set `money` = '" . $user['money'] . "' WHERE `id` = {$user['id']} LIMIT 1");
|
||||
$limit = (int)$_GET['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" . $_GET['count'] . ") ";
|
||||
}
|
||||
$allcost = (int)$_GET['count'] * $dress['cost'];
|
||||
mysql_query("INSERT INTO `delo` (`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>";
|
||||
}
|
||||
}
|
||||
$itemWeight = db::c()->query('SELECT sum(`massa`) AS `m` FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND `setsale` = 0', $user['id'])->fetch_assoc();
|
||||
|
||||
?>
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<link rel=stylesheet type="text/css" href="css/main.css">
|
||||
<meta content="text/html; charset=utf-8" http-equiv=Content-type>
|
||||
<META Http-Equiv=Cache-Control Content=no-cache>
|
||||
<meta http-equiv=PRAGMA content=NO-CACHE>
|
||||
<META Http-Equiv=Expires Content=0>
|
||||
<script src="js/jquery-1.7.2.min.js"></script>
|
||||
<script src="js/jquery.simplemodal.js"></script>
|
||||
<script src="js/jquery.ui.js?100"></script>
|
||||
<script src="js/mi.js"></script>
|
||||
<link rel="stylesheet" href="css/bkstyle.css?101" />
|
||||
<link rel="stylesheet" href="css/mi.css" />
|
||||
<script>
|
||||
function proverka(input) {
|
||||
input.value = input.value.replace(/[^\d]/g, '');
|
||||
}
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link href="css/main.css" rel="stylesheet"/>
|
||||
<script src="js/jquery-1.7.2.min.js"></script>
|
||||
<script src="js/jquery.simplemodal.js"></script>
|
||||
<script src="js/jquery.ui.js?100"></script>
|
||||
<script src="js/mi.js"></script>
|
||||
<link rel="stylesheet" href="css/bkstyle.css?101"/>
|
||||
<link rel="stylesheet" href="css/mi.css"/>
|
||||
<style>
|
||||
.row {
|
||||
font-family: Tahoma, sans-serif;
|
||||
font-size: 13px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function addCountItems(name, txt) {
|
||||
new miDialog({title: 'Купить неск. штук'}, {byu: 1}, function () {
|
||||
document.location = '/shop.php?' + $.param(this.data);
|
||||
},
|
||||
$('<div style="text-align: center;"><b>' + txt + '</b></div>').append(miDialog._oneInput({
|
||||
name: 'count',
|
||||
onkeyup: 'return proverka(this);',
|
||||
onchange: 'return proverka(this);'
|
||||
}), miDialog._hiddenInput({name: 'set', value: name})), {width: 250});
|
||||
}
|
||||
|
||||
function addCountItems(name, txt) {
|
||||
new miDialog({title : 'Купить неск. штук'}, {byu : 1}, function() {
|
||||
document.location = '/shop.php?'+$.param(this.data);
|
||||
},
|
||||
$('<div style="text-align: center;"><b>'+txt+'</b></div>').append(miDialog._oneInput({name : 'count', onkeyup : 'return proverka(this);', onchange : 'return proverka(this);'}), miDialog._hiddenInput({name : 'set', value : name})), {width : 250});
|
||||
}
|
||||
function proverka(input) {
|
||||
input.value = input.value.replace(/[^\d]/g, '');
|
||||
}
|
||||
|
||||
function check(val) {
|
||||
var otdel = '<?=$_GET['otdel'];?>';
|
||||
if(val == 0) {
|
||||
location.href = 'shop.php?otdel='+otdel+'&sort=1';
|
||||
} else if(val == 1) {
|
||||
location.href = 'shop.php?otdel='+otdel+'&sort=2';
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</HEAD>
|
||||
<style>
|
||||
.row {
|
||||
font-family: Tahoma; font-size: 13px;
|
||||
}
|
||||
</style>
|
||||
<body leftmargin=5 topmargin=5 marginwidth=5 marginheight=5 bgcolor=#d4d4d4>
|
||||
<TABLE border=0 width=100% cellspacing="0" cellpadding="0">
|
||||
<FORM action="city.php" method=GET>
|
||||
<tr><td><h3>Государственный магазин Capital City</td><td align=right>
|
||||
<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="cp"></td></tr>
|
||||
</FORM>
|
||||
</table>
|
||||
function check(val) {
|
||||
var otdel = '<?=$_GET['otdel'];?>';
|
||||
if (val == 0) {
|
||||
location.href = 'shop.php?otdel=' + otdel + '&sort=1';
|
||||
} else if (val == 1) {
|
||||
location.href = 'shop.php?otdel=' + otdel + '&sort=2';
|
||||
}
|
||||
}
|
||||
|
||||
function leave() {
|
||||
top.frames['main'].location = 'city.php?cp'
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Государственный магазин</h1>
|
||||
<a href=# onclick=leave()> ← выйти на Центральную площадь</a>
|
||||
<TABLE border=0 width=100% cellspacing="0" cellpadding="4">
|
||||
<TR>
|
||||
<FORM METHOD=POST ACTION="shop.php">
|
||||
<INPUT TYPE="hidden" name="sid" value="">
|
||||
<INPUT TYPE="hidden" name="id" value="1">
|
||||
<TD valign=top align=left>
|
||||
<!--Магазин-->
|
||||
<TR>
|
||||
<TD valign=top align=left>
|
||||
<!--Магазин-->
|
||||
<TABLE border=0 width=100% cellspacing="0" cellpadding="0" bgcolor="#A5A5A5">
|
||||
<TR>
|
||||
<TD align=center>Отдел "<?php
|
||||
if ($_POST['sale']) {
|
||||
echo "Скупка";
|
||||
} else
|
||||
switch ($_GET['otdel']) {
|
||||
default:
|
||||
echo "Оружие: кастеты,ножи";
|
||||
$_GET['otdel'] = 1;
|
||||
break;
|
||||
case 1:
|
||||
echo "Оружие: кастеты,ножи";
|
||||
break;
|
||||
case 11:
|
||||
echo "Оружие: топоры";
|
||||
break;
|
||||
case 12:
|
||||
echo "Оружие: дубины,булавы";
|
||||
break;
|
||||
case 13:
|
||||
echo "Оружие: мечи";
|
||||
break;
|
||||
case 14:
|
||||
echo "Оружие: луки и арбалеты";
|
||||
break;
|
||||
case 2:
|
||||
echo "Одежда: сапоги";
|
||||
break;
|
||||
case 21:
|
||||
echo "Одежда: перчатки";
|
||||
break;
|
||||
case 22:
|
||||
echo "Одежда: легкая броня";
|
||||
break;
|
||||
case 23:
|
||||
echo "Одежда: тяжелая броня";
|
||||
break;
|
||||
case 24:
|
||||
echo "Одежда: шлемы";
|
||||
break;
|
||||
case 3:
|
||||
echo "Щиты";
|
||||
break;
|
||||
case 4:
|
||||
echo "Ювелирные товары: серьги";
|
||||
break;
|
||||
case 41:
|
||||
echo "Ювелирные товары: ожерелья";
|
||||
break;
|
||||
case 42:
|
||||
echo "Ювелирные товары: кольца";
|
||||
break;
|
||||
case 5:
|
||||
echo "Заклинания: нейтральные";
|
||||
break;
|
||||
case 51:
|
||||
echo "Заклинания: боевые и защитные";
|
||||
break;
|
||||
case 6:
|
||||
echo "Амуниция";
|
||||
break;
|
||||
case 52:
|
||||
echo "Руны";
|
||||
break;
|
||||
}
|
||||
?>"
|
||||
<span style="float: right; padding-right: 15px;">
|
||||
<label>
|
||||
<select style="width: 215px;" onchange="check(this.selectedIndex);">
|
||||
<option value="1" <?php if ($_SESSION['type_sort'] == 1) {
|
||||
echo "selected='selected'";
|
||||
} ?>
|
||||
onclick="location.href='shop.php?razdel=<?= $_GET['otdel']; ?>&sort=1';">Показывать все вещи</option>
|
||||
<option value="2" <?php if ($_SESSION['type_sort'] == 2) {
|
||||
echo "selected='selected'";
|
||||
} ?>
|
||||
onclick="location.href='shop.php?razdel=<?= $_GET['otdel']; ?>&sort=2';">Показывать вещи только моего уровня</option>
|
||||
</select>
|
||||
</label>
|
||||
</span>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<TABLE BORDER=0 WIDTH=100% CELLSPACING="1" CELLPADDING="2" BGCOLOR="#A5A5A5">
|
||||
<?php
|
||||
if ($_REQUEST['sale']) {
|
||||
$data = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `dressed` = 0 AND `setsale` = 0 AND `cost` > 0 AND `present` = '' AND `tradesale` = 0 AND `podzem` = 0 ORDER BY `update` DESC");
|
||||
while ($row = mysql_fetch_array($data)) {
|
||||
$row['count'] = 1;
|
||||
if ($i == 0) {
|
||||
$i = 1;
|
||||
$color = '#C7C7C7';
|
||||
} else {
|
||||
$i = 0;
|
||||
$color = '#D5D5D5';
|
||||
}
|
||||
echo "<tr bgcolor={$color}><td align=center style='width: 150px;'><img src=\"i/sh/{$row['img']}\" border=0 />";
|
||||
$price = $row['cost'] * 1;
|
||||
if ($data['koll']) {
|
||||
$price *= $data['koll'];
|
||||
}
|
||||
if ($row['type'] == 12) {
|
||||
$allcost = round($price * (1 - $row['duration'] / $row['maxdur']), 2);
|
||||
} else {
|
||||
$allcost = round($price - $row['duration'] * ($row['cost'] / ($row['maxdur'] * 10)), 2);
|
||||
}
|
||||
if ($row['goden'] != 0) {
|
||||
$goden_max = $row['goden'] * 24 * 60;
|
||||
$goden_left = ($row['dategoden'] - time()) / 60;
|
||||
$per = $goden_left / $goden_max;
|
||||
$allcost = round(($allcost * $per), 2);
|
||||
}
|
||||
?>
|
||||
<br/><a href="shop.php?sed=<?= $row['id'] ?>&sid=&sale=1">продать
|
||||
за <?= $allcost ?></a>
|
||||
</td>
|
||||
<?php
|
||||
echo "<td valign=top class=\"row\">";
|
||||
showitem($row);
|
||||
echo "</TD></TR>";
|
||||
}
|
||||
} else {
|
||||
|
||||
if (!isset($_SESSION['type_sort'])) {
|
||||
$_SESSION['type_sort'] = 1;
|
||||
$where = '';
|
||||
} elseif ($_SESSION['type_sort'] == 1) {
|
||||
$where = '';
|
||||
} elseif ($_SESSION['type_sort'] == 2) {
|
||||
$where = ' AND `nlevel` = "' . $user['level'] . '"';
|
||||
}
|
||||
|
||||
|
||||
<TABLE border=0 width=100% cellspacing="0" cellpadding="0" bgcolor="#A5A5A5">
|
||||
<TR>
|
||||
<TD align=center><B>Отдел "<?php
|
||||
if ($_POST['sale']) {
|
||||
echo "Скупка";
|
||||
} else
|
||||
switch ($_GET['otdel']) {
|
||||
case null:
|
||||
echo "Оружие: кастеты,ножи";
|
||||
$_GET['otdel'] = 1;
|
||||
break;
|
||||
case 1:
|
||||
echo "Оружие: кастеты,ножи";
|
||||
break;
|
||||
|
||||
case 11:
|
||||
echo "Оружие: топоры";
|
||||
break;
|
||||
|
||||
case 12:
|
||||
echo "Оружие: дубины,булавы";
|
||||
break;
|
||||
|
||||
case 13:
|
||||
echo "Оружие: мечи";
|
||||
break;
|
||||
|
||||
case 14:
|
||||
echo "Оружие: луки и арбалеты";
|
||||
break;
|
||||
|
||||
case 2:
|
||||
echo "Одежда: сапоги";
|
||||
break;
|
||||
|
||||
case 21:
|
||||
echo "Одежда: перчатки";
|
||||
break;
|
||||
|
||||
case 22:
|
||||
echo "Одежда: легкая броня";
|
||||
break;
|
||||
|
||||
case 23:
|
||||
echo "Одежда: тяжелая броня";
|
||||
break;
|
||||
|
||||
case 24:
|
||||
echo "Одежда: шлемы";
|
||||
break;
|
||||
|
||||
case 3:
|
||||
echo "Щиты";
|
||||
break;
|
||||
|
||||
case 4:
|
||||
echo "Ювелирные товары: серьги";
|
||||
break;
|
||||
|
||||
case 41:
|
||||
echo "Ювелирные товары: ожерелья";
|
||||
break;
|
||||
|
||||
case 42:
|
||||
echo "Ювелирные товары: кольца";
|
||||
break;
|
||||
|
||||
case 5:
|
||||
echo "Заклинания: нейтральные";
|
||||
break;
|
||||
|
||||
case 51:
|
||||
echo "Заклинания: боевые и защитные";
|
||||
break;
|
||||
case 6:
|
||||
echo "Амуниция";
|
||||
break;
|
||||
case 52:
|
||||
echo "Руны";
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>"</B>
|
||||
<span style="float: right; padding-right: 15px;"><select style="width: 215px;" onchange="check(this.selectedIndex);"><option value="1" <? if($_SESSION['type_sort'] == 1) { echo "selected='selected'"; } ?> onclick="location.href='shop.php?razdel=<?=$_GET['otdel'];?>&sort=1';">Показывать все вещи</option><option value="2" <? if($_SESSION['type_sort'] == 2) { echo "selected='selected'"; } ?> onclick="location.href='shop.php?razdel=<?=$_GET['otdel'];?>&sort=2';">Показывать вещи только моего уровня</option></select><br /></span>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR><TD>
|
||||
<TABLE BORDER=0 WIDTH=100% CELLSPACING="1" CELLPADDING="2" BGCOLOR="#A5A5A5">
|
||||
<?
|
||||
if($_REQUEST['sale']) {
|
||||
$data = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `dressed` = 0 AND `setsale` = 0 AND `cost` > 0 AND `present` = '' AND `tradesale` = 0 AND `podzem` = 0 ORDER BY `update` DESC");
|
||||
while($row = mysql_fetch_array($data)) {
|
||||
$row['count'] = 1;
|
||||
if($i == 0) {
|
||||
$i = 1; $color = '#C7C7C7';
|
||||
} else {
|
||||
$i = 0; $color = '#D5D5D5';
|
||||
}
|
||||
echo "<tr bgcolor={$color}><td align=center style='width: 150px;'><img src=\"i/sh/{$row['img']}\" border=0 />";
|
||||
$price = $row['cost']*1;
|
||||
if($data['koll']) {
|
||||
$price*$data['koll'];
|
||||
}
|
||||
if($row['type'] == 12) {
|
||||
$allcost = round($price*(1-$row['duration']/$row['maxdur']), 2);
|
||||
} else {
|
||||
$allcost = round($price-$row['duration']*($row['cost']/($row['maxdur']*10)), 2);
|
||||
}
|
||||
if($row['goden'] != 0) {
|
||||
$goden_max = $row['goden']*24*60;
|
||||
$goden_left = ($row['dategoden']-time())/60;
|
||||
$per = $goden_left/$goden_max;
|
||||
$allcost = round(($allcost*$per), 2);
|
||||
}
|
||||
?>
|
||||
<br /><a href="shop.php?sed=<?=$row['id']?>&sid=&sale=1">продать за <?=$allcost?></a>
|
||||
</td>
|
||||
<?php
|
||||
echo "<td valign=top class=\"row\">";
|
||||
showitem ($row);
|
||||
echo "</TD></TR>";
|
||||
}
|
||||
} else {
|
||||
|
||||
|
||||
|
||||
if(!isset($_SESSION['type_sort'])) {
|
||||
$_SESSION['type_sort'] = 1;
|
||||
$where = '';
|
||||
} elseif($_SESSION['type_sort'] == 1) {
|
||||
$where = '';
|
||||
} elseif($_SESSION['type_sort'] == 2) {
|
||||
$where = ' AND `nlevel` = "'.$user['level'].'"';
|
||||
}
|
||||
|
||||
|
||||
$arr_sort = array(11, 13, 12); #$item
|
||||
$data = mysql_query("SELECT `id`, `img`, `name` FROM `shop` WHERE `count` > 0 AND `razdel` = '{$_GET['otdel']}' $where ORDER by `nlevel` ASC, `id` ASC");
|
||||
while($row = mysql_fetch_array($data)) {
|
||||
if ($i==0) { $i = 1; $color = '#C7C7C7';} else { $i = 0; $color = '#D5D5D5'; }
|
||||
echo "<TR bgcolor={$color}><TD align=center style='width:150px'><IMG SRC=\"i/sh/{$row['img']}\" BORDER=0>";
|
||||
?>
|
||||
<BR><A HREF="shop.php?otdel=<?=$_GET['otdel']?>&set=<?=$row['id']?>&sid=<? echo rand(10000, 1000000);?>">купить</A>
|
||||
<IMG SRC="i/up.gif" WIDTH=11 HEIGHT=11 BORDER=0 ALT="Купить несколько штук" style="cursor:hand" onclick="addCountItems('<?=$row['id']?>', '<?=$row['name']?>')"></TD>
|
||||
<?php
|
||||
echo "<TD valign=top>";
|
||||
echo show_shop_items($row['id']);
|
||||
//showitem ($row);
|
||||
echo "</TD></TR>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</TABLE>
|
||||
</TD></TR>
|
||||
</TABLE>
|
||||
|
||||
</TD>
|
||||
<TD valign=top width=280>
|
||||
|
||||
|
||||
<div style="MARGIN-LEFT:15px; MARGIN-TOP: 10px;">
|
||||
|
||||
<CENTER><B>Масса всех ваших вещей: <?php
|
||||
|
||||
|
||||
echo $d[0];
|
||||
?>/<?=get_meshok()?><BR>
|
||||
У вас в наличии: <FONT COLOR="#339900"><?=$user['money']?></FONT> кр.</B></CENTER><hr>
|
||||
|
||||
<INPUT TYPE="submit" value="Продать вещи" name="sale"><BR><br />
|
||||
<div class="filter-title" style="padding: 3px 0px 3px 3px; background-color: #ebebeb; color: #595959; font-weight: bold;">Оружие</div>
|
||||
<A HREF="shop.php?otdel=1&sid=&0.162486541405194"> Кастеты, ножи</A><BR>
|
||||
<A HREF="shop.php?otdel=11&sid=&0.337606814894404"> Топоры</A><BR>
|
||||
<A HREF="shop.php?otdel=12&sid=&0.286790872806733"> Дубины, булавы</A><BR>
|
||||
<A HREF="shop.php?otdel=13&sid=&0.0943516060419363"> Мечи</A><BR>
|
||||
<div class="filter-title" style="padding: 3px 0px 3px 3px; background-color: #ebebeb; color: #595959; font-weight: bold;">Обмундирование</div>
|
||||
<A HREF="shop.php?otdel=2&sid=&0.76205958316951"> Сапоги</A><BR>
|
||||
<A HREF="shop.php?otdel=21&sid=&0.648260824682342"> Перчатки</A><BR>
|
||||
<A HREF="shop.php?otdel=22&sid=&0.520447517792988"> Легкая броня</A><BR>
|
||||
<A HREF="shop.php?otdel=23&sid=&0.99133839275569"> Тяжелая броня</A><BR>
|
||||
<A HREF="shop.php?otdel=24&sid=&0.567932791291376"> Шлемы</A><BR>
|
||||
<A HREF="shop.php?otdel=3&sid=&0.725667864710179"> Щиты</A><BR>
|
||||
<A HREF="shop.php?otdel=4&sid=&0.321709306035984"> Серьги</A><BR>
|
||||
<A HREF="shop.php?otdel=41&sid=&0.902093651333512"> Ожерелья</A><BR>
|
||||
<A HREF="shop.php?otdel=42&sid=&0.510210803380268"> Кольца</A><BR>
|
||||
<div class="filter-title" style="padding: 3px 0px 3px 3px; background-color: #ebebeb; color: #595959; font-weight: bold;">Заклинания</div>
|
||||
<A HREF="shop.php?otdel=51&sid=&0.722009624500359"> Боевые</A><BR>
|
||||
<A HREF="shop.php?otdel=5&sid=&0.648834385828923"> Разные</A><BR>
|
||||
<div class="filter-title" style="padding: 3px 0px 3px 3px; background-color: #ebebeb; color: #595959; font-weight: bold;">Прочее</div>
|
||||
<A HREF="shop.php?otdel=6&sid=&0.925798340638547"> Амуниция</A><BR>
|
||||
</div>
|
||||
<div id="hint3" class="ahint" style="width: 305px;"></div>
|
||||
|
||||
</TD>
|
||||
</FORM>
|
||||
</TR>
|
||||
$arr_sort = array(11, 13, 12); #$item
|
||||
$data = mysql_query("SELECT `id`, `img`, `name` FROM `shop` WHERE `count` > 0 AND `razdel` = '{$_GET['otdel']}' $where ORDER by `nlevel` ASC, `id` ASC");
|
||||
while ($row = mysql_fetch_array($data)) {
|
||||
if ($i == 0) {
|
||||
$i = 1;
|
||||
$color = '#C7C7C7';
|
||||
} else {
|
||||
$i = 0;
|
||||
$color = '#D5D5D5';
|
||||
}
|
||||
echo "<TR bgcolor={$color}><TD align=center style='width:150px'><IMG SRC=\"i/sh/{$row['img']}\" BORDER=0>";
|
||||
?>
|
||||
<BR>
|
||||
<A HREF="shop.php?otdel=<?= $_GET['otdel'] ?>&set=<?= $row['id'] ?>&sid=<? echo rand(10000, 1000000); ?>">купить</A>
|
||||
<IMG SRC="i/up.gif" WIDTH=11 HEIGHT=11 BORDER=0 ALT="Купить несколько штук"
|
||||
style="cursor:hand"
|
||||
onclick="addCountItems('<?= $row['id'] ?>', '<?= $row['name'] ?>')"></TD>
|
||||
<?php
|
||||
echo "<TD valign=top>";
|
||||
echo show_shop_items($row['id']);
|
||||
//showitem ($row);
|
||||
echo "</TD></TR>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</TABLE>
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</TD>
|
||||
<TD valign=top width=280>
|
||||
<B>Масса всех ваших вещей: <?= $itemWeight['m'] ?>/<?= get_meshok() ?>
|
||||
<BR>У вас в наличии: <span style="color: #339900;"><?= $user['money'] ?></span> кр.</B>
|
||||
<hr>
|
||||
<INPUT TYPE="submit" value="Продать вещи" name="sale"><BR><br/>
|
||||
<dl>
|
||||
<dt><b>Оружие:</b></dt>
|
||||
<dd><a href="shop.php?otdel=1&rnd=<?= mt_rand() ?>">кастеты,ножи</a></dd>
|
||||
<dd><a href="shop.php?otdel=11&rnd=<?= mt_rand() ?>">топоры</a></dd>
|
||||
<dd><a href="shop.php?otdel=12&rnd=<?= mt_rand() ?>">дубины,булавы</a></dd>
|
||||
<dd><a href="shop.php?otdel=13&rnd=<?= mt_rand() ?>">мечи</a></dd>
|
||||
<dt><b>Одежда:</b></dt>
|
||||
<dd><a href="shop.php?otdel=24&rnd=<?= mt_rand() ?>">шлемы</a></dd>
|
||||
<dd><a href="shop.php?otdel=23&rnd=<?= mt_rand() ?>">тяжелая броня</a></dd>
|
||||
<dd><a href="shop.php?otdel=22&rnd=<?= mt_rand() ?>">легкая броня</a></dd>
|
||||
<dd><a href="shop.php?otdel=3&rnd=<?= mt_rand() ?>">щиты</a></dd>
|
||||
<dd><a href="shop.php?otdel=21&rnd=<?= mt_rand() ?>">перчатки</a></dd>
|
||||
<dd><a href="shop.php?otdel=2&rnd=<?= mt_rand() ?>">сапоги</a></dd>
|
||||
<dt><b>Ювелирные товары:</b></dt>
|
||||
<dd><a href="shop.php?otdel=4&rnd=<?= mt_rand() ?>">серьги</a></dd>
|
||||
<dd><a href="shop.php?otdel=41&rnd=<?= mt_rand() ?>">ожерелья</a></dd>
|
||||
<dd><a href="shop.php?otdel=42&rnd=<?= mt_rand() ?>">кольца</a></dd>
|
||||
<dt><b>Магия:</b></dt>
|
||||
<dd><a href="shop.php?otdel=51&rnd=<?= mt_rand() ?>">боевые</a></dd>
|
||||
<dd><a href="shop.php?otdel=5&rnd=<?= mt_rand() ?>">разные</a></dd>
|
||||
<dt><b>Разное:</b></dt>
|
||||
<dd><a href="shop.php?otdel=6&rnd=<?= mt_rand() ?>">амуниция</a></dd>
|
||||
</dl>
|
||||
<div id="hint3" class="ahint"></div>
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</BODY>
|
||||
</HTML>
|
Loading…
Reference in New Issue
Block a user