2018-01-28 16:40:49 +00:00
< ? php
session_start ();
2018-12-12 11:59:29 +00:00
if ( $_SESSION [ 'uid' ] == null ) header ( " Location: index.php " );
2018-12-11 23:00:19 +00:00
require_once ( " functions.php " );
2018-12-11 23:20:11 +00:00
$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 [ 'battle' ] != 0 ) {
header ( 'location: fbattle.php' );
die ();
}
2018-01-28 16:40:49 +00:00
2018-12-11 23:00:19 +00:00
// Гравировка
2018-12-11 23:20:11 +00:00
if ( input :: post ( 'set' ) && input :: post ( 'count' ) && ( $user [ 'money' ] >= 30 )) {
if ( db :: c () -> query ( 'UPDATE `inventory` SET `text` = "?s" WHERE `dressed` = 0 AND `setsale` = 0 AND `owner` = ?i AND `id` = ?i' , input :: post ( 'count' ), $_SESSION [ 'uid' ], input :: post ( 'set' )))
db :: c () -> query ( 'UPDATE `users` SET `money` = `money` - 30 WHERE `id` = ?i' , $_SESSION [ 'uid' ]);
2018-01-28 16:40:49 +00:00
}
2018-12-12 13:26:18 +00:00
// Снять гравировку
2018-12-11 23:20:11 +00:00
if ( $_GET [ 'rep' ] && ( $_GET [ 'sid' ] == 2 )) {
mysql_query ( " UPDATE `inventory` SET `text` = '' WHERE `owner` = ' { $user [ 'id' ] } ' AND `dressed` = 0 AND `id` = ' " . ( int ) $_GET [ 'rep' ] . " ' LIMIT 1 " );
2018-01-28 16:40:49 +00:00
}
2018-12-12 13:26:18 +00:00
// Полный ремонт
2018-12-11 23:20:11 +00:00
if ( $_GET [ 'sid' ] && $_GET [ 'rep' ]) {
2018-12-12 13:26:18 +00:00
$row = mysql_fetch_array ( mysql_query ( " SELECT * FROM `inventory` WHERE `isrep` = 1 AND `owner` = ' { $user [ 'id' ] } ' AND `dressed` = 0 AND `id` = ' { $_GET [ 'rep' ] } ' AND `setsale`=0 LIMIT 1; " ));
$full = $row [ 'duration' ];
if ( $row [ 'duration' ] > 1 ) {
//$onecost=$row['cost']/($row['maxdur']*10);
//if($onecost < 0.1) {$onecost=0.1;}
$onecost = 0.1 ;
if ( round ( $onecost * $full ) <= $user [ 'money' ]) {
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> " ;
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 () . " '); " );
$user [ 'money' ] = $user [ 'money' ] - ( round ( $onecost , 2 ) * $full );
if ( rand ( 1 , 5 ) == 1 ) {
$err .= " <font color=red><b>К сожалению максимальная долговечность предмета из-за ремонта уменьшилась.</b></font> " ;
mysql_query ( " UPDATE `inventory` SET `maxdur` = `maxdur`-1 WHERE `id` = { $_GET [ 'rep' ] } " );
2018-12-11 23:20:11 +00:00
}
}
2018-12-12 13:26:18 +00:00
} else {
$err = " <font color=red><b>Недостаточно денег.</b></font> " ;
}
2018-12-11 23:20:11 +00:00
}
}
2018-12-12 13:44:14 +00:00
2018-01-28 16:40:49 +00:00
?>
< HTML >
< HEAD >
2018-12-11 23:20:11 +00:00
< meta charset = " utf-8 " >
2018-12-12 11:59:29 +00:00
< link rel = stylesheet href = " css/main.css " >
< link href = " css/secondary.css " rel = " stylesheet " />
2018-01-28 16:40:49 +00:00
</ HEAD >
2018-12-11 23:20:11 +00:00
< body >
< h1 > Ремонтная мастерская </ h1 >
2018-12-12 12:52:04 +00:00
< a href = # onclick=leave()> ← выйти из мастерской</a><br>
2018-12-12 14:18:11 +00:00
< div class = " appblock appblock-main " >
< span class = " legend " > Информация </ span >
< span class = " wrap " > Кредиты < span class = " num " >< ? = $user [ 'money' ] ?> </span></span>
< span class = " wrap " > М а с с а вещей < span class = " num " >< ? = getItemsMassaInfo () ?> </span></span>
</ div >
< div class = " appblock " >
< span class = " legend " > Зал ремонта </ span >
< form method = " post " >
< input type = " hidden " name = " goto " value = " remont " >
< input type = " submit " value = " Войти " >
</ form >
< span class = " wrap " > Починка поврежденных предметов .</ span >
</ div >
< div class = " appblock " >
< span class = " legend " > Зал гравировки </ span >
< form method = " post " >
< input type = " hidden " name = " goto " value = " gravirovka " >
< input type = " submit " value = " Войти " >
</ form >
< span class = " wrap " > Нанесение надписей на оружие .</ span >
</ div >
< div class = " appblock " >
< span class = " legend " > Зал зачарований </ span >
< form method = " post " >
< input type = " hidden " name = " goto " value = " magic " >
< input type = " submit " value = " Войти " >
</ form >
< span class = " wrap " > Перезарядка встроеной магии . Если в предмет встроена магия , мы поможем е е перезарядить
2018-12-12 14:00:10 +00:00
за умеренную плату . Учтите , ничто не вечно под луной , в том числе и магия , рано или поздно встроенный
свиток исчерпает все свои ресурсы , и мы уже не сможем е г о перезарядить .</ span >
2018-12-12 14:18:11 +00:00
</ div >
< div class = " appblock " >
< span class = " legend " > Зал модификаций </ span >
< form method = " post " >
< input type = " hidden " name = " goto " value = " modding " >
< input type = " submit " value = " Войти " >
</ form >
< span class = " wrap " > Модификация предметов . Наши мастера помогут вам модифицировать ваши доспехи . К сожалению ,
2018-12-12 14:00:10 +00:00
технология не позволяет повторно модифицировать вещи . Чем выше у вас интеллект , тем яснее вы сможете
объяснить мастерам желаемый результат . Результат может быть непредсказуем !</ span >
2018-12-12 13:56:42 +00:00
</ div >
2018-12-12 14:18:11 +00:00
< div class = " appblock " >
< span class = " legend " > Экспериментальный цех </ span >
< form method = " post " >
< input type = " hidden " name = " goto " value = " modding " >
< input type = " submit " value = " Войти " >
</ form >
< span class = " wrap " > Подгонка предметов . И прочие нерегулярные штуки .</ span >
</ div >
2018-12-12 14:23:58 +00:00
< div style = " clear: both; " >
< ? php if ( isset ( $status )) : ?>
< span class = " wrap " >< ? = $status ?> </span>
< ? php endif ; ?>
</ div >
2018-12-11 23:20:11 +00:00
< TABLE width = 100 %>
< TR >
< FORM METHOD = POST ACTION = " repair.php " >
< INPUT TYPE = " hidden " name = " sid " value = " " >
< INPUT TYPE = " hidden " name = " id " value = " 1 " >
< TD valign = top align = left >
< TABLE width = 100 % bgcolor = " #A5A5A5 " >
< TABLE WIDTH = 100 % BGCOLOR = " #A5A5A5 " >
< ? php
2018-12-12 13:56:42 +00:00
if ( input :: post ( 'goto' ) == 'remont' ) {
2018-12-12 11:59:29 +00:00
$data = db :: c () -> query ( 'SELECT * FROM `inventory` WHERE `type` < 12 AND `dressed` = 0 AND `isrep` = 1 AND `setsale` = 0 AND `owner` = ?i ORDER BY `update` DESC' , $_SESSION [ 'uid' ]);
while ( $row = $data -> fetch_assoc ()) {
$onecost = 0.1 ;
?>
< TR >
< TD align = center >< IMG SRC = " i/sh/<?= $row['img'] ?> " >
2018-12-11 23:20:11 +00:00
< BR >
< small >
2018-12-12 13:26:18 +00:00
< ? if ( $row [ 'duration' ] > 0 ) { ?>
< A HREF = " ?rep=<?= $row['id'] ?>&sid=full " > Ремонт
за < ? = round (( $row [ 'duration' ] * $onecost ), 2 ) ?> кр.</A><BR><? } else {
2018-12-11 23:20:11 +00:00
echo " не нуждается в ремонте " ;
} ?>
</ small >
2018-12-12 11:59:29 +00:00
</ TD >
< ? php
echo " <TD valign=top> " ;
showitem ( $row );
echo " </TD></TR> " ;
2018-12-11 23:20:11 +00:00
}
}
2018-12-12 13:56:42 +00:00
if ( input :: post ( 'goto' ) == 'gravirovka' ) {
2018-12-12 11:59:29 +00:00
$data = db :: c () -> query ( 'SELECT * FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND `type` = 3 AND `name` NOT LIKE "?S" AND `setsale`=0 ORDER by `update` DESC' , $_SESSION [ 'uid' ], '%Букет%' );
while ( $row = $data -> fetch_assoc ()) {
$row [ 'count' ] = 1 ;
if ( $i == 0 ) {
$i = 1 ;
$color = '#C7C7C7' ;
2018-12-11 23:20:11 +00:00
} else {
2018-12-12 11:59:29 +00:00
$i = 0 ;
$color = '#D5D5D5' ;
2018-12-11 23:20:11 +00:00
}
2018-12-12 11:59:29 +00:00
echo " <TR bgcolor= { $color } ><TD align=center ><IMG SRC= \" i/sh/ { $row [ 'img' ] } \" BORDER=0> " ;
?>
< BR >
< small >
< ? if ( empty ( $row [ 'text' ])) { ?> <A HREF="#"
onclick = " AddCount(<?= $row['id'] ?>) " >
Нанести надпись за 30 кр .</ A >< BR >< ? } else {
?> <A HREF="?razdel=1&rep=<?= $row['id'] ?>&sid=2">Стереть надпись</A><BR><?
} ?>
</ small >
</ TD >
< ? php
echo " <TD valign=top> " ;
showitem ( $row );
echo " </TD></TR> " ;
2018-12-11 23:20:11 +00:00
}
}
2018-12-12 13:56:42 +00:00
if ( input :: post ( 'goto' ) == 'magic' ) {
2018-12-12 11:59:29 +00:00
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; " ));
if ( $user [ 'money' ] < $row [ 'includemagiccost' ] && $row [ 'includemagicdex' ] == 0 ) {
$err = " <font color=red><b>У вас не хватает денег на перезарядку.</b></font> " ;
} else {
if ( $row [ 'includemagicuses' ] <= 1 ) {
$onecost = $row [ 'includemagiccost' ];
$err = " <font color=red><b>Мы сожалеем, свиток исчерпал все свои ресурсы, и мы уже не можем е г о перезарядить.</b></font> " ;
mysql_query ( " UPDATE `users` set `money` = `money`- ' " . ( $row [ 'includemagiccost' ]) . " ' 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' ] . " ) [ " . $newduration . " / " . $row [ 'maxdur' ] . " ] у \" " . $user [ 'login' ] . " \" за " . round ( $onecost , 2 ) . " кр. ',1,' " . time () . " '); " );
mysql_query ( " UPDATE `inventory` SET `includemagic` = '', `includemagicdex` = '', `includemagicmax` = '', `includemagicname` = '', `includemagicuses` = '', `includemagiccost` = '' WHERE `id` = ' { $_GET [ 'it' ] } ' LIMIT 1; " );
} else {
$onecost = $row [ 'includemagiccost' ];
$err = " <font color=red><b>Магия успешно перезаряжена.</b></font> " ;
mysql_query ( " UPDATE `users` set `money` = `money`- ' " . ( $row [ 'includemagiccost' ]) . " ' 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' ] . " ) [ " . $newduration . " / " . $row [ 'maxdur' ] . " ] у \" " . $user [ 'login' ] . " \" за " . round ( $onecost , 2 ) . " кр. ',1,' " . time () . " '); " );
mysql_query ( " UPDATE `inventory` SET `includemagicdex` = `includemagicmax`, `includemagicuses` = `includemagicuses`-1 WHERE `id` = ' { $_GET [ 'it' ] } ' LIMIT 1; " );
}
}
2018-12-11 23:20:11 +00:00
}
2018-12-12 11:59:29 +00:00
$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 )) {
$row [ 'count' ] = 1 ;
if ( $i == 0 ) {
$i = 1 ;
$color = '#C7C7C7' ;
2018-12-11 23:20:11 +00:00
} else {
2018-12-12 11:59:29 +00:00
$i = 0 ;
$color = '#D5D5D5' ;
2018-12-11 23:20:11 +00:00
}
2018-12-12 11:59:29 +00:00
echo " <TR bgcolor= { $color } ><TD align=center ><IMG SRC= \" i/sh/ { $row [ 'img' ] } \" BORDER=0> " ;
2018-12-11 23:20:11 +00:00
?>
2018-12-12 11:59:29 +00:00
< BR >
< small >
< ?
if ( $row [ 'includemagicdex' ] == 0 ) {
?> <A HREF="?razdel=2&it=<?= $row['id'] ?>">Перезарядить
за < ? = $row [ 'includemagiccost' ] ?> кр.</A><BR><?
} else {
echo 'Н е нуждается в перезарядке' ;
}
?>
</ small >
</ TD >
< ? php
echo " <TD valign=top> " ;
showitem ( $row );
echo " </TD></TR> " ;
}
2018-12-11 23:20:11 +00:00
}
2018-12-12 13:56:42 +00:00
if ( input :: post ( 'goto' ) == 'modding' ) {
2018-12-11 23:20:11 +00:00
2018-12-12 11:59:29 +00:00
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; " ));
if ( $user [ 'money' ] < $row [ 'cost' ] OR ! $row ) {
$err = " <font color=red><b>У вас не хватает денег на модификацию.</b></font> " ;
} else {
srand ( make_seed ());
$type = rand ( 1 , 4 );
$mfintel = round ( $user [ 'intel' ] / 5 - 10 );
if ( $mfintel > - 1 ) {
$mfintel = - 1 ;
}
$statintel = round ( $user [ 'intel' ] / 25 - 2 );
if ( $statintel > - 1 ) {
$statintel = - 1 ;
}
$nstatintel = round ( 2 - $user [ 'intel' ] / 25 );
if ( $nstatintel < 1 ) {
$statintel = 1 ;
}
srand ( make_seed ());
$mf1 = rand ( $mfintel , 10 );
srand ( make_seed ());
$mf2 = rand ( $mfintel , 10 );
srand ( make_seed ());
$st1 = rand ( $statintel , 2 );
srand ( make_seed ());
$st2 = rand ( - 2 , $nstatintel );
srand ( make_seed ());
$min = rand ( $statintel , 2 );
srand ( make_seed ());
$max = rand ( $statintel , 4 );
2018-12-11 23:20:11 +00:00
2018-12-12 11:59:29 +00:00
switch ( $type ) {
case 1 :
// крит
$mfkrit = $mf1 ;
$mfantiuvorot = $mf2 ;
$inta = $st1 ;
$hp = rand ( 0 , 15 );
$ninta = $st2 ;
break ;
case 2 :
// ловкость
$mfuvorot = $mf1 ;
$mfantikrit = $mf2 ;
$lovk = $st1 ;
$hp = rand ( 1 , 15 );
$nlovk = $st2 ;
break ;
case 3 :
// сила
$mfminu = $min ;
$mfmaxu = $max ;
$sila = $st1 ;
$hp = rand ( 6 , 20 );
$nsila = $st2 ;
$mfantikrit = $mf2 ;
break ;
case 4 :
// вынос
$nvinos = $st2 ;
$mfantikrit = $mf1 ;
$bron1 = rand ( 0 , 3 );
$bron2 = rand ( 0 , 3 );
$bron3 = rand ( 0 , 3 );
$bron4 = rand ( 0 , 3 );
$hp = rand ( 0 , 15 );
break ;
}
2018-12-11 23:20:11 +00:00
2018-12-12 11:59:29 +00:00
if ( mysql_query ( " UPDATE `inventory` SET
2018-12-11 23:20:11 +00:00
`ghp` = `ghp` + '" . (int)$hp . "' ,
`bron1` = `bron1` + '" . (int)$bron1 . "' ,
`bron2` = `bron2` + '" . (int)$bron2 . "' ,
`bron3` = `bron3` + '" . (int)$bron3 . "' ,
`bron4` = `bron4` + '" . (int)$bron4 . "' ,
`mfkrit` = `mfkrit` + '" . (int)$mfkrit . "' ,
`mfakrit` = `mfakrit` + '" . (int)$mfantikrit . "' ,
`mfuvorot` = `mfuvorot` + '" . (int)$mfuvorot . "' ,
`mfauvorot` = `mfauvorot` + '" . (int)$mfantiuvorot . "' ,
`gsila` = `gsila` + '" . (int)$sila . "' ,
`glovk` = `glovk` + '" . (int)$lovk . "' ,
`ginta` = `ginta` + '" . (int)$inta . "' ,
`nsila` = `nsila` + '" . (int)$nsila . "' ,
`nlovk` = `nlovk` + '" . (int)$nlovk . "' ,
`ninta` = `ninta` + '" . (int)$ninta . "' ,
`nvinos` = `nvinos` + '" . (int)$nvinos . "' ,
`cost` = `cost` + '" . round($row[' cost '] / 2) . "' ,
2018-01-28 16:40:49 +00:00
`name` = CONCAT ( `name` , ' (мф)' )
WHERE `id` = '{$_GET[' mf ']}' LIMIT 1 ; " )) {
2018-12-12 11:59:29 +00:00
//echo $row['cost'];
mysql_query ( " UPDATE `users` set `money` = `money`- ' " . ( $row [ 'cost' ]) . " ' WHERE id = { $_SESSION [ 'uid' ] } " );
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> " ;
}
2018-12-11 23:20:11 +00:00
}
}
2018-12-12 11:59:29 +00:00
$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 )) {
$row [ 'count' ] = 1 ;
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> " ;
?>
< BR >
< small >
< A HREF = " ?razdel=3&mf=<?= $row['id'] ?> "
onClick = " if(!confirm('Вы действительно хотите модифицировать эту вещь?')) { return false;} " > Модифицировать
за < ? = $row [ 'cost' ] ?> кр.</A><BR>
</ small >
</ TD >
< ? php
echo " <TD valign=top> " ;
showitem ( $row );
echo " </TD></TR> " ;
2018-12-11 23:20:11 +00:00
}
}
2018-12-12 13:56:42 +00:00
if ( input :: post ( 'goto' ) == 'podgon' ) {
2018-12-11 23:20:11 +00:00
2018-12-12 11:59:29 +00:00
if ( $_GET [ 'podgon' ]) {
$row = mysql_fetch_array ( mysql_query ( " SELECT * FROM `inventory` WHERE `type` < 12 AND `type` != 3 AND `owner` = ' { $user [ 'id' ] } ' AND `dressed` = 0 AND `id` = ' { $_GET [ 'podgon' ] } ' AND `modif`='1' AND `podgon`<'5' LIMIT 1; " ));
if ( $row [ 'point' ] > 0 ) {
$cost = round (( $row [ 'point' ] / 2 ), 0 );
} else {
$cost = round (( $row [ 'cost' ] / 2 ), 0 );
}
2018-12-11 23:20:11 +00:00
2018-12-12 11:59:29 +00:00
if ( $user [ 'money' ] < $cost || ! $row ) {
$err = " <font color=red><b>У вас не хватает денег на подгонку.</b></font> " ;
} else {
2018-12-11 23:20:11 +00:00
2018-12-12 11:59:29 +00:00
$kol_mf = round ( $row [ 'mfkrit' ] + $row [ 'mfakrit' ] + $row [ 'mfuvorot' ] + $row [ 'mfauvorot' ], 0 );
2018-12-11 23:20:11 +00:00
2018-12-12 11:59:29 +00:00
if ( $row [ 'podgon' ] == 0 ) {
if ( $row [ 'point' ] > 0 ) {
$new_cena = round (( $row [ 'point' ] * 20 ) / 100 , 0 );
$sql = '`point` = `point`+' . $new_cena ;
$user [ 'doblest' ] -= $cost ;
$usql = '`doblest` = "' . $user [ 'doblest' ] . '"' ;
$cost_t = 'реп' ;
} else {
$new_cena = round (( $row [ 'cost' ] * 20 ) / 100 , 0 );
$sql = '`cost` = `cost`+' . $new_cena ;
$user [ 'money' ] -= $cost ;
$usql = '`money` = "' . $user [ 'money' ] . '"' ;
$cost_t = 'кр' ;
}
$gmf = 2 ;
} elseif ( $row [ 'podgon' ] == 1 ) {
if ( $row [ 'point' ] > 0 ) {
$new_cena = round (( $row [ 'point' ] * 20 ) / 100 , 0 );
$sql = '`point` = `point`+' . $new_cena ;
$user [ 'doblest' ] -= $cost ;
$usql = '`doblest` = "' . $user [ 'doblest' ] . '"' ;
$cost_t = 'реп' ;
} else {
$new_cena = round (( $row [ 'cost' ] * 20 ) / 100 , 0 );
$sql = '`cost` = `cost`+' . $new_cena ;
$user [ 'money' ] -= $cost ;
$usql = '`money` = "' . $user [ 'money' ] . '"' ;
$cost_t = 'кр' ;
}
$gmf = 3 ;
} elseif ( $row [ 'podgon' ] == 2 ) {
if ( $row [ 'point' ] > 0 ) {
$new_cena = round (( $row [ 'point' ] * 40 ) / 100 , 0 );
$sql = '`point` = `point`+' . $new_cena ;
$user [ 'doblest' ] -= $cost ;
$usql = '`doblest` = "' . $user [ 'doblest' ] . '"' ;
$cost_t = 'реп' ;
} else {
$new_cena = round (( $row [ 'cost' ] * 40 ) / 100 , 0 );
$sql = '`cost` = `cost`+' . $new_cena ;
$user [ 'money' ] -= $cost ;
$usql = '`money` = "' . $user [ 'money' ] . '"' ;
$cost_t = 'кр' ;
}
$gmf = 4 ;
} elseif ( $row [ 'podgon' ] == 3 ) {
if ( $row [ 'point' ] > 0 ) {
$new_cena = round (( $row [ 'point' ] * 70 ) / 100 , 0 );
$sql = '`point` = `point`+' . $new_cena ;
$user [ 'doblest' ] -= $cost ;
$usql = '`doblest` = "' . $user [ 'doblest' ] . '"' ;
$cost_t = 'реп' ;
} else {
$new_cena = round (( $row [ 'cost' ] * 70 ) / 100 , 0 );
$sql = '`cost` = `cost`+' . $new_cena ;
$user [ 'money' ] -= $cost ;
$usql = '`money` = "' . $user [ 'money' ] . '"' ;
$cost_t = 'кр' ;
}
$gmf = 6 ;
} elseif ( $row [ 'podgon' ] == 4 ) {
if ( $row [ 'point' ] > 0 ) {
$new_cena = round (( $row [ 'point' ] * 100 ) / 100 , 0 );
$sql = '`point` = `point`+' . $new_cena ;
$user [ 'doblest' ] -= $cost ;
$usql = '`doblest` = "' . $user [ 'doblest' ] . '"' ;
$cost_t = 'реп' ;
} else {
$new_cena = round (( $row [ 'cost' ] * 100 ) / 100 , 0 );
$sql = '`cost` = `cost`+' . $new_cena ;
$user [ 'money' ] -= $cost ;
$usql = '`money` = "' . $user [ 'money' ] . '"' ;
$cost_t = 'кр' ;
}
$gmf = 10 ;
2018-12-11 23:20:11 +00:00
}
2018-12-12 11:59:29 +00:00
if ( $row [ 'mfkrit' ] == 0 && $row [ 'mfakrit' ] == 0 && $row [ 'mfuvorot' ] == 0 && $row [ 'mfauvorot' ] == 0 ) {
$gmf = 0 ;
}
2018-12-11 23:20:11 +00:00
2018-12-12 11:59:29 +00:00
if ( mysql_query ( " UPDATE `inventory` SET
2018-12-11 23:20:11 +00:00
`free_mf` = `free_mf` + '" . (int)$gmf . "' ,
2018-01-28 16:40:49 +00:00
$sql ,
`podgon` = `podgon` + '1'
WHERE `id` = '{$_GET[' podgon ']}' LIMIT 1 " )) {
2018-12-12 11:59:29 +00:00
mysql_query ( " UPDATE `users` set $usql WHERE id = { $user [ 'id' ] } " );
2018-12-11 23:20:11 +00:00
2018-12-12 11:59:29 +00:00
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> " ;
}
2018-12-11 23:20:11 +00:00
}
}
2018-12-12 11:59:29 +00:00
$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 )) {
$row [ 'count' ] = 1 ;
if ( $i == 0 ) {
$i = 1 ;
$color = '#C7C7C7' ;
2018-12-11 23:20:11 +00:00
} else {
2018-12-12 11:59:29 +00:00
$i = 0 ;
$color = '#D5D5D5' ;
2018-12-11 23:20:11 +00:00
}
2018-12-12 11:59:29 +00:00
echo " <TR bgcolor= { $color } ><TD align=center ><IMG SRC= \" i/sh/ { $row [ 'img' ] } \" BORDER=0> " ;
2018-12-11 23:20:11 +00:00
?>
2018-12-12 11:59:29 +00:00
< BR >
< small >
< ?
if ( $row [ 'point' ] > 0 ) {
$babki = round (( $row [ 'point' ] / 2 ), 0 );
$cost_t = 'Реп' ;
} else {
$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>
</ small >
</ TD >
< ? php
echo " <TD valign=top> " ;
showitem ( $row );
echo " </TD></TR> " ;
}
2018-12-11 23:20:11 +00:00
}
2018-12-12 11:59:29 +00:00
?>
2018-12-11 23:20:11 +00:00
</ TABLE >
</ TD >
</ FORM >
</ TR >
2018-01-28 16:40:49 +00:00
</ TABLE >
< div id = " hint3 " class = " ahint " ></ div >
</ form >
2018-12-11 23:20:11 +00:00
< 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%> <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 >
2018-01-28 16:40:49 +00:00
</ body >
</ html >