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-01-28 16:40:49 +00:00
$cost_login = 25 ;
######## ОБЩИЕ ЗАПРОСЫ В БАЗУ ###
#################################
2018-02-27 03:53:10 +00:00
function inschet ( $userid )
{
$banks = db :: c () -> query ( 'SELECT `id` FROM `bank` WHERE `owner` = ?i' , $userid );
echo " <select style='width:150px' name=id> " ;
while ( $rah = $banks -> fetch_assoc ()) {
echo " <option> " . $rah [ 'id' ] . " </option> " ;
}
echo " </select> " ;
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 >
function returned2 ( s ) {
top . frames [ 'main' ] . location = 'city.php?' + s + 'tmp=' + Math . random ()
}
</ script >
< script src = " /js/jquery-1.7.2.min.js " ></ script >
< style >
legend {
padding : 0.2 em 0.5 em ;
color : #666;
font - weight : bold ;
}
. appblock {
background : silver ;
border - radius : 2 px ;
float : left ;
height : 200 px ;
margin : 10 px ;
max - width : 250 px ;
opacity : 0.75 ;
padding : 5 px ;
}
div . appblock form {
margin : 0 ;
}
</ style >
2018-01-28 16:40:49 +00:00
</ head >
2018-02-27 03:53:10 +00:00
< body >
< a href = " ?exit=1 " > ← выйти из банка </ a >
< ? php if ( ! empty ( $error )) : ?>
< h1 >< ? php echo $error ; ?> </h1>
< ? php endif ; ?>
2018-02-27 05:14:11 +00:00
< h1 > Cче т № < b >< ? = $_SESSION [ 'bankid' ] ?> </h1>
2018-02-27 03:53:10 +00:00
< ? php
if ( $_GET [ 'exit' ]) $_SESSION [ 'bankid' ] = null ;
if ( $_POST [ 'enter' ] && $_POST [ 'pass' ]) {
2018-02-27 05:14:11 +00:00
// $data = mysql_query("SELECT * FROM `bank` WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . (int)$_POST['id'] . "' AND `pass` = '" . md5($_POST['pass']) . "' LIMIT 1");
$data = db :: c () -> query ( 'SELECT 1 FROM `bank` WHERE `owner` = ?i' , $user [ 'id' ]);
// $data = mysql_fetch_array($data);
2018-02-27 03:53:10 +00:00
if ( $data ) {
$_SESSION [ 'bankid' ] = $_POST [ 'id' ];
err ( 'Удачный вход.' );
} else {
err ( 'Ошибка входа.' );
}
2018-01-28 16:40:49 +00:00
}
2018-02-27 03:53:10 +00:00
if ( $_POST [ 'resendmail' ]) {
$newpass = md5 ( md5 ( math . rand ( - 2000000 , 2000000 ) . $user [ 'login' ]));
$newpass = substr ( $newpass , 0 , 10 );
$lasttime = mktime ( 0 , 0 , 0 , date ( " m " ), date ( " d " ) + 1 , date ( " Y " ));
$ipclient = getenv ( " HTTP_X_FORWARDED_FOR " );
if ( mysql_query ( " INSERT INTO confirmpasswd(`login`,`passwd`,`date`,`ip`,`active`) VALUES('bbb " . $_POST [ 'id' ] . " bbb',' " . $newpass . " ',' " . $lasttime . " ',' " . $ipclient . " ',1); " )) {
$headers = " Mime-Version: 1.1 \r \n " ;
$headers .= " Date: " . date ( " r " ) . " \r \n " ;
$headers .= " Content-type: text/html; charset=utf-8 \r \n " ;
$headers .= " From: Онлайн игра Бойцовский Клуб Возрождение <support@capitalcity.old-dark.ru> \r \n " ;
$headers = trim ( $headers );
$headers = stripslashes ( $headers );
$aa = ' < html >< head >< title > Востановление пароля </ title >
2018-01-28 16:40:49 +00:00
</ head >< body >
2018-02-27 03:53:10 +00:00
Добрый день ' . $user[' realname '] . ' .< br >
Вами было запрошено востановление пароля для счета ' . $_POST[' id '] . ' c IP адреса - ' . $ipclient . ' , если это были не Вы , просто удалите это письмо .< br >
2018-01-28 16:40:49 +00:00
< br >
------------------------------------------------------------------< br >
2018-02-27 03:53:10 +00:00
Ваш № счета | ' . $_POST[' id '] . ' < br >
Новый пароль | ' . $newpass . ' < br >
2018-01-28 16:40:49 +00:00
------------------------------------------------------------------< br >
< br >< br >
< h3 > Для подтверждения нового пароля пройдите по ссылке ниже .</ h3 >< br >
2018-02-27 03:53:10 +00:00
< a href = " http://capitalcity.old-dark.ru/confpassbank.php?newpass=' . $newpass . '&login=' . $_POST['id'] . '&flag=1&timev=' . $lasttime . ' " > Востановление пароля </ a >
2018-01-28 16:40:49 +00:00
< br >
2018-02-27 03:53:10 +00:00
< font color = " blue " > Если вы не восстановите пароль до < b > ' . date("d-M-Y", $lasttime) . ' 00 : 00 </ b > , ссылка будет неактивной .</ font >
2018-01-28 16:40:49 +00:00
< br >
Отвечать на данное письмо не нужно .
</ body >
</ html > ' ;
2018-02-27 03:53:10 +00:00
mail ( $user [ 'email' ], " Востановление банковского счета, для пользователя - " . $user [ 'login' ], $aa , $headers );
echo " <center><font color='blue' size='14'><h3>Пароль отправлен Вам на почту.</h3></font></center> " ;
die ();
2018-01-28 16:40:49 +00:00
} else {
2018-02-27 03:53:10 +00:00
echo " <center><h3>Сегодня пароль уже высылался. <br>Проверьте почту</h3></center> " ;
die ();
2018-01-28 16:40:49 +00:00
}
}
2018-02-27 03:53:10 +00:00
if ( $_POST [ 'repasswd' ]) {
?>
< b > Для востановления пароля необходимо :< br >
< ul >
< li > 1 ) Выбрать счет .</ li >
< li > 2 ) Нажать кнопочку восстановить .</ li >
</ ul >
Вам будет выслано письмо на email , указанный при регистрации , с новым паролем .</ ul ></ b >< br >< br >
< form method = " post " > Выберите счет : < ? php inschet ( $user [ 'id' ]); ?> <input type="submit" name="resendmail"
value = " Восстановить " ></ form >
< ?
} elseif ( ! $_SESSION [ 'bankid' ]) {
?>
2018-02-27 05:14:11 +00:00
< table width = " 1130 " border = " 0 " cellspacing = " 0 " cellpadding = " 0 " align = " center " " >
< tbody >
< tr >
< td colspan = " 3 " height = " 30 " >
</ td >
</ tr >
< tr >
< td width = " 200 " >& nbsp ; </ td >
< td height = " 523 " valign = " top " >
< table width = " 100% " border = " 0 " >
< tbody >
< tr valign = " top " align = " left " >
< td >
< form method = " post " action = " bank.php " >
< h2 > Войти в счет </ h2 >
< table border = " 0 " >
< tbody >
< tr >
< td >
№ < ? inschet ( $user [ 'id' ]); ?> <br>
< input type = " password " name = " pass " size = " 21 " placeholder = " Пароль " >
< br >
< input type = " hidden " name = " enter " value = " 1 " >
</ td >
</ tr >
< tr >
< td align = " center " >
< input type = " submit " name = " enter " value = " Войти " >
</ td >
</ tr >
</ tbody >
</ table >
</ form >
</ td >
</ tr >
< tr valign = " top " align = " left " >
< td >
< form method = " post " >
< h2 > Восстановить пароль </ h2 >
< table border = " 0 " >
< tbody >
< tr >
< td >
Выберите счет :< br >
< ? php inschet ( $user [ 'id' ]); ?> <br>
</ td >
</ tr >
< tr >
< td align = " center " >
< input type = " submit " name = " resendmail " value = " Восстановить " >
</ td >
</ tr >
< tr >
< td >
< small > Вам будет выслано письмо на email , < br > указанный при регистрации ,
< br > с новым паролем .
</ small >
</ td >
</ tr >
</ tbody >
</ table >
</ form >
</ td >
</ tr >
</ tbody >
</ table >
</ td >
< td width = " 50 " height = " 30 " valign = " top " >< br >< INPUT TYPE = button value = " Обновить "
onClick = " location.href='main.php'; " ></ td >
< td width = " 230 " valign = " top " >< br >< input type = " button " value = " Вернуться "
onclick = " returned2('strah=1&'); " ></ td >
2018-01-28 16:40:49 +00:00
2018-02-27 05:14:11 +00:00
</ tr >
</ tbody ></ table >
< ?
} else {
if ( $_GET [ 'fail' ]) {
err ( 'Ошибка пополнения баланса.' );
die ();
}
if ( $_GET [ 'suk' ]) {
err ( 'Баланс удачно пополнен.' );
die ();
}
if ( $_POST [ 'in' ] && $_POST [ 'ik' ]) {
$_POST [ 'ik' ] = round ( $_POST [ 'ik' ], 2 );
if ( is_numeric ( $_POST [ 'ik' ]) && ( $_POST [ 'ik' ] > 0 ) && ( $_POST [ 'ik' ] <= $user [ 'money' ])) {
$user [ 'money' ] -= $_POST [ 'ik' ];
if ( mysql_query ( " UPDATE `users` SET `money`=`money`-' " . $_POST [ 'ik' ] . " ' WHERE `id`= " . $user [ 'id' ] . " LIMIT 1; " )) {
$mywarn = " Деньги удачно положены на счет " ;
mysql_query ( " UPDATE `bank` SET `cr`=`cr`+' " . $_POST [ 'ik' ] . " ' WHERE `id`= " . $_SESSION [ 'bankid' ] . " LIMIT 1; " );
mysql_query ( " INSERT INTO `delo`(`id`,`author`,`pers`,`text`,`type`,`date`) VALUES ('','0',' " . $_SESSION [ 'uid' ] . " ','Персонаж " . $user [ 'login' ] . " положил на свой счет № " . $_SESSION [ 'bankid' ] . " " . $_POST [ 'ik' ] . " кр. ',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 [ 'in' ] = 0 ;
}
$bank = mysql_fetch_array ( mysql_query ( " SELECT * FROM `bank` WHERE `id`= " . $_SESSION [ 'bankid' ] . " ; " ));
if ( $_POST [ 'out' ] && $_POST [ 'ok' ]) {
$_POST [ 'ok' ] = round ( $_POST [ 'ok' ], 2 );
if ( is_numeric ( $_POST [ 'ok' ]) && ( $_POST [ 'ok' ] > 0 ) && ( $_POST [ 'ok' ] <= $bank [ 'cr' ])) {
$user [ 'money' ] += $_POST [ 'ok' ];
if ( mysql_query ( " UPDATE `users` SET `money`=`money`+' " . $_POST [ 'ok' ] . " ' WHERE `id`=' " . $user [ 'id' ] . " ' LIMIT 1; " )) {
$mywarn = " Деньги удачно сняты с о счета " ;
mysql_query ( " UPDATE `bank` SET `cr`=`cr`-' " . $_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' ] . " снял с о своего счета № " . $_SESSION [ 'bankid' ] . " " . $_POST [ 'ok' ] . " кр.',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-01-28 16:40:49 +00:00
}
2018-02-27 05:14:11 +00:00
$_POST [ 'out' ] = 0 ;
}
2018-01-28 16:40:49 +00:00
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 ;
}
if ( $_POST [ 'changeback' ] && $_POST [ 'ok' ]) {
$_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 () . " '); " );
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 [ 'changeback' ] = 0 ;
}
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' ]) {
$exps = array ( " 20 " => array ( 15 ),
" 45 " => array ( 16 ),
" 75 " => array ( 17 ),
" 110 " => array ( 18 ),
" 160 " => array ( 21 ),
" 215 " => array ( 22 ),
" 280 " => array ( 23 ),
" 350 " => array ( 24 ),
" 410 " => array ( 25 ),
" 530 " => array ( 28 ),
" 670 " => array ( 29 ),
" 830 " => array ( 30 ),
" 950 " => array ( 31 ),
" 1100 " => array ( 32 ),
" 1300 " => array ( 33 ),
" 1450 " => array ( 36 ),
" 1650 " => array ( 37 ),
" 1850 " => array ( 38 ),
" 2050 " => array ( 39 ),
" 2200 " => array ( 40 ),
" 2500 " => array ( 41 ),
" 2900 " => array ( 46 ),
" 3350 " => array ( 47 ),
" 3800 " => array ( 48 ),
" 4200 " => array ( 49 ),
" 4600 " => array ( 50 ),
" 5000 " => array ( 51 ),
" 6000 " => array ( 54 ),
" 7000 " => array ( 55 ),
" 8000 " => array ( 56 ),
" 9000 " => array ( 57 ),
" 10000 " => array ( 58 ),
" 11000 " => array ( 59 ),
" 12000 " => array ( 60 ),
" 12500 " => array ( 61 ),
" 14000 " => array ( 64 ),
" 15500 " => array ( 65 ),
" 17000 " => array ( 66 ),
" 19000 " => array ( 67 ),
" 21000 " => array ( 68 ),
" 23000 " => array ( 69 ),
" 26000 " => array ( 70 ),
" 30000 " => array ( 71 ),
" 60000 " => array ( 76 ),
" 75000 " => array ( 77 ),
" 150000 " => array ( 78 ),
" 175000 " => array ( 79 ),
" 200000 " => array ( 80 ),
" 225000 " => array ( 81 ),
" 250000 " => array ( 82 ),
" 260000 " => array ( 83 ),
" 280000 " => array ( 84 ),
" 300000 " => array ( 85 ),
" 1500000 " => array ( 86 ),
" 1750000 " => array ( 87 ),
" 2000000 " => array ( 88 ),
" 2175000 " => array ( 89 ),
" 2300000 " => array ( 90 ),
" 2400000 " => array ( 91 ),
" 2500000 " => array ( 92 ),
" 2600000 " => array ( 93 ),
" 2800000 " => array ( 94 ),
" 3000000 " => array ( 95 ),
" 6000000 " => array ( 96 ),
" 6500000 " => array ( 97 ),
" 7500000 " => array ( 98 ),
" 8500000 " => array ( 99 ),
" 9000000 " => array ( 100 ),
" 9250000 " => array ( 101 ),
" 9500000 " => array ( 102 ),
" 9750000 " => array ( 103 ),
" 9900000 " => array ( 104 ),
" 10000000 " => array ( 105 ),
" 13000000 " => array ( 106 ),
" 14000000 " => array ( 107 ),
" 15000000 " => array ( 108 ),
" 16000000 " => array ( 109 ),
" 17000000 " => array ( 110 ),
" 17500000 " => array ( 111 ),
" 18000000 " => array ( 112 ),
" 19000000 " => array ( 113 ),
" 19500000 " => array ( 114 ));
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 05:14:11 +00:00
if ( $_POST [ 'wu' ] && $_POST [ 'sum' ] && $_POST [ 'number' ]) {
if ( $user [ 'align' ] == 4 ) {
$mywarn = " Хаосникам переводы запрещены! " ;
} else {
$bank2 = mysql_fetch_array ( mysql_query ( " SELECT * FROM `bank` WHERE `id`=' " . $_POST [ 'number' ] . " '; " ));
$to = mysql_fetch_array ( mysql_query ( " SELECT login FROM `users` WHERE `id`=' " . $bank2 [ 'owner' ] . " '; " ));
if ( $bank2 [ 0 ]) {
$_POST [ 'sum' ] = round ( $_POST [ 'sum' ], 2 );
if ( is_numeric ( $_POST [ 'sum' ]) && ( $_POST [ 'sum' ] > 0 )) {
$nalog = round ( $_POST [ 'sum' ] * 0.03 );
if ( $nalog < 1 ) {
$nalog = 1 ;
2018-02-27 03:53:10 +00:00
}
2018-02-27 05:14:11 +00:00
$new_sum = $_POST [ 'sum' ] + $nalog ;
if ( $new_sum <= $bank [ 'cr' ]) {
if ( mysql_query ( " UPDATE `bank` SET `cr`=`cr`-' " . $new_sum . " ' WHERE `id`=' " . $_SESSION [ 'bankid' ] . " ' LIMIT 1; " )) {
mysql_query ( " UPDATE `bank` SET `cr`=`cr`+' " . $_POST [ 'sum' ] . " ' WHERE `id`=' " . $_POST [ 'number' ] . " ' 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' ] . " перевел с о своего банковского счета № " . $_SESSION [ 'bankid' ] . " на счет № " . $_POST [ 'number' ] . " к персонажу " . $to [ 'login' ] . " " . $_POST [ 'sum' ] . " кр. Дополнительно снято " . $nalog . " кр. за услуги банка ',1,' " . time () . " '); " );
mysql_query ( " INSERT INTO `delo` (`id`,`author`,`pers`,`text`,`type`,`date`) VALUES ('','0',' " . $bank2 [ 'owner' ] . " ','Персонаж " . $user [ 'login' ] . " перевел с о своего банковского счета № " . $_SESSION [ 'bankid' ] . " на счет № " . $_POST [ 'number' ] . " к персонажу " . $to [ 'login' ] . " " . $_POST [ 'sum' ] . " кр. Дополнительно снято " . $nalog . " кр. за услуги банка ',1,' " . time () . " '); " );
$sum = $_POST [ 'sum' ];
$schet = $_POST [ 'number' ];
$mywarn = " $sum кр. успешно переведены на счет № $schet " ;
} else {
$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
}
} 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 [ 'wu' ] = 0 ;
}
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 03:53:10 +00:00
2018-02-27 05:14:11 +00:00
err ( $mywarn );
?>
< div class = " appblock " >
< legend > Денежные средства </ legend >
Кредитов на руках : < b >< ? = $user [ 'money' ] ?> </b> кр.<br>
Кредитов на счету : < b >< ? = $bank [ 'cr' ] ?> </b> кр.<br>
Еврокредитов на счету : < b >< ? = $bank [ 'ekr' ] ?> </b> екр.<br>
< table width = 100 %>
< tr >
< td width = " 75 " >< input type = text size = 10 name = ik placeholder = " Сумма " ></ td >
< td >< input type = submit name = in value = " Положить кредиты на счёт " ></ td >
</ tr >
< tr >
< td >< input type = text size = 10 name = ok placeholder = " Сумма " ></ td >
< td >< input type = submit name = out value = " Снять кредиты с о счёта " ></ td >
</ tr >
</ table >
</ div >
< div class = " appblock " >
< legend > Перевод кредитов </ legend >
< form method = " POST " >
2018-02-27 03:53:10 +00:00
< table width = 100 %>
< tr >
2018-02-27 05:14:11 +00:00
< td width = " 75 " >< input type = text size = 10 name = sum placeholder = " Сумма " ></ td >
2018-02-27 03:53:10 +00:00
</ tr >
< tr >
2018-02-27 05:14:11 +00:00
< td >< input type = text size = 10 name = number placeholder = " Cчёт получателя " ></ td >
2018-02-27 03:53:10 +00:00
</ tr >
</ table >
2018-02-27 05:14:11 +00:00
< input type = submit name = wu value = " Перевести кредиты " >
</ form >
Комиссия составит 3 % от переводимой суммы , но не менее 1 кр .
</ 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 >
< div class = " appblock " >
< legend > Выписать чек </ legend >
Услуга " чек на предъявителя " . Вы выписываете екровый чек , который затем сможет обналичить любой
персонаж .< br >
< form method = " POST " >
Сумма ( екр ) : < input type = " text " size = " 4 " name = " count_ekr " /> < input type = " submit " value = " Выписать "
name = " sales " />
</ form >
</ div >
< div class = " appblock " >
< 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 >