2018-01-28 16:40:49 +00:00
|
|
|
|
<?php
|
|
|
|
|
session_start();
|
|
|
|
|
if ($_SESSION['uid'] == null) header("Location: index.php");
|
|
|
|
|
include "config.php";
|
|
|
|
|
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"));
|
|
|
|
|
include "functions.php";
|
|
|
|
|
if ($_GET['naz']) {
|
|
|
|
|
mysql_query("UPDATE `users`,`online` SET `users`.`room` = '403',`online`.`room` = '403' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
|
|
|
|
|
mysql_query("UPDATE `labirint` SET `location` = '28',`l`='478',`t`='214' WHERE `user_id` = '{$_SESSION['uid']}'");
|
|
|
|
|
print "<script>location.href='canalizaciya.php'</script>";
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$d = mysql_fetch_array(mysql_query("SELECT sum(`massa`) FROM `inventory` WHERE `owner` = '{$_SESSION['uid']}' AND `dressed` = 0 AND `setsale` = 0 ; "));
|
|
|
|
|
if ($user['room'] != 404) { header("Location: main.php"); die(); }
|
|
|
|
|
if ($user['battle'] != 0) { header('location: fbattle.php'); die(); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (($_GET['set'] OR $_POST['set'])) {
|
|
|
|
|
if ($_GET['set']) { $set = $_GET['set']; }
|
|
|
|
|
if ($_POST['set']) { $set = $_POST['set']; }
|
|
|
|
|
if (!$_POST['count']) { $_POST['count'] =1; }
|
|
|
|
|
$vear = mysql_query("SELECT maxdur,id FROM `inventory` WHERE `type`='200' and `name`='Жетон' and owner='".$user["id"]."'");
|
|
|
|
|
while($vls = mysql_fetch_array($vear))
|
|
|
|
|
{
|
|
|
|
|
$zetons += $vls['maxdur'];
|
|
|
|
|
$vls_id = $vls['id'];
|
|
|
|
|
}
|
|
|
|
|
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `luka_shop` WHERE `id` = '{$set}' LIMIT 1;"));
|
|
|
|
|
if (($dress['massa']*$_POST['count']+$d[0]) > (get_meshok())) {
|
|
|
|
|
echo "<font color=red><b>Недостаточно места в рюкзаке.</b></font>";
|
|
|
|
|
}
|
|
|
|
|
elseif(($zetons >= ($dress['zeton']*$_POST['count'])) && ($dress['count'] >= $_POST['count'])) {
|
|
|
|
|
|
|
|
|
|
for($k=1;$k<=$_POST['count'];$k++) {
|
|
|
|
|
if(mysql_query("INSERT INTO `inventory`
|
|
|
|
|
(`prototype`,`owner`,`name`,`type`, `present`, `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`
|
|
|
|
|
)
|
|
|
|
|
VALUES
|
|
|
|
|
('{$dress['id']}','{$_SESSION['uid']}','{$dress['name']}','{$dress['type']}', 'Подземка', {$dress['massa']},0.00,'{$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']}'
|
|
|
|
|
) ;"))
|
|
|
|
|
{
|
|
|
|
|
$good = 1;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$good = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ($good) {
|
|
|
|
|
mysql_query("UPDATE `luka_shop` SET `count`=`count`-{$_POST['count']} WHERE `id` = '{$set}' LIMIT 1;");
|
|
|
|
|
echo "<font color=red><b>Вы купили {$_POST['count']} шт. \"{$dress['name']}\".</b></font>";
|
|
|
|
|
$vsego = $zetons-$_POST['count']*$dress['zeton'];
|
|
|
|
|
if($vsego<='0'){
|
|
|
|
|
mysql_query("DELETE FROM `inventory` WHERE `type`='200' and `name`='Жетон' and owner='".$user["id"]."'");
|
|
|
|
|
}else{
|
|
|
|
|
$mas = $vsego*0.1;
|
|
|
|
|
mysql_query("UPDATE `inventory` set `maxdur` = '$vsego',massa='$mas' WHERE `type`='200' and `name`='Жетон' and owner='".$user["id"]."'");}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$zetons -= $_POST['count']*$dress['zeton'];
|
|
|
|
|
$limit=$_POST['count'];
|
|
|
|
|
$invdb = mysql_query("SELECT `id` FROM `inventory` WHERE `name` = '".$dress['name']."' ORDER by `id` DESC LIMIT ".$limit." ;" );
|
|
|
|
|
//$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['zeton'];
|
|
|
|
|
mysql_query("INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`) VALUES ('','0','{$_SESSION['uid']}','\"".$user['login']."\" купил товар: \"".$dress['name']."\" ".$dresscount."id:(".$dressid.") [0/".$dress['koll']."] за ".$allcost." жетон. ',1,'".time()."');");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo "<font color=red><b>Недостаточно жетонов или нет вещей в наличии.</b></font>";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
<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 LANGUAGE="JavaScript">
|
|
|
|
|
function AddCount(name, txt,event){
|
2019-01-16 17:45:30 +00:00
|
|
|
|
let x = y = 0;
|
|
|
|
|
if (document.attachEvent != null) { // Internet Explorer & Opera
|
2018-01-28 16:40:49 +00:00
|
|
|
|
x = window.event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
|
|
|
|
|
y = window.event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
|
|
|
|
|
}
|
|
|
|
|
else if (!document.attachEvent && document.addEventListener) { // Gecko
|
|
|
|
|
x = event.clientX + window.scrollX;
|
|
|
|
|
y = event.clientY + window.scrollY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
document.getElementById("hint3").innerHTML = '<form method=post style="margin:0px; padding:0px;"><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: pointer" 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" id="countTOV" NAME="count" size=4 ></td><td width=20%> <INPUT TYPE="submit" value=" »» ">'+
|
|
|
|
|
'</TD></TR></TABLE></td></tr></table></form>';
|
|
|
|
|
document.getElementById("hint3").style.visibility = "visible";
|
|
|
|
|
document.getElementById("hint3").style.left = x+7;
|
|
|
|
|
document.getElementById("hint3").style.top = y-40;
|
|
|
|
|
document.getElementById("countTOV").focus();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Закрывает окно
|
|
|
|
|
function closehint3()
|
|
|
|
|
{
|
|
|
|
|
document.all("hint3").style.visibility="hidden";
|
|
|
|
|
}
|
|
|
|
|
</SCRIPT>
|
|
|
|
|
</HEAD>
|
|
|
|
|
<body leftmargin=5 topmargin=5 marginwidth=5 marginheight=5 bgcolor=#e0e0e0>
|
|
|
|
|
<TABLE border=0 width=100% cellspacing="0" cellpadding="0">
|
|
|
|
|
<FORM action="luka_shop.php" method=GET>
|
|
|
|
|
<tr><td><h3>Магазин Луки</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="naz"></td></tr>
|
|
|
|
|
</FORM>
|
|
|
|
|
</table>
|
|
|
|
|
<TABLE border=0 width=100% cellspacing="0" cellpadding="4">
|
|
|
|
|
<TR>
|
|
|
|
|
<FORM METHOD=POST ACTION="shop_luka.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 ($_POST['sale']) {
|
|
|
|
|
echo "Скупка";
|
|
|
|
|
} else
|
|
|
|
|
switch ($_GET['otdel']) {
|
|
|
|
|
case null:
|
|
|
|
|
echo "Амуниция: малые эликсиры";
|
|
|
|
|
$_GET['otdel'] = 61;
|
|
|
|
|
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 25:
|
|
|
|
|
echo "Наручи";
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 26:
|
|
|
|
|
echo "Пояса";
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 27:
|
|
|
|
|
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 61:
|
|
|
|
|
echo "Амуниция: малые эликсиры";
|
|
|
|
|
break;
|
|
|
|
|
case 62:
|
|
|
|
|
echo "Амуниция: средние эликсиры";
|
|
|
|
|
break;
|
|
|
|
|
case 63:
|
|
|
|
|
echo "Амуниция: большие эликсиры";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
?>"</B>
|
|
|
|
|
|
|
|
|
|
</TD>
|
|
|
|
|
</TR>
|
|
|
|
|
<TR><TD><!--Рюкзак-->
|
|
|
|
|
<TABLE WIDTH=100% CELLSPACING="0" CELLPADDING="0" BGCOLOR="#A5A5A5">
|
|
|
|
|
<?
|
|
|
|
|
|
|
|
|
|
$data = mysql_query("SELECT * FROM `luka_shop` WHERE `count` > 0 AND `razdel` = '{$_GET['otdel']}'");
|
|
|
|
|
while($row = mysql_fetch_array($data)) {
|
|
|
|
|
if ($i==0) { $i = 1; $color = '#C7C7C7';} else { $i = 0; $color = '#D5D5D5'; }
|
|
|
|
|
echo "<TR bordercolor='#000000' bgcolor={$color}><TD align=center style='width:150px'><IMG SRC=\"i/sh/{$row['img']}\" BORDER=0>";
|
|
|
|
|
?>
|
|
|
|
|
<BR><A HREF="luka_shop.php?otdel=<?=$_GET['otdel']?>&set=<?=$row['id']?>&sid=">купить</A>
|
|
|
|
|
<IMG SRC="i/up.gif" WIDTH=11 HEIGHT=11 BORDER=0 ALT="Купить несколько штук" style="position: absolute; cursor:pointer;" onclick="AddCount('<?=$row['id']?>', '<?=$row['name']?>', event)"></TD>
|
|
|
|
|
<?php
|
|
|
|
|
echo "<TD valign=top>";
|
|
|
|
|
showitem ($row);
|
|
|
|
|
echo "</TD></TR>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
</TABLE>
|
|
|
|
|
</TD></TR>
|
|
|
|
|
</TABLE>
|
|
|
|
|
|
|
|
|
|
</TD>
|
|
|
|
|
<TD valign=top width=280>
|
|
|
|
|
|
|
|
|
|
<CENTER><B>Масса всех ваших вещей: <?php
|
|
|
|
|
$puk = mysql_query("SELECT maxdur,id FROM `inventory` WHERE `type`='200' and `name`='Жетон' and owner='".$user["id"]."'");
|
|
|
|
|
while($lak = mysql_fetch_array($puk))
|
|
|
|
|
{
|
|
|
|
|
$zetonss += $lak['maxdur'];
|
|
|
|
|
$vls_id = $lak['id'];
|
|
|
|
|
}
|
|
|
|
|
if($zetonss==''){$zetonss=0;}
|
|
|
|
|
?>
|
2018-12-12 20:21:47 +00:00
|
|
|
|
<CENTER><B>Масса ваших вещей: <?= getItemsMassaInfo() ?><BR>
|
|
|
|
|
У вас в наличии: <FONT COLOR="#339900"><?= $zetonss ?></FONT> Жетон.</B></CENTER>
|
2018-01-28 16:40:49 +00:00
|
|
|
|
<div style="MARGIN-LEFT:15px; MARGIN-TOP: 10px;">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div style="background-color:#d2d0d0;padding:1"><center><font color="#oooo"><B>Отделы магазина</B></center></div></center>
|
|
|
|
|
<?php
|
|
|
|
|
/*
|
|
|
|
|
<A HREF="luka_shop.php?otdel=1&sid=&0.162486541405194">Оружие: кастеты,ножи</A><BR>
|
|
|
|
|
<A HREF="luka_shop.php?otdel=11&sid=&0.337606814894404"> топоры</A><BR>
|
|
|
|
|
<A HREF="luka_shop.php?otdel=12&sid=&0.286790872806733"> дубины,булавы</A><BR>
|
|
|
|
|
<A HREF="luka_shop.php?otdel=13&sid=&0.0943516060419363"> мечи</A><BR>
|
|
|
|
|
<A HREF="luka_shop.php?otdel=14&sid=&0.0943516060419363"> луки и арбалеты</A><BR>
|
|
|
|
|
<A HREF="luka_shop.php?otdel=2&sid=&0.76205958316951">Одежда: сапоги</A><BR>
|
|
|
|
|
<A HREF="luka_shop.php?otdel=21&sid=&0.648260824682342"> перчатки</A><BR>
|
|
|
|
|
<A HREF="luka_shop.php?otdel=22&sid=&0.520447517792988"> легкая броня</A><BR>
|
|
|
|
|
<A HREF="luka_shop.php?otdel=23&sid=&0.99133839275569"> тяжелая броня</A><BR>
|
|
|
|
|
<A HREF="luka_shop.php?otdel=24&sid=&0.567932791291376"> шлемы</A><BR>
|
|
|
|
|
<A HREF="luka_shop.php?otdel=3&sid=&0.725667864710179">Щиты</A><BR>
|
|
|
|
|
<A HREF="luka_shop.php?otdel=4&sid=&0.321709306035984">Ювелирные товары: серьги</A><BR>
|
|
|
|
|
<A HREF="luka_shop.php?otdel=41&sid=&0.902093651333512"> ожерелья</A><BR>
|
|
|
|
|
<A HREF="luka_shop.php?otdel=42&sid=&0.510210803380268"> кольца</A><BR>
|
|
|
|
|
<A HREF="luka_shop.php?otdel=5&sid=&0.648834385828923">Заклинания: нейтральные</A><BR>
|
|
|
|
|
<A HREF="luka_shop.php?otdel=51&sid=&0.722009624500359"> боевые и защитные</A><BR>
|
|
|
|
|
<A HREF="luka_shop.php?otdel=6&sid=&0.925798340638547">Амуниция</A><BR>
|
|
|
|
|
<A HREF="luka_shop.php?otdel=61&sid=&0.925798340638547"> Эликсиры</A><BR>
|
|
|
|
|
*/
|
|
|
|
|
?>
|
|
|
|
|
<A HREF="#">Амуниция</A><BR>
|
|
|
|
|
<A HREF="luka_shop.php?otdel=61&sid=&0.925798340638547"> Малые эликсиры</A><BR>
|
|
|
|
|
<A HREF="luka_shop.php?otdel=62&sid=&0.925798340638547"> Средние эликсиры</A><BR>
|
|
|
|
|
<A HREF="luka_shop.php?otdel=63&sid=&0.925798340638547"> Большие эликсиры</A><BR>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
<div id="hint3" class="ahint"></div>
|
|
|
|
|
</TD>
|
|
|
|
|
</FORM>
|
|
|
|
|
</TR>
|
|
|
|
|
</TABLE>
|
|
|
|
|
|
|
|
|
|
</BODY>
|
|
|
|
|
</HTML>
|