2018-02-27 03:53:10 +00:00
< ? php
2018-01-28 16:40:49 +00:00
ob_start ( " ob_gzhandler " );
session_start ();
if ( $_SESSION [ 'uid' ] == null ) header ( " Location: index.php " );
include " config.php " ;
include " functions.php " ;
2018-02-27 03:53:10 +00:00
if ( $user [ 'room' ] != 29 ) header ( " Location: main.php " );
if ( $user [ 'battle' ] != 0 ) {
header ( 'location: fbattle.php' );
die ();
}
2018-03-09 18:55:26 +00:00
$bank = db :: c () -> query ( 'SELECT `id`, `cr`, `ekr` FROM `bank` WHERE `id` = ?i' , $_SESSION [ 'uid' ]) -> fetch_assoc ();
2018-01-28 16:40:49 +00:00
2018-03-09 21:12:03 +00:00
/**
* Если вдруг нет счёта , создаём .
*/
2018-03-09 18:07:04 +00:00
if ( ! $bank [ 'id' ]) {
2018-03-09 18:55:26 +00:00
db :: c () -> query ( 'INSERT INTO `bank` (`id`) VALUES (?i)' , $_SESSION [ 'uid' ]);
2018-03-09 18:07:04 +00:00
}
2018-01-28 16:40:49 +00:00
?>
2018-02-27 03:53:10 +00:00
<! DOCTYPE html >
< html >
< head >
< meta charset = " utf-8 " >
< link href = " css/main.css " rel = " stylesheet " />
< title > Банк </ title >
< script >
2018-02-27 05:41:56 +00:00
function leave () {
2018-03-09 18:07:04 +00:00
top . frames [ 'main' ] . location = 'city.php?strah'
2018-02-27 03:53:10 +00:00
}
</ script >
< script src = " /js/jquery-1.7.2.min.js " ></ script >
< style >
. appblock {
background : silver ;
border - radius : 2 px ;
float : left ;
height : 200 px ;
margin : 10 px ;
2018-03-09 21:12:03 +00:00
width : 250 px ;
2018-02-27 03:53:10 +00:00
opacity : 0.75 ;
padding : 5 px ;
}
div . appblock form {
2018-03-09 21:12:03 +00:00
margin : 5 px ;
}
div . appblock span {
padding : 0.2 em 0.5 em ;
color : #666;
font - weight : bold ;
display : block ;
}
div . appblock br {
margin : 5 px ;
2018-02-27 03:53:10 +00:00
}
</ style >
2018-01-28 16:40:49 +00:00
</ head >
2018-02-27 03:53:10 +00:00
< body >
2018-02-27 05:41:56 +00:00
< h1 > Банк </ h1 >
2018-03-09 22:34:51 +00:00
< table class = 'adm' >
< tr >
< th > № </ th >
< th > Кредитов .</ th >
< th > ЕвроКредитов .</ th >
</ tr >
< tr >
< td >< ? = $bank [ 'id' ] ?> </td>
< td >< ? = $bank [ 'cr' ] ?> </td>
< td >< ? = $bank [ 'ekr' ] ?> </td>
</ tr >
</ table >< br >
2018-02-27 03:53:10 +00:00
< ? php
2018-02-27 05:41:56 +00:00
if ( $_GET [ 'exit' ]) {
$_SESSION [ 'bankid' ] = null ;
2018-01-28 16:40:49 +00:00
}
2018-03-09 22:01:20 +00:00
if ( isset ( $_POST [ 'userlogin' ])) {
$_SESSION [ 'bankid' ] = $_SESSION [ 'uid' ];
2018-01-28 16:40:49 +00:00
}
2018-02-27 05:41:56 +00:00
if ( ! $_SESSION [ 'bankid' ]) {
2018-02-27 03:53:10 +00:00
?>
2018-02-27 05:41:56 +00:00
< a href = # onclick=leave()> ← выйти из банка</a>
2018-03-09 22:34:51 +00:00
< form method = " post " >< input type = " submit " name = " userlogin " value = " Управление счётом " ></ form >
2018-02-27 05:14:11 +00:00
< ?
} else {
2018-03-09 18:07:04 +00:00
2018-03-09 22:01:20 +00:00
$toid = filter_input ( INPUT_POST , 'to-id' );
2018-03-09 23:00:39 +00:00
$summa = filter_input ( INPUT_POST , 'summa' );
2018-03-09 22:16:41 +00:00
$submit = filter_input ( INPUT_POST , 'action' );
2018-03-09 18:07:04 +00:00
2018-03-09 23:00:39 +00:00
2018-03-09 22:01:20 +00:00
/**
* Зачисдение кредитов на счёт .
*/
2018-03-09 22:12:59 +00:00
if ( $submit == 'money-in' && $summa ) {
2018-03-09 21:12:03 +00:00
if ( $summa > 0 && ( $summa <= $user [ 'money' ])) {
$user [ 'money' ] -= $summa ;
2018-03-09 23:07:02 +00:00
db :: c () -> query ( 'UPDATE `users` SET `money` = `money` - ?i WHERE `id` = ?i' , $summa , $bank [ 'id' ]);
db :: c () -> query ( 'UPDATE `bank` SET `cr` = `cr` + ?i WHERE `id` = ?i' , $summa , $bank [ 'id' ]);
2018-03-09 21:12:03 +00:00
db :: c () -> query ( ' INSERT INTO `bank_logs` ( `user_id` , `sum` , `type` , `comments` , `source` )
2018-03-09 23:07:02 +00:00
VALUES ( ? i , ? i , " ?s " , " ?s " , ? i ) ', $bank[' id '], $summa, ' money - in ', ' Банк : Зачисление средств на счёт ', $bank[' id ' ]);
2018-02-27 05:14:11 +00:00
} else {
$mywarn = " У вас недостаточно денег для выполнения операции" ;
2018-02-27 03:53:10 +00:00
}
2018-03-09 22:12:59 +00:00
$submit = '' ;
2018-03-09 21:12:03 +00:00
$summa = 0 ;
2018-02-27 05:14:11 +00:00
}
2018-03-09 18:07:04 +00:00
2018-03-09 22:01:20 +00:00
/**
* Снятие кредитов с о счёта .
*/
2018-03-09 22:12:59 +00:00
if ( $submit == 'money-out' && $summa ) {
2018-03-09 21:12:03 +00:00
if ( $summa > 0 && ( $summa <= $bank [ 'cr' ])) {
$user [ 'money' ] += $summa ;
2018-03-09 23:07:02 +00:00
db :: c () -> query ( 'UPDATE `bank` SET `cr` = `cr` - ?i WHERE `id` = ?i' , $summa , $bank [ 'id' ]);
db :: c () -> query ( 'UPDATE `users` SET `money` = `money` + ?i WHERE `id` = ?i' , $summa , $bank [ 'id' ]);
2018-03-09 21:12:03 +00:00
db :: c () -> query ( ' INSERT INTO `bank_logs` ( `user_id` , `sum` , `type` , `comments` , `source` )
2018-03-09 23:07:02 +00:00
VALUES ( ? i , ? i , " ?s " , " ?s " , ? i ) ', $bank[' id '], $summa, ' money - out ', ' Банк : Вывод средств на руки ', $bank[' id ' ]);
2018-02-27 05:14:11 +00:00
} else {
$mywarn = " У вас недостаточно денег на счету для выполнения операции" ;
2018-01-28 16:40:49 +00:00
}
2018-03-09 22:12:59 +00:00
$submit = '' ;
2018-03-09 21:12:03 +00:00
$summa = 0 ;
2018-02-27 05:14:11 +00:00
}
2018-01-28 16:40:49 +00:00
2018-03-09 22:01:20 +00:00
/**
* Перевод кредитов на другой счёт .
*/
2018-03-09 22:12:59 +00:00
if ( $submit == 'send-money' && $summa && $toid ) {
2018-03-09 22:01:20 +00:00
$receiver = db :: c () -> query ( 'SELECT `id` FROM `bank` WHERE `id` = ?i' , $toid ) -> fetch_assoc ();
if ( $receiver [ 'id' ]) {
if ( $summa > 0 ) {
$nalog = round ( $summa * 0.05 );
if ( $nalog < 1 ) {
$nalog = 1 ;
}
$new_summa = $summa + $nalog ;
if ( $new_summa <= $bank [ 'cr' ]) {
2018-03-09 23:07:02 +00:00
db :: c () -> query ( 'UPDATE `bank` SET `cr` = `cr` - ?i WHERE `id` = ?i' , $new_summa , $bank [ 'id' ]);
2018-03-09 22:01:20 +00:00
db :: c () -> query ( 'UPDATE `bank` SET `cr` = `cr` + ?i WHERE `id` = ?i' , $summa , $toid );
db :: c () -> query ( 'UPDATE `bank` SET `cr` = `cr` + ?i WHERE `id` = ?i' , $nalog , 0 );
db :: c () -> query ( ' INSERT INTO `bank_logs` ( `user_id` , `sum` , `type` , `comments` , `source` )
2018-03-09 23:07:02 +00:00
VALUES ( ? i , ? i , " ?s " , " ?s " , ? i ) ', $toid, $summa, ' money - in ', ' Получение банковского перевода . ', $bank[' id ' ]);
2018-03-09 22:01:20 +00:00
db :: c () -> query ( ' INSERT INTO `bank_logs` ( `user_id` , `sum` , `type` , `comments` , `source` )
2018-03-09 23:17:05 +00:00
VALUES ( ? i , ? i , " ?s " , " ?s " , ? i ) ', $bank[' id '], $new_summa, ' send - money ', ' Банк : Перевод средств на другой счёт . Комиссия : $nalog ' , $toid );
2018-03-09 22:01:20 +00:00
} else {
$mywarn = " У вас недостаточно денег на счету для выполнения операции" ;
}
} else {
$mywarn = " Укажите сумму! " ;
}
} else {
$mywarn = " Счёт не существует. " ;
}
2018-03-09 22:12:59 +00:00
$submit = '' ;
2018-03-09 22:01:20 +00:00
$summa = 0 ;
$toid = 0 ;
}
2018-02-27 05:14:11 +00:00
if ( $_POST [ 'change' ] && $_POST [ 'ok' ]) {
$_POST [ 'ok' ] = round ( $_POST [ 'ok' ], 2 );
if ( is_numeric ( $_POST [ 'ok' ]) && ( $_POST [ 'ok' ] > 0 ) && ( $_POST [ 'ok' ] <= $bank [ 'ekr' ])) {
$bank [ 'cr' ] += $_POST [ 'ok' ] * 100 ;
$bank [ 'ekr' ] -= $_POST [ 'ok' ];
$add_money = $_POST [ 'ok' ] * 100 ;
if ( mysql_query ( " UPDATE `bank` SET `cr`=`cr`+' $add_money ' WHERE `id`=' " . $bank [ 'id' ] . " ' LIMIT 1; " )) {
$mywarn = " Обмен произведен успешно " ;
mysql_query ( " UPDATE `bank` SET `ekr`=`ekr`-' " . $_POST [ 'ok' ] . " ' WHERE `id`=' " . $_SESSION [ 'bankid' ] . " ' LIMIT 1; " );
$bank = mysql_fetch_array ( mysql_query ( " SELECT * FROM `bank` WHERE `id`=' " . $_SESSION [ 'bankid' ] . " '; " ));
mysql_query ( " INSERT INTO `delo` (`id`,`author`,`pers`,`text`,`type`,`date`) VALUES ('','0',' " . $_SESSION [ 'uid' ] . " ','Персонаж " . $user [ 'login' ] . " обменял " . $_POST [ 'ok' ] . " екр. на " . $add_money . " кр. на счету № " . $_SESSION [ 'bankid' ] . " в банке. ',1,' " . time () . " '); " );
2018-02-27 03:53:10 +00:00
} else {
2018-02-27 05:14:11 +00:00
$mywarn = " Произошла ошибка! " ;
2018-02-27 03:53:10 +00:00
}
2018-02-27 05:14:11 +00:00
} else {
$mywarn = " У вас недостаточно денег на валютном счету для выполнения операции" ;
2018-02-27 03:53:10 +00:00
}
2018-02-27 05:14:11 +00:00
$_POST [ 'change' ] = 0 ;
}
2018-02-27 06:07:27 +00:00
2018-02-27 05:14:11 +00:00
if ( $_GET [ 'dropm' ]) {
if ( 2 <= $bank [ 'ekr' ]) {
undressall ( $user [ 'id' ]);
if ( mysql_query ( " UPDATE `users` SET `master`=noj+mec+topor+dubina+mfire+mwater+mair+mearth+mlight+mgray+mdark+master,noj=0,mec=0,topor=0,dubina=0,mfire=0,mwater=0,mair=0,mearth=0,mlight=0,mgray=0,mdark=0 WHERE `id`=' " . $user [ 'id' ] . " ' LIMIT 1; " )) {
mysql_query ( " UPDATE `bank` SET `ekr`=`ekr`-'2' WHERE `id`=' " . $_SESSION [ 'bankid' ] . " ' LIMIT 1; " );
mysql_query ( " INSERT INTO `delo` (`id`,`author`,`pers`,`text`,`type`,`date`) VALUES ('','0',' " . $_SESSION [ 'uid' ] . " ',' " . $user [ 'login' ] . " перераспределил умения, заплатив 2 екр. с о счета № " . $_SESSION [ 'bankid' ] . " в банке. ',1,' " . time () . " '); " );
$bank = mysql_fetch_array ( mysql_query ( " SELECT * FROM `bank` WHERE `id`=' " . $_SESSION [ 'bankid' ] . " '; " ));
$mywarn = " В с е прошло удачно. Вы можете перераспределить умения." ;
2018-02-27 03:53:10 +00:00
} else {
2018-02-27 05:14:11 +00:00
$mywarn = " Произошла ошибка! " ;
2018-02-27 03:53:10 +00:00
}
2018-02-27 05:14:11 +00:00
} else {
$mywarn = " У вас недостаточно денег на валютном счету для выполнения операции" ;
2018-01-28 16:40:49 +00:00
}
2018-02-27 05:14:11 +00:00
$_GET [ 'dropm' ] = 0 ;
}
if ( $_GET [ 'dropst' ]) {
$travma = mysql_fetch_array ( mysql_query ( " SELECT * FROM `effects` WHERE `owner`=' " . $user [ 'id' ] . " ' AND (`type`=11 OR `type`=12 OR `type`=13 OR `type`=14) ORDER BY `type` DESC LIMIT 1; " ));
if ( $travma [ 'type' ]) {
$mywarn = " Невозможно сбрасывать статы находясь в травме! " ;
} else {
undressall ( $user [ 'id' ]);
$user1 = mysql_fetch_array ( mysql_query ( " SELECT * FROM `users` WHERE `id`=' " . $user [ 'id' ] . " ' LIMIT 1; " ));
$svstats = $user1 [ 'sila' ] + $user1 [ 'lovk' ] + $user1 [ 'inta' ] + $user1 [ 'vinos' ] + $user1 [ 'intel' ] + $user1 [ 'mudra' ] - 12 - $user1 [ 'level' ];
if ( $svstats <= $bank [ 'ekr' ]) {
2018-02-28 21:16:09 +00:00
$exps = [ " 20 " => [ 15 ],
" 45 " => [ 16 ],
" 75 " => [ 17 ],
" 110 " => [ 18 ],
" 160 " => [ 21 ],
" 215 " => [ 22 ],
" 280 " => [ 23 ],
" 350 " => [ 24 ],
" 410 " => [ 25 ],
" 530 " => [ 28 ],
" 670 " => [ 29 ],
" 830 " => [ 30 ],
" 950 " => [ 31 ],
" 1100 " => [ 32 ],
" 1300 " => [ 33 ],
" 1450 " => [ 36 ],
" 1650 " => [ 37 ],
" 1850 " => [ 38 ],
" 2050 " => [ 39 ],
" 2200 " => [ 40 ],
" 2500 " => [ 41 ],
" 2900 " => [ 46 ],
" 3350 " => [ 47 ],
" 3800 " => [ 48 ],
" 4200 " => [ 49 ],
" 4600 " => [ 50 ],
" 5000 " => [ 51 ],
" 6000 " => [ 54 ],
" 7000 " => [ 55 ],
" 8000 " => [ 56 ],
" 9000 " => [ 57 ],
" 10000 " => [ 58 ],
" 11000 " => [ 59 ],
" 12000 " => [ 60 ],
" 12500 " => [ 61 ],
" 14000 " => [ 64 ],
" 15500 " => [ 65 ],
" 17000 " => [ 66 ],
" 19000 " => [ 67 ],
" 21000 " => [ 68 ],
" 23000 " => [ 69 ],
" 26000 " => [ 70 ],
" 30000 " => [ 71 ],
" 60000 " => [ 76 ],
" 75000 " => [ 77 ],
" 150000 " => [ 78 ],
" 175000 " => [ 79 ],
" 200000 " => [ 80 ],
" 225000 " => [ 81 ],
" 250000 " => [ 82 ],
" 260000 " => [ 83 ],
" 280000 " => [ 84 ],
" 300000 " => [ 85 ],
" 1500000 " => [ 86 ],
" 1750000 " => [ 87 ],
" 2000000 " => [ 88 ],
" 2175000 " => [ 89 ],
" 2300000 " => [ 90 ],
" 2400000 " => [ 91 ],
" 2500000 " => [ 92 ],
" 2600000 " => [ 93 ],
" 2800000 " => [ 94 ],
" 3000000 " => [ 95 ],
" 6000000 " => [ 96 ],
" 6500000 " => [ 97 ],
" 7500000 " => [ 98 ],
" 8500000 " => [ 99 ],
" 9000000 " => [ 100 ],
" 9250000 " => [ 101 ],
" 9500000 " => [ 102 ],
" 9750000 " => [ 103 ],
" 9900000 " => [ 104 ],
" 10000000 " => [ 105 ],
" 13000000 " => [ 106 ],
" 14000000 " => [ 107 ],
" 15000000 " => [ 108 ],
" 16000000 " => [ 109 ],
" 17000000 " => [ 110 ],
" 17500000 " => [ 111 ],
" 18000000 " => [ 112 ],
" 19000000 " => [ 113 ],
" 19500000 " => [ 114 ]];
2018-02-27 05:14:11 +00:00
echo " <pre> " ;
$ss = mysql_query ( " SELECT `id`,`nextup`,`level` FROM `users` WHERE `level` > 0 AND `level` < 8 AND id=' " . $user [ 'id' ] . " '; " );
$errdo = 0 ;
while ( $ssd = mysql_fetch_array ( $ss )) {
undressall ( $ssd [ 'id' ]);
if ( ! mysql_query ( " UPDATE `users` SET `sila`='3',`lovk`='3',`inta`='3',`vinos`=' " . ( 3 + $ssd [ 'level' ]) . " ',`intel`='0',`fkrit`='0',`fakrit`='0',`fuvorot`='0',`fauvorot`='0',`stats`=' " . ( $exps [ $ssd [ 'nextup' ]][ 0 ] - 12 ) . " ' WHERE `id`=' " . $ssd [ 'id' ] . " '; " )) $errdo = 1 ;
}
if ( $errdo == 0 ) {
mysql_query ( " UPDATE `bank` SET `ekr`=`ekr`-' " . $svstats . " ' WHERE `id`=' " . $_SESSION [ 'bankid' ] . " ' LIMIT 1; " );
mysql_query ( " INSERT INTO `delo` (`id`,`author`,`pers`,`text`,`type`,`date`) VALUES ('','0',' " . $_SESSION [ 'uid' ] . " ',' " . $user [ 'login' ] . " перераспределил статы, заплатив " . $svstats . " екр. с о счета № " . $_SESSION [ 'bankid' ] . " в банке. ',1,' " . time () . " '); " );
2018-02-27 03:53:10 +00:00
$bank = mysql_fetch_array ( mysql_query ( " SELECT * FROM `bank` WHERE `id`=' " . $_SESSION [ 'bankid' ] . " '; " ));
2018-02-27 05:14:11 +00:00
$mywarn = " В с е прошло удачно. Вы можете перераспределить статы." ;
2018-02-27 03:53:10 +00:00
} else {
2018-02-27 05:14:11 +00:00
$mywarn = " Произошла ошибка! Обратитесь к палладинам. " ;
2018-02-27 03:53:10 +00:00
}
2018-02-27 05:14:11 +00:00
$vinos = $user1 [ 'level' ] + 3 ;
$hp = $vinos * 6 ;
if ( mysql_query ( " UPDATE `users` SET `stats`=' " . $svstats . " ',lovk=3,sila=3,inta=3,vinos=' " . $vinos . " ',hp=' " . $hp . " ',maxhp=' " . $hp . " ',intel=0,mudra=0 WHERE `id`=' " . $user [ 'id' ] . " ' LIMIT 1; " )) {
mysql_query ( " UPDATE `bank` SET `ekr`=`ekr`-' " . $svstats . " ' WHERE `id`=' " . $_SESSION [ 'bankid' ] . " ' LIMIT 1; " );
mysql_query ( " INSERT INTO `delo` (`id`,`author`,`pers`,`text`,`type`,`date`) VALUES ('','0',' " . $_SESSION [ 'uid' ] . " ',' " . $user [ 'login' ] . " перераспределил статы, заплатив " . $svstats . " екр. с о счета № " . $_SESSION [ 'bankid' ] . " в банке. ',1,' " . time () . " '); " );
2018-02-27 03:53:10 +00:00
$bank = mysql_fetch_array ( mysql_query ( " SELECT * FROM `bank` WHERE `id`=' " . $_SESSION [ 'bankid' ] . " '; " ));
2018-02-27 05:14:11 +00:00
$mywarn = " В с е прошло удачно. Вы можете перераспределить статы." ;
2018-02-27 03:53:10 +00:00
} else {
$mywarn = " Произошла ошибка! " ;
}
} else {
$mywarn = " У вас недостаточно денег на валютном счету для выполнения операции" ;
}
2018-01-28 16:40:49 +00:00
}
2018-02-27 05:14:11 +00:00
$_GET [ 'dropst' ] = 0 ;
}
2018-01-28 16:40:49 +00:00
2018-02-27 03:53:10 +00:00
2018-02-27 05:14:11 +00:00
### Чеки
/**
*
*/
function bank_show ()
{
global $user ;
$pl = db :: c () -> query ( 'SELECT `id`,`name`,`bcost` FROM `inventory` WHERE `owner` = ?i AND `bcost` > 0 ORDER BY `bcost` ASC' , $user [ 'id' ]);
if ( $pl -> getNumRows () > 0 ) {
echo '<select name=\'coste\'>' ;
while ( $sp = $pl -> fetch_assoc ()) {
echo '<option value=\'' . $sp [ 'id' ] . '\'>' . $sp [ 'name' ] . '</option>' ;
}
echo '</select> <input class="ctContent" type="submit" value="Обменять" name="saled" />' ;
} else {
echo '<b>Нет чеков для обмена</b>' ;
}
}
if ( $_POST [ 'sales' ] && $_POST [ 'count_ekr' ] && ( ! empty ( $user [ 'admin' ]))) {
if ( isset ( $bank [ 'id' ])) {
$cnt = round ( $_POST [ 'count_ekr' ], 2 );
if ( $cnt < 1 ) {
err ( 'Минимальная сумма: 1 екр' );
} elseif ( $bank [ 'ekr' ] < $cnt ) {
err ( 'Недостаточно средств ...' );
2018-02-27 03:53:10 +00:00
} else {
2018-02-27 05:14:11 +00:00
$name = 'Банковский чек на ' . $cnt . ' еврокредитов' ;
db :: c () -> query ( 'INSERT INTO `inventory` SET `name` = "?s", `bcost` = ?i, `owner` = ?i, `prototype` = ?i' , $name , $cnt , $user [ 'id' ], 1123 );
// $bank['ekr'] -= $cnt;
// mysql_query('UPDATE `bank` SET `ekr` = "' . $bank['ekr'] . '" WHERE `id` = "' . $bank['id'] . '" LIMIT 1');
db :: c () -> query ( 'UPDATE `bank` SET `ekr` = `ekr` - ?i WHERE `id` = ?i' , $cnt , $bank [ 'id' ]);
err ( 'Чек на сумму : ' . $cnt . ' екр., появится у В а с в инвентаре ...' );
2018-02-27 03:53:10 +00:00
}
2018-02-27 05:14:11 +00:00
} else {
err ( 'Банковский счёт, не найден ...' );
2018-02-27 03:53:10 +00:00
}
2018-02-27 05:14:11 +00:00
}
2018-01-28 16:40:49 +00:00
2018-02-27 05:14:11 +00:00
if ( $_POST [ 'saled' ] && $_POST [ 'coste' ] && ( ! empty ( $user [ 'admin' ]))) {
$item = mysql_fetch_array ( mysql_query ( 'SELECT `id`, `name`, `bcost` FROM `inventory` WHERE `owner` = "' . $user [ 'id' ] . '" AND `id` = "' . mysql_real_escape_string ( $_POST [ 'coste' ]) . '" LIMIT 1' ));
if ( isset ( $item [ 'id' ])) {
if ( $item [ 'bcost' ] > 0 ) {
mysql_query ( 'DELETE FROM `inventory` WHERE `owner` = "' . $user [ 'id' ] . '" AND `id` = "' . $item [ 'id' ] . '" LIMIT 1' );
$bank [ 'ekr' ] += $item [ 'bcost' ];
mysql_query ( 'UPDATE `bank` SET `ekr` = "' . $bank [ 'ekr' ] . '" WHERE `id` = "' . $bank [ 'id' ] . '" LIMIT 1' );
err ( $item [ 'name' ] . ', успешно обналичен ...' );
} else {
err ( 'Это не чек ...' );
}
} else {
err ( 'Чек, не найден ...' );
}
}
###
2018-02-27 06:07:27 +00:00
if ( $_POST [ 'changeback' ] && $_POST [ 'ok' ] && ( ! empty ( $user [ 'admin' ]))) {
$_POST [ 'ok' ] = round ( $_POST [ 'ok' ], 2 );
if ( is_numeric ( $_POST [ 'ok' ]) && ( $_POST [ 'ok' ] > 0 ) && ( $_POST [ 'ok' ] <= $bank [ 'cr' ])) {
$bank [ 'cr' ] -= $_POST [ 'ok' ];
$bank [ 'ekr' ] += $_POST [ 'ok' ] / 500 ;
$add_ekr = $_POST [ 'ok' ] / 500 ;
if ( mysql_query ( " UPDATE `bank` SET `cr`=`cr`-' " . $_POST [ 'ok' ] . " ' WHERE `id`=' " . $bank [ 'id' ] . " ' LIMIT 1; " )) {
$mywarn = " Обмен произведен успешно " ;
mysql_query ( " UPDATE `bank` SET `ekr`=`ekr`+' $add_ekr ' WHERE `id`=' " . $_SESSION [ 'bankid' ] . " ' LIMIT 1; " );
$bank = mysql_fetch_array ( mysql_query ( " SELECT * FROM `bank` WHERE `id`=' " . $_SESSION [ 'bankid' ] . " '; " ));
mysql_query ( " INSERT INTO `delo` (`id`,`author`,`pers`,`text`,`type`,`date`) VALUES ('','0',' " . $_SESSION [ 'uid' ] . " ','Персонаж " . $user [ 'login' ] . " обменял " . $_POST [ 'ok' ] . " кр. на " . $add_ekr . " екр. на счету № " . $_SESSION [ 'bankid' ] . " в банке. ',1,' " . time () . " '); " );
} else {
$mywarn = " Произошла ошибка! " ;
}
} else {
$mywarn = " У вас недостаточно денег для выполнения операции" ;
}
$_POST [ 'changeback' ] = 0 ;
}
2018-02-27 03:53:10 +00:00
2018-02-27 05:14:11 +00:00
err ( $mywarn );
2018-03-09 22:34:51 +00:00
$mywarn = '' ;
2018-02-27 05:14:11 +00:00
?>
2018-02-27 05:41:56 +00:00
< a href = " ?exit=1 " > ← выйти из счёта </ a >
2018-03-09 23:00:39 +00:00
< br >< br > Красным < span style = " background:#FFAAAA; " > помечены </ span > нерабочие элементы .< br >
2018-02-27 05:14:11 +00:00
< div class = " appblock " >
2018-03-09 21:12:03 +00:00
< span > Денежные средства </ span >
Кредитов на руках : < b >< ? = $user [ 'money' ] ?> </b> кр.<br>
< form method = " post " >
< input size = " 10 " name = " summa " placeholder = " Сумма " >
2018-03-09 22:22:08 +00:00
< input type = " hidden " name = " action " value = " money-in " >
2018-03-09 22:16:41 +00:00
< input type = " submit " value = " Положить на счёт " >
2018-03-09 21:12:03 +00:00
</ form >
< form method = " post " >
< input size = " 10 " name = " summa " placeholder = " Сумма " >
2018-03-09 22:22:08 +00:00
< input type = " hidden " name = " action " value = " money-out " >
2018-03-09 22:16:41 +00:00
< input type = " submit " value = " Снять с о счёта " >
2018-03-09 21:12:03 +00:00
</ form >
2018-02-27 05:14:11 +00:00
</ div >
2018-03-09 22:01:20 +00:00
< div class = " appblock " >
2018-03-09 21:12:03 +00:00
< span > Перевод кредитов </ span >
< form method = " post " >
< input size = " 10 " name = " summa " placeholder = " Сумма " >
2018-03-09 22:12:59 +00:00
< input size = " 10 " name = " to-id " placeholder = " Cчёт " >< br >
2018-03-09 22:22:08 +00:00
< input type = " hidden " name = " action " value = " send-money " >
2018-03-09 22:16:41 +00:00
< input type = " submit " value = " Перевести кредиты " >
2018-02-27 05:14:11 +00:00
</ form >
2018-03-09 22:01:20 +00:00
< i > Комиссия составит 5 % от переводимой суммы , но не менее 1 кр .</ i >
2018-02-27 05:14:11 +00:00
</ div >
< ? if ( ! empty ( $user [ 'admin' ])) : ?>
< div class = " appblock " style = " background:#FFAAAA; " >
< legend > Обменять екр . на кр .</ legend >
К у р с обмена : 1 екр . = 100 кр .< br >
< form method = " POST " >
Сумма екр . для обмена
< input type = text name = ok placeholder = " Сумма " >
< input type = submit name = change value = " обменять " >
</ form >
</ div >
< div class = " appblock " style = " background:#FFAAAA; " >
< legend > Обменять кр . на екр .</ legend >
К у р с обмена : 500 кр . = 1 екр .< br >
< form method = " POST " >
Сумма кр . для обмена
< input type = text name = ok placeholder = " Сумма " >
< input type = submit name = changeback value = " обменять " >
</ form >
2018-02-27 03:53:10 +00:00
</ div >
2018-03-09 18:07:04 +00:00
< div class = " appblock " style = " background:#FFAAAA; " >
2018-02-27 03:53:10 +00:00
< legend > Выписать чек </ legend >
Услуга " чек на предъявителя " . Вы выписываете екровый чек , который затем сможет обналичить любой
персонаж .< br >
< form method = " POST " >
Сумма ( екр ) : < input type = " text " size = " 4 " name = " count_ekr " /> < input type = " submit " value = " Выписать "
name = " sales " />
</ form >
</ div >
2018-03-09 18:07:04 +00:00
< div class = " appblock " style = " background:#FFAAAA; " >
2018-02-27 03:53:10 +00:00
< legend > Обналичить чек </ legend >
В нашем банке мы принимаем к погашению екровые чеки на предъявителя .
< form method = " POST " >
2018-02-27 05:14:11 +00:00
< ? php bank_show (); ?>
2018-02-27 03:53:10 +00:00
</ form >
</ div >
2018-02-27 05:14:11 +00:00
< ? php endif ;
} # Очень важная и гордая кавычка!
2018-01-28 16:40:49 +00:00
?>
</ body >
</ html >