Обновление устаревшего кода 2.

This commit is contained in:
lopar 2018-12-12 01:20:11 +02:00
parent 3b9f888947
commit bd14bbffc6

View File

@ -1,10 +1,18 @@
<?php <?php
session_start(); session_start();
if(!isset($_SESSION['uid'])) { header("Location: index.php"); } if (!isset($_SESSION['uid'])) {
header("Location: index.php");
}
require_once("functions.php"); require_once("functions.php");
$d = db::c()->query('SELECT SUM(`massa`) FROM `inventory` WHERE `dressed` = 0 AND `owner` = ?i', $_SESSION['uid'])->fetch_assoc(); $d = db::c()->query('SELECT SUM(`massa`) FROM `inventory` WHERE `dressed` = 0 AND `owner` = ?i', $_SESSION['uid'])->fetch_assoc();
if($user['room'] != 23) { header("Location: main.php"); die(); } if ($user['room'] != 23) {
if($user['battle'] != 0) { header('location: fbattle.php'); die(); } header("Location: main.php");
die();
}
if ($user['battle'] != 0) {
header('location: fbattle.php');
die();
}
// Гравировка // Гравировка
if (input::post('set') && input::post('count') && ($user['money'] >= 30)) { if (input::post('set') && input::post('count') && ($user['money'] >= 30)) {
@ -47,8 +55,7 @@ if($_GET['sid'] && $_GET['rep']) {
$onecost = 0.1; $onecost = 0.1;
if (($onecost * 10) <= $user['money']) { if (($onecost * 10) <= $user['money']) {
if(mysql_query("UPDATE `inventory` SET `duration` = `duration`-10 WHERE `id` = {$_GET['rep']}")) if (mysql_query("UPDATE `inventory` SET `duration` = `duration`-10 WHERE `id` = {$_GET['rep']}")) {
{
$err = "<font color=red><b>Произведен ремонт предмета \"{$row['name']}\" за " . (round($onecost, 2) * 10) . " кр. </b></font>"; $err = "<font color=red><b>Произведен ремонт предмета \"{$row['name']}\" за " . (round($onecost, 2) * 10) . " кр. </b></font>";
mysql_query("UPDATE `users` set `money` = `money`- '" . (round($onecost, 2) * 10) . "' WHERE id = {$user['id']}"); mysql_query("UPDATE `users` set `money` = `money`- '" . (round($onecost, 2) * 10) . "' WHERE id = {$user['id']}");
$newduration = $row['duration'] - 10; $newduration = $row['duration'] - 10;
@ -72,8 +79,7 @@ if($_GET['sid'] && $_GET['rep']) {
//if($onecost < 0.1) {$onecost=0.1;} //if($onecost < 0.1) {$onecost=0.1;}
$onecost = 0.1; $onecost = 0.1;
if (round($onecost * $full) <= $user['money']) { if (round($onecost * $full) <= $user['money']) {
if(mysql_query("UPDATE `inventory` SET `duration` = '0' WHERE `id` = {$_GET['rep']}")) if (mysql_query("UPDATE `inventory` SET `duration` = '0' WHERE `id` = {$_GET['rep']}")) {
{
$err = "<font color=red><b>Произведен ремонт предмета \"{$row['name']}\" за " . (round($onecost, 2) * $full) . " кр. </b></font>"; $err = "<font color=red><b>Произведен ремонт предмета \"{$row['name']}\" за " . (round($onecost, 2) * $full) . " кр. </b></font>";
mysql_query("UPDATE `users` set `money` = `money`- '" . (round($onecost, 2) * $full) . "' WHERE id = {$user['id']}"); mysql_query("UPDATE `users` set `money` = `money`- '" . (round($onecost, 2) * $full) . "' WHERE id = {$user['id']}");
mysql_query("INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`) VALUES ('','0','{$user['id']}','Отремонтирован предмет \"" . $row['name'] . "\" id:(cap" . $row['id'] . ") [0/" . $row['maxdur'] . "] у \"" . $user['login'] . "\" за " . (round($onecost, 2) * $full) . " кр. ',1,'" . time() . "');"); mysql_query("INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`) VALUES ('','0','{$user['id']}','Отремонтирован предмет \"" . $row['name'] . "\" id:(cap" . $row['id'] . ") [0/" . $row['maxdur'] . "] у \"" . $user['login'] . "\" за " . (round($onecost, 2) * $full) . " кр. ',1,'" . time() . "');");
@ -83,94 +89,94 @@ if($_GET['sid'] && $_GET['rep']) {
mysql_query("UPDATE `inventory` SET `maxdur` = `maxdur`-1 WHERE `id` = {$_GET['rep']}"); mysql_query("UPDATE `inventory` SET `maxdur` = `maxdur`-1 WHERE `id` = {$_GET['rep']}");
} }
} }
} } else {
else {
$err = "<font color=red><b>Недостаточно денег.</b></font>"; $err = "<font color=red><b>Недостаточно денег.</b></font>";
} }
} }
break; break;
} }
} }
?> ?>
<HTML> <HTML>
<HEAD> <HEAD>
<link rel=stylesheet type="text/css" href="css/main.css"> <link rel=stylesheet href="css/main.css">
<meta content="text/html; charset=utf-8" http-equiv=Content-type> <meta charset="utf-8">
<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)
{
document.all("hint3").innerHTML = ' <FORM METHOD=POST ACTION="repair.php?razdel=1"><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><small>Какую надпись желаете выгравировать:</small></td></tr><tr><td width=80% align=right>'+
'<INPUT TYPE="text" NAME="count" size=30></td><td width=20%>&nbsp;<INPUT TYPE="submit" value=" »» ">'+
'</TD></TR></TABLE></td></tr></table>';
document.all("hint3").style.visibility = "visible";
document.all("hint3").style.left = event.x+document.body.scrollLeft-20;
document.all("hint3").style.top = event.y+document.body.scrollTop+5;
document.all("count").focus();
}
function closehint3()
{
document.all("hint3").style.visibility="hidden";
}
</SCRIPT>
</HEAD> </HEAD>
<body leftmargin=5 topmargin=5 marginwidth=5 marginheight=5 bgcolor=#d4d4d4> <body>
<TABLE border=0 width=100% cellspacing="0" cellpadding="0"> <h1>Ремонтная мастерская</h1>
<FORM action="city.php" method=GET> <a href=# onclick=leave()> ← выйти из мастерской</a>
<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')"> <TABLE width=100%>
<INPUT TYPE="submit" value="Вернуться" name="cp"></td></tr>
</FORM>
</table>
<TABLE border=0 width=100% cellspacing="0" cellpadding="4">
<TR> <TR>
<FORM METHOD=POST ACTION="repair.php"> <FORM METHOD=POST ACTION="repair.php">
<INPUT TYPE="hidden" name="sid" value=""> <INPUT TYPE="hidden" name="sid" value="">
<INPUT TYPE="hidden" name="id" value="1"> <INPUT TYPE="hidden" name="id" value="1">
<TD valign=top align=left> <TD valign=top align=left>
<TABLE width=100% bgcolor="#A5A5A5">
<TABLE border=0 width=100% cellspacing="0" cellpadding="0" bgcolor="#A5A5A5"> <TR>
<TR><TD> <TD>
<TABLE border=0 width=100% cellspacing="0" cellpadding="1" bgcolor=#d4d2d2><TR> <TABLE width=100% bgcolor=#d4d2d2>
<TR>
<td align=center bgcolor=#C7C7C7><B>Залы:</B></TD> <td align=center bgcolor=#C7C7C7><B>Залы:</B></TD>
<TD align=center bgcolor="<?=($_GET['razdel']==0)?"#A5A5A5":"#C7C7C7"?>"><A HREF="?razdel=0">Ремонт</A></TD> <TD align=center bgcolor="<?= ($_GET['razdel'] == 0) ? "#A5A5A5" : "#C7C7C7" ?>"><A
<TD align=center bgcolor="<?=($_GET['razdel']==1)?"#A5A5A5":"#C7C7C7"?>"><A HREF="?razdel=1">Гравировка</A></TD> HREF="?razdel=0">Ремонт</A></TD>
<TD align=center bgcolor="<?=($_GET['razdel']==2)?"#A5A5A5":"#C7C7C7"?>"><A HREF="?razdel=2">Перезарядка магии</A></TD> <TD align=center bgcolor="<?= ($_GET['razdel'] == 1) ? "#A5A5A5" : "#C7C7C7" ?>"><A
<TD align=center bgcolor="<?=($_GET['razdel']==3)?"#A5A5A5":"#C7C7C7"?>"><A HREF="?razdel=3">Модифицирование</A></TD> HREF="?razdel=1">Гравировка</A></TD>
<TD align=center bgcolor="<?= ($_GET['razdel'] == 2) ? "#A5A5A5" : "#C7C7C7" ?>"><A
HREF="?razdel=2">Перезарядка магии</A></TD>
<TD align=center bgcolor="<?= ($_GET['razdel'] == 3) ? "#A5A5A5" : "#C7C7C7" ?>"><A
HREF="?razdel=3">Модифицирование</A></TD>
</TR> </TR>
<TR> <TR>
<td colspan=7 bgcolor=#A5A5A5> <td colspan=7 bgcolor=#A5A5A5 style="text-align: center; font-weight: bold;">
<CENTER><B><? <?php
switch ($_GET['razdel']) { switch ($_GET['razdel']) {
case 0: echo "Починка поврежденных предметов"; break; case 0:
case 1: echo "Нанесение надписей на оружие"; break; echo "Починка поврежденных предметов";
case 2: echo "Перезарядка встроеной магии</B><BR><i>Если в предмет встроена магия, мы поможем ее перезарядить за умеренную плату. Учтите, ничто не вечно под луной, в том числе и магия, рано или поздно встроенный свиток исчерпает все свои ресурсы, и мы уже не сможем его перезарядить.</i>"; break; break;
case 3: echo "Модификация предметов</B><BR><I>Наши мастера помогут вам модифицировать ваши доспехи. К сожалению, технология не позволяет повторно модифицировать вещи. Чем выше у вас интеллект, тем яснее вы сможете объяснить мастерам желаемый результат. Результат может быть непредсказуем!</I><B>"; break; case 1:
echo "Нанесение надписей на оружие";
break;
case 2:
echo "Перезарядка встроеной магии</B><BR><i>Если в предмет встроена магия, мы поможем ее перезарядить за умеренную плату. Учтите, ничто не вечно под луной, в том числе и магия, рано или поздно встроенный свиток исчерпает все свои ресурсы, и мы уже не сможем его перезарядить.</i>";
break;
case 3:
echo "Модификация предметов</B><BR><I>Наши мастера помогут вам модифицировать ваши доспехи. К сожалению, технология не позволяет повторно модифицировать вещи. Чем выше у вас интеллект, тем яснее вы сможете объяснить мастерам желаемый результат. Результат может быть непредсказуем!</I><B>";
break;
} }
?></B></CENTER> ?>
</td> </td>
</tr> </tr>
</TABLE> </TABLE>
</TR> </TR>
<TABLE BORDER=0 WIDTH=100% CELLSPACING="1" CELLPADDING="2" BGCOLOR="#A5A5A5"> <TABLE WIDTH=100% BGCOLOR="#A5A5A5">
<?php <?php
if ($_GET['razdel'] == 0) { if ($_GET['razdel'] == 0) {
$data = mysql_query("SELECT * FROM `inventory` WHERE `type` < 12 AND `owner` = '{$user['id']}' AND `dressed` = 0 AND `isrep` = 1 AND `setsale`=0 ORDER by `update` DESC; "); $data = mysql_query("SELECT * FROM `inventory` WHERE `type` < 12 AND `owner` = '{$user['id']}' AND `dressed` = 0 AND `isrep` = 1 AND `setsale`=0 ORDER by `update` DESC; ");
while ($row = mysql_fetch_array($data)) { while ($row = mysql_fetch_array($data)) {
$row['count'] = 1; $row['count'] = 1;
if ($i==0) { $i = 1; $color = '#C7C7C7';} else { $i = 0; $color = '#D5D5D5'; } if ($i == 0) {
$i = 1;
$color = '#C7C7C7';
} else {
$i = 0;
$color = '#D5D5D5';
}
echo "<TR bgcolor={$color}><TD align=center ><IMG SRC=\"i/sh/{$row['img']}\" BORDER=0>"; echo "<TR bgcolor={$color}><TD align=center ><IMG SRC=\"i/sh/{$row['img']}\" BORDER=0>";
$onecost = 0.1; $onecost = 0.1;
?> ?>
<BR><small> <BR>
<? if($row['duration'] >0){?><A HREF="?rep=<?=$row['id']?>&sid=1">Ремонт 1 ед. за <?=round($onecost,2)?> кр.</A><BR><?} else { echo "не нуждается в ремонте";}?> <small>
<? if($row['duration'] >=10){?><A HREF="?rep=<?=$row['id']?>&sid=10">Ремонт 10 ед. за <?=round(($onecost*10),2)?> кр.</A><BR><?}?> <? if ($row['duration'] > 0) { ?><A HREF="?rep=<?= $row['id'] ?>&sid=1">Ремонт 1 ед.
<? if($row['duration'] >1){?><A HREF="?rep=<?=$row['id']?>&sid=full">Полный ремонт за <?=round(($row['duration']*$onecost),2)?> кр.</A><?}?> за <?= round($onecost, 2) ?> кр.</A><BR><? } else {
echo "не нуждается в ремонте";
} ?>
<? if ($row['duration'] >= 10) { ?><A HREF="?rep=<?= $row['id'] ?>&sid=10">Ремонт 10
ед. за <?= round(($onecost * 10), 2) ?> кр.</A><BR><?
} ?>
<? if ($row['duration'] > 1) { ?><A HREF="?rep=<?= $row['id'] ?>&sid=full">Полный
ремонт за <?= round(($row['duration'] * $onecost), 2) ?> кр.</A><?
} ?>
</small> </small>
</TD> </TD>
<?php <?php
@ -180,17 +186,25 @@ if ($_GET['razdel']==0) {
} }
} }
if ($_GET['razdel'] == 1) { if ($_GET['razdel'] == 1) {
$data = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `dressed` = 0 AND `type` = 3 AND `name` NOT LIKE '%Букет%' AND `setsale`=0 ORDER by `update` DESC; "); $data = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `dressed` = 0 AND `type` = 3 AND `name` NOT LIKE '%Букет%' AND `setsale`=0 ORDER by `update` DESC; ");
while ($row = mysql_fetch_array($data)) { while ($row = mysql_fetch_array($data)) {
$row['count'] = 1; $row['count'] = 1;
if ($i==0) { $i = 1; $color = '#C7C7C7';} else { $i = 0; $color = '#D5D5D5'; } if ($i == 0) {
$i = 1;
$color = '#C7C7C7';
} else {
$i = 0;
$color = '#D5D5D5';
}
echo "<TR bgcolor={$color}><TD align=center ><IMG SRC=\"i/sh/{$row['img']}\" BORDER=0>"; echo "<TR bgcolor={$color}><TD align=center ><IMG SRC=\"i/sh/{$row['img']}\" BORDER=0>";
?> ?>
<BR><small> <BR>
<? if($row['text']== null){?><A HREF="#" onclick="AddCount(<?=$row['id']?>)">Нанести надпись за 30 кр.</A><BR><?} else { <small>
?><A HREF="?razdel=1&rep=<?=$row['id']?>&sid=2">Стереть надпись</A><BR><?}?> <? if ($row['text'] == null) { ?><A HREF="#" onclick="AddCount(<?= $row['id'] ?>)">
Нанести надпись за 30 кр.</A><BR><? } else {
?><A HREF="?razdel=1&rep=<?= $row['id'] ?>&sid=2">Стереть надпись</A><BR><?
} ?>
</small> </small>
</TD> </TD>
<?php <?php
@ -203,11 +217,9 @@ if ($_GET['razdel']==1) {
if ($_GET['razdel'] == 2) { if ($_GET['razdel'] == 2) {
if ($_GET['it']) { if ($_GET['it']) {
$row = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `dressed` = 0 AND `includemagicmax` > 0 AND `id` = '{$_GET['it']}' LIMIT 1;")); $row = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `dressed` = 0 AND `includemagicmax` > 0 AND `id` = '{$_GET['it']}' LIMIT 1;"));
if($user['money'] < $row['includemagiccost'] && $row['includemagicdex'] ==0) if ($user['money'] < $row['includemagiccost'] && $row['includemagicdex'] == 0) {
{
$err = "<font color=red><b>У вас не хватает денег на перезарядку.</b></font>"; $err = "<font color=red><b>У вас не хватает денег на перезарядку.</b></font>";
} } else {
else {
if ($row['includemagicuses'] <= 1) { if ($row['includemagicuses'] <= 1) {
$onecost = $row['includemagiccost']; $onecost = $row['includemagiccost'];
$err = "<font color=red><b>Мы сожалеем, свиток исчерпал все свои ресурсы, и мы уже не можем его перезарядить.</b></font>"; $err = "<font color=red><b>Мы сожалеем, свиток исчерпал все свои ресурсы, и мы уже не можем его перезарядить.</b></font>";
@ -224,20 +236,25 @@ if ($_GET['razdel']==2) {
} }
} }
$data = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `dressed` = 0 AND `includemagicmax` > 0 AND `setsale`=0 ORDER by `update` DESC; "); $data = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `dressed` = 0 AND `includemagicmax` > 0 AND `setsale`=0 ORDER by `update` DESC; ");
while ($row = mysql_fetch_array($data)) { while ($row = mysql_fetch_array($data)) {
$row['count'] = 1; $row['count'] = 1;
if ($i==0) { $i = 1; $color = '#C7C7C7';} else { $i = 0; $color = '#D5D5D5'; } if ($i == 0) {
$i = 1;
$color = '#C7C7C7';
} else {
$i = 0;
$color = '#D5D5D5';
}
echo "<TR bgcolor={$color}><TD align=center ><IMG SRC=\"i/sh/{$row['img']}\" BORDER=0>"; echo "<TR bgcolor={$color}><TD align=center ><IMG SRC=\"i/sh/{$row['img']}\" BORDER=0>";
?> ?>
<BR> <BR>
<small> <small>
<? <?
if ($row['includemagicdex'] == 0) { if ($row['includemagicdex'] == 0) {
?><A HREF="?razdel=2&it=<?=$row['id']?>">Перезарядить за <?=$row['includemagiccost']?> кр.</A><BR><? ?><A HREF="?razdel=2&it=<?= $row['id'] ?>">Перезарядить
} за <?= $row['includemagiccost'] ?> кр.</A><BR><?
else { } else {
echo 'Не нуждается в перезарядке'; echo 'Не нуждается в перезарядке';
} }
?> ?>
@ -249,22 +266,28 @@ if ($_GET['razdel']==2) {
echo "</TD></TR>"; echo "</TD></TR>";
} }
} }
if ($_GET['razdel'] == 3) { if ($_GET['razdel'] == 3) {
if ($_GET['mf']) { if ($_GET['mf']) {
$row = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `type` < 12 AND `type` != 3 AND `owner` = '{$_SESSION['uid']}' AND `dressed` = 0 AND `id` = '{$_GET['mf']}' AND `name` NOT LIKE '% (мф)%' LIMIT 1;")); $row = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `type` < 12 AND `type` != 3 AND `owner` = '{$_SESSION['uid']}' AND `dressed` = 0 AND `id` = '{$_GET['mf']}' AND `name` NOT LIKE '% (мф)%' LIMIT 1;"));
if ($user['money'] < $row['cost'] OR !$row) { if ($user['money'] < $row['cost'] OR !$row) {
$err = "<font color=red><b>У вас не хватает денег на модификацию.</b></font>"; $err = "<font color=red><b>У вас не хватает денег на модификацию.</b></font>";
} } else {
else {
srand(make_seed()); srand(make_seed());
$type = rand(1, 4); $type = rand(1, 4);
$mfintel = round($user['intel'] / 5 - 10); $mfintel = round($user['intel'] / 5 - 10);
if ($mfintel > -1) {$mfintel = -1;} if ($mfintel > -1) {
$mfintel = -1;
}
$statintel = round($user['intel'] / 25 - 2); $statintel = round($user['intel'] / 25 - 2);
if ($statintel > -1) {$statintel = -1;} if ($statintel > -1) {
$statintel = -1;
}
$nstatintel = round(2 - $user['intel'] / 25); $nstatintel = round(2 - $user['intel'] / 25);
if ($nstatintel < 1) {$statintel = 1;} if ($nstatintel < 1) {
$statintel = 1;
}
srand(make_seed()); srand(make_seed());
$mf1 = rand($mfintel, 10); $mf1 = rand($mfintel, 10);
srand(make_seed()); srand(make_seed());
@ -343,19 +366,26 @@ if ($_GET['razdel']==3) {
mysql_query("INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`) VALUES ('','0','{$_SESSION['uid']}','Моцифицирована вещь \"" . $row['name'] . "\" id:(cap" . $row['id'] . ") [" . $newduration . "/" . $row['maxdur'] . "] у \"" . $user['login'] . "\" за " . round($onecost, 2) . " кр. ',1,'" . time() . "');"); mysql_query("INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`) VALUES ('','0','{$_SESSION['uid']}','Моцифицирована вещь \"" . $row['name'] . "\" id:(cap" . $row['id'] . ") [" . $newduration . "/" . $row['maxdur'] . "] у \"" . $user['login'] . "\" за " . round($onecost, 2) . " кр. ',1,'" . time() . "');");
$err = "<font color=red><b>Вещь модифицирована.</b></font>"; $err = "<font color=red><b>Вещь модифицирована.</b></font>";
} }
} }
} }
$data = mysql_query("SELECT * FROM `inventory` WHERE `type` < 12 AND `type` != 3 AND `owner` = '{$_SESSION['uid']}' AND `dressed` = 0 AND `name` NOT LIKE '% (мф)%' AND `name` NOT LIKE '%Букет%' AND `setsale`=0 ORDER by `update` DESC; "); $data = mysql_query("SELECT * FROM `inventory` WHERE `type` < 12 AND `type` != 3 AND `owner` = '{$_SESSION['uid']}' AND `dressed` = 0 AND `name` NOT LIKE '% (мф)%' AND `name` NOT LIKE '%Букет%' AND `setsale`=0 ORDER by `update` DESC; ");
while ($row = mysql_fetch_array($data)) { while ($row = mysql_fetch_array($data)) {
$row['count'] = 1; $row['count'] = 1;
if ($i==0) { $i = 1; $color = '#C7C7C7';} else { $i = 0; $color = '#D5D5D5'; } if ($i == 0) {
$i = 1;
$color = '#C7C7C7';
} else {
$i = 0;
$color = '#D5D5D5';
}
echo "<TR bgcolor={$color}><TD align=center ><IMG SRC=\"i/sh/{$row['img']}\" BORDER=0>"; echo "<TR bgcolor={$color}><TD align=center ><IMG SRC=\"i/sh/{$row['img']}\" BORDER=0>";
?> ?>
<BR><small> <BR>
<A HREF="?razdel=3&mf=<?=$row['id']?>" onClick="if(!confirm('Вы действительно хотите модифицировать эту вещь?')){ return false;}">Модифицировать за <?=$row['cost']?> кр.</A><BR> <small>
<A HREF="?razdel=3&mf=<?= $row['id'] ?>"
onClick="if(!confirm('Вы действительно хотите модифицировать эту вещь?')){ return false;}">Модифицировать
за <?= $row['cost'] ?> кр.</A><BR>
</small> </small>
</TD> </TD>
<?php <?php
@ -365,7 +395,6 @@ if ($_GET['razdel']==3) {
} }
} }
if ($_GET['razdel'] == 4) { if ($_GET['razdel'] == 4) {
if ($_GET['podgon']) { if ($_GET['podgon']) {
@ -378,61 +407,87 @@ if ($_GET['razdel']==4) {
if ($user['money'] < $cost || !$row) { if ($user['money'] < $cost || !$row) {
$err = "<font color=red><b>У вас не хватает денег на подгонку.</b></font>"; $err = "<font color=red><b>У вас не хватает денег на подгонку.</b></font>";
} } else {
else {
$kol_mf = round($row['mfkrit'] + $row['mfakrit'] + $row['mfuvorot'] + $row['mfauvorot'], 0); $kol_mf = round($row['mfkrit'] + $row['mfakrit'] + $row['mfuvorot'] + $row['mfauvorot'], 0);
if ($row['podgon'] == 0) { if ($row['podgon'] == 0) {
if ($row['point'] > 0) { if ($row['point'] > 0) {
$new_cena = round(($row['point'] * 20)/100,0); $sql = '`point` = `point`+'.$new_cena; $new_cena = round(($row['point'] * 20) / 100, 0);
$user['doblest'] -= $cost; $usql = '`doblest` = "'.$user['doblest'].'"'; $cost_t = 'реп'; $sql = '`point` = `point`+' . $new_cena;
$user['doblest'] -= $cost;
$usql = '`doblest` = "' . $user['doblest'] . '"';
$cost_t = 'реп';
} else { } else {
$new_cena = round(($row['cost'] * 20)/100,0); $sql = '`cost` = `cost`+'.$new_cena; $new_cena = round(($row['cost'] * 20) / 100, 0);
$user['money'] -= $cost; $usql = '`money` = "'.$user['money'].'"'; $cost_t = 'кр'; $sql = '`cost` = `cost`+' . $new_cena;
$user['money'] -= $cost;
$usql = '`money` = "' . $user['money'] . '"';
$cost_t = 'кр';
} }
$gmf = 2; $gmf = 2;
} elseif ($row['podgon'] == 1) { } elseif ($row['podgon'] == 1) {
if ($row['point'] > 0) { if ($row['point'] > 0) {
$new_cena = round(($row['point'] * 20)/100,0); $sql = '`point` = `point`+'.$new_cena; $new_cena = round(($row['point'] * 20) / 100, 0);
$user['doblest'] -= $cost; $usql = '`doblest` = "'.$user['doblest'].'"'; $cost_t = 'реп'; $sql = '`point` = `point`+' . $new_cena;
$user['doblest'] -= $cost;
$usql = '`doblest` = "' . $user['doblest'] . '"';
$cost_t = 'реп';
} else { } else {
$new_cena = round(($row['cost'] * 20)/100,0); $sql = '`cost` = `cost`+'.$new_cena; $new_cena = round(($row['cost'] * 20) / 100, 0);
$user['money'] -= $cost; $usql = '`money` = "'.$user['money'].'"'; $cost_t = 'кр'; $sql = '`cost` = `cost`+' . $new_cena;
$user['money'] -= $cost;
$usql = '`money` = "' . $user['money'] . '"';
$cost_t = 'кр';
} }
$gmf = 3; $gmf = 3;
} elseif ($row['podgon'] == 2) { } elseif ($row['podgon'] == 2) {
if ($row['point'] > 0) { if ($row['point'] > 0) {
$new_cena = round(($row['point'] * 40)/100,0); $sql = '`point` = `point`+'.$new_cena; $new_cena = round(($row['point'] * 40) / 100, 0);
$user['doblest'] -= $cost; $usql = '`doblest` = "'.$user['doblest'].'"'; $cost_t = 'реп'; $sql = '`point` = `point`+' . $new_cena;
$user['doblest'] -= $cost;
$usql = '`doblest` = "' . $user['doblest'] . '"';
$cost_t = 'реп';
} else { } else {
$new_cena = round(($row['cost'] * 40)/100,0); $sql = '`cost` = `cost`+'.$new_cena; $new_cena = round(($row['cost'] * 40) / 100, 0);
$user['money'] -= $cost; $usql = '`money` = "'.$user['money'].'"'; $cost_t = 'кр'; $sql = '`cost` = `cost`+' . $new_cena;
$user['money'] -= $cost;
$usql = '`money` = "' . $user['money'] . '"';
$cost_t = 'кр';
} }
$gmf = 4; $gmf = 4;
} elseif ($row['podgon'] == 3) { } elseif ($row['podgon'] == 3) {
if ($row['point'] > 0) { if ($row['point'] > 0) {
$new_cena = round(($row['point'] * 70)/100,0); $sql = '`point` = `point`+'.$new_cena; $new_cena = round(($row['point'] * 70) / 100, 0);
$user['doblest'] -= $cost; $usql = '`doblest` = "'.$user['doblest'].'"'; $cost_t = 'реп'; $sql = '`point` = `point`+' . $new_cena;
$user['doblest'] -= $cost;
$usql = '`doblest` = "' . $user['doblest'] . '"';
$cost_t = 'реп';
} else { } else {
$new_cena = round(($row['cost'] * 70)/100,0); $sql = '`cost` = `cost`+'.$new_cena; $new_cena = round(($row['cost'] * 70) / 100, 0);
$user['money'] -= $cost; $usql = '`money` = "'.$user['money'].'"'; $cost_t = 'кр'; $sql = '`cost` = `cost`+' . $new_cena;
$user['money'] -= $cost;
$usql = '`money` = "' . $user['money'] . '"';
$cost_t = 'кр';
} }
$gmf = 6; $gmf = 6;
} elseif ($row['podgon'] == 4) { } elseif ($row['podgon'] == 4) {
if ($row['point'] > 0) { if ($row['point'] > 0) {
$new_cena = round(($row['point'] * 100)/100,0); $sql = '`point` = `point`+'.$new_cena; $new_cena = round(($row['point'] * 100) / 100, 0);
$user['doblest'] -= $cost; $usql = '`doblest` = "'.$user['doblest'].'"'; $cost_t = 'реп'; $sql = '`point` = `point`+' . $new_cena;
$user['doblest'] -= $cost;
$usql = '`doblest` = "' . $user['doblest'] . '"';
$cost_t = 'реп';
} else { } else {
$new_cena = round(($row['cost'] * 100)/100,0); $sql = '`cost` = `cost`+'.$new_cena; $new_cena = round(($row['cost'] * 100) / 100, 0);
$user['money'] -= $cost; $usql = '`money` = "'.$user['money'].'"'; $cost_t = 'кр'; $sql = '`cost` = `cost`+' . $new_cena;
$user['money'] -= $cost;
$usql = '`money` = "' . $user['money'] . '"';
$cost_t = 'кр';
} }
$gmf = 10; $gmf = 10;
} }
if ($row['mfkrit'] == 0 && $row['mfakrit'] == 0 && $row['mfuvorot'] == 0 && $row['mfauvorot'] == 0) { if ($row['mfkrit'] == 0 && $row['mfakrit'] == 0 && $row['mfuvorot'] == 0 && $row['mfauvorot'] == 0) {
$gmf = 0; $gmf = 0;
} }
@ -447,26 +502,35 @@ if ($_GET['razdel']==4) {
mysql_query("INSERT INTO `delo` (`author` ,`pers`, `text`, `type`, `date`) VALUES ('0','{$user['id']}','Подогнана вещь \"" . $row['name'] . "\" id:(cap" . $row['id'] . ") [" . $newduration . "/" . $row['maxdur'] . "] у \"" . $user['login'] . "\" за " . round($cost, 2) . " " . $cost_t . ". ',1,'" . time() . "');"); mysql_query("INSERT INTO `delo` (`author` ,`pers`, `text`, `type`, `date`) VALUES ('0','{$user['id']}','Подогнана вещь \"" . $row['name'] . "\" id:(cap" . $row['id'] . ") [" . $newduration . "/" . $row['maxdur'] . "] у \"" . $user['login'] . "\" за " . round($cost, 2) . " " . $cost_t . ". ',1,'" . time() . "');");
$err = "<font color=red><b>Вещь подогнана.</b></font>"; $err = "<font color=red><b>Вещь подогнана.</b></font>";
} }
} }
} }
$data = mysql_query("SELECT * FROM `inventory` WHERE `type` < 12 AND `type` != 3 AND `owner` = '{$user['id']}' AND `dressed` = 0 AND `modif`='1' AND `podgon`<'5' AND `name` NOT LIKE '%Букет%' AND `setsale`=0 ORDER by `update` DESC; "); $data = mysql_query("SELECT * FROM `inventory` WHERE `type` < 12 AND `type` != 3 AND `owner` = '{$user['id']}' AND `dressed` = 0 AND `modif`='1' AND `podgon`<'5' AND `name` NOT LIKE '%Букет%' AND `setsale`=0 ORDER by `update` DESC; ");
while ($row = mysql_fetch_array($data)) { while ($row = mysql_fetch_array($data)) {
$row['count'] = 1; $row['count'] = 1;
if ($i==0) { $i = 1; $color = '#C7C7C7';} else { $i = 0; $color = '#D5D5D5'; } if ($i == 0) {
$i = 1;
$color = '#C7C7C7';
} else {
$i = 0;
$color = '#D5D5D5';
}
echo "<TR bgcolor={$color}><TD align=center ><IMG SRC=\"i/sh/{$row['img']}\" BORDER=0>"; echo "<TR bgcolor={$color}><TD align=center ><IMG SRC=\"i/sh/{$row['img']}\" BORDER=0>";
?> ?>
<BR><small> <BR>
<small>
<? <?
if ($row['point'] > 0) { if ($row['point'] > 0) {
$babki = round(($row['point'] / 2),0); $cost_t = 'Реп'; $babki = round(($row['point'] / 2), 0);
$cost_t = 'Реп';
} else { } else {
$babki = round(($row['cost'] / 2),0); $cost_t = 'Кр'; $babki = round(($row['cost'] / 2), 0);
$cost_t = 'Кр';
} }
?> ?>
<A HREF="?razdel=4&podgon=<?=$row['id']?>" onclick="if(!confirm('Вы действительно хотите подогнать эту вещь?')){ return false;}">Подогнать за <?=$babki?> <?=$cost_t?>.</A><BR> <A HREF="?razdel=4&podgon=<?= $row['id'] ?>"
onclick="if(!confirm('Вы действительно хотите подогнать эту вещь?')){ return false;}">Подогнать
за <?= $babki ?> <?= $cost_t ?>.</A><BR>
</small> </small>
</TD> </TD>
<?php <?php
@ -476,34 +540,43 @@ if ($_GET['razdel']==4) {
} }
} }
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"));
?> ?>
</TABLE> </TABLE>
</TD> </TD>
<TD align=center> <td style="vertical-align: top; width: 280px; text-align: center; font-weight: bold;">
</TD> <br>Масса всех ваших вещей: <?= (int)$d[0]; ?>/<?= $user['sila'] * 4 ?>
<TD valign=top width=280><BR> <br>У вас в наличии: <span style="color: darkgreen;"><?= $user['money'] ?></span> кр.
<CENTER><B>Масса всех ваших вещей: <br><?= $err ?>
</td>
<?=(int)$d[0];?>/<?=$user['sila']*4?><BR>
У вас в наличии: <FONT COLOR="#339900"><?=$user['money']?></FONT> кр.</B></CENTER>
<BR>
<?=$err?>
</TD>
</FORM> </FORM>
</TR> </TR>
</TABLE> </TABLE>
<div id="hint3" class="ahint"></div> <div id="hint3" class="ahint"></div>
</form> </form>
<br <br>
<SCRIPT LANGUAGE="JavaScript">
function AddCount(name) {
document.all("hint3").innerHTML = ' <FORM METHOD=POST ACTION="repair.php?razdel=1"><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><small>Какую надпись желаете выгравировать:</small></td></tr><tr><td width=80% align=right>' +
'<INPUT TYPE="text" NAME="count" size=30></td><td width=20%>&nbsp;<INPUT TYPE="submit" value=" »» ">' +
'</TD></TR></TABLE></td></tr></table>';
document.all("hint3").style.visibility = "visible";
document.all("hint3").style.left = event.x + document.body.scrollLeft - 20;
document.all("hint3").style.top = event.y + document.body.scrollTop + 5;
document.all("count").focus();
}
function closehint3() {
document.all("hint3").style.visibility = "hidden";
}
function leave() {
top.frames['main'].location = 'city.php?cp'
}
</SCRIPT>
</body> </body>
</html> </html>