Файл: birzha-old.php
Строк: 1205
<?php
//error_reporting(2047|2048);
error_reporting(0);
include 'config.php';
class_exists('config') or die('Error load config class');
$config = new config(1, 1, 1);
$lang = $config->parse_lang() or die('Error parse lang file');
if(isset($_GET['id'])) $id = intval($_GET['id']);
elseif(isset($_POST['id'])) $id = intval($_POST['id']);
else $id = false;
if(isset($_GET['ps'])) $ps = trim($_GET['ps']);
elseif(isset($_POST['ps'])) $ps = trim($_POST['ps']);
else $ps = false;
if(!$id || !$ps){
$config->start('error', $lang['1014'], 'center');
echo '<u>'.$lang['1025'].'</u><br/>'.
'<a href="index.php?l='.$config->lang.'&v='.$config->vers.'">'.$lang['1003'].'</a>';
$config->finish(true);
}
if(!$mysql = mysql_connect($config->mysql['host'], $config->mysql['user'], $config->mysql['pass'])){
$config->start('error', $lang['1014']);
if($config->vers == 'wml'){
print '<b>'.$lang['1014'].'! '.$lang['1010'].'</b><br/>';
}
else
if($config->vers == 'html'){
print '<font color="'.$config->color['error'].'">'.$lang['1014'].'! '.$lang['1010'].'</font><br/>';
}
print $lang['1015'].' MySQL: <u>'.mysql_error().'</u><br/>';
print '<a href="index.php?l='.$config->lang.'&v='.$config->vers.'">'.$lang['1003'].'</a>';
$config->finish(true);
}
if(!mysql_select_db($config->mysql['db'], $mysql)){
$config->start('error', $lang['1014']);
if($config->vers == 'wml'){
print '<b>'.$lang['1014'].'! '.$lang['1011'].'</b><br/>';
}
else
if($config->vers == 'html'){
print '<font color="'.$config->color['error'].'">'.$lang['1014'].'! '.$lang['1011'].'</font><br/>';
}
print $lang['1015'].' MySQL: <u>'.mysql_error().'</u><br/>';
print '<a href="index.php?l='.$config->lang.'&v='.$config->vers.'">'.$lang['1003'].'</a>';
mysql_close($mysql); $config->finish(true);
}
$q = mysql_query("SELECT `pass`, `status` FROM `users` WHERE `id` = '$id';", $mysql);
$q = mysql_fetch_array($q);
if(!$q || $q['pass'] != $ps){
$config->start('error', $lang['1014'], 'center');
echo '<u>'.$lang['1025'].'</u><br/>'.
'<a href="index.php?l='.$config->lang.'&v='.$config->vers.'">'.$lang['1003'].'</a>';
mysql_close($mysql); $config->finish(true);
}
$status = $q['status'];
if($config->conf['birzha'] == 'off'){
$config->start('birzha', $lang['1122']);
if($config->vers == 'wml'){
print '<b>'.$lang['1229'].'</b><br/>';
}
else
if($config->vers == 'html'){
print '<font color="'.$config->color['error'].'">'.$lang['1229'].'</font><br/>';
}
print '<a href="panel.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1009'].'</a>';
mysql_close($mysql); $config->finish(true);
}
if(isset($_GET['act'])) $act = $_GET['act'];
elseif(isset($_POST['act'])) $act = $_POST['act'];
else $act = false;
/******************************************************************************/
if($config->conf['online']['birzha'] == 'on'){
mysql_query("UPDATE `users` SET `online_b` = '".time()."' WHERE `id` = '$id';", $mysql); }
/******************************************************************************/
if($act == 'buy'){
if((isset($_GET['del'])) && ($status == 4 || $status == 7 || strpos($config->conf['badmin'], '|'.$id.'|') !== false || strpos($config->conf['admin'], '|'.$id.'|') !== false)){
$del = intval($_GET['del']);
$q = mysql_query("SELECT `user`, `credit` FROM `birzha` WHERE `id` = '$del'", $mysql);
$q = mysql_fetch_array($q);
if($q){
if(mysql_query("DELETE FROM `birzha` WHERE `id` = '$del';", $mysql))
mysql_query("UPDATE `users` SET `bank` = `bank`+'".$q['credit']."' WHERE `id` = '".$q['user']."';", $mysql);
}
}
if(isset($_GET['buy'])) $buy = intval($_GET['buy']);
elseif(isset($_POST['buy'])) $buy = intval($_POST['buy']);
else $buy = false;
################################################################################
if($buy == true && $status > 2){
$config->start('buy', $lang['1232']);
$q = mysql_Query("SELECT `user`, `credit`, `money` FROM `birzha` WHERE `id` = '$buy' && `user` != '$id';", $mysql);
$q = mysql_fetch_array($q);
if(!$q || $q['credit'] < 1){
if($config->vers == 'wml') print '<small>';
echo '<u>'.$lang['1272'].'</u><br/><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=buy">'.$lang['1029'].'</a><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1122'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
if(!isset($_POST['credit']))
{
$rnd = mt_rand();
if($config->vers == 'wml')
echo '<small>'.
'<b>'.str_ireplace('%id%', $q['user'], str_ireplace('%credit%', $q['credit'], str_ireplace('%sum%', doubleval($q['money']), $lang['1283']))).'</b>'.
'<br/><br/>'.
$lang['1284'].':</small><br/>'.
'<input type="text" name="credit'.$rnd.'" value="'.$q['credit'].'" maxlength="9" format="*N"/><br/>'.
'<small><anchor>'.$lang['1028'].'<go href="birzha.php" method="post">'.
'<postfield name="l" value="'.$config->lang.'"/>'.
'<postfield name="v" value="wml"/>'.
'<postfield name="id" value="'.$id.'"/>'.
'<postfield name="ps" value="'.$ps.'"/>'.
'<postfield name="act" value="buy"/>'.
'<postfield name="buy" value="'.$buy.'"/>'.
'<postfield name="credit" value="$(credit'.$rnd.')"/>'.
'</go></anchor><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v=wml&id='.$id.'&ps='.$ps.'&act=buy">'.$lang['1027'].'</a>'.
'</small>';
else
if($config->vers == 'html')
echo '<form action="birzha.php" method="post">'.
'<input type="hidden" name="l" value="'.$config->lang.'"/>'.
'<input type="hidden" name="v" value="html"/>'.
'<input type="hidden" name="id" value="'.$id.'"/>'.
'<input type="hidden" name="ps" value="'.$ps.'"/>'.
'<input type="hidden" name="act" value="buy"/>'.
'<input type="hidden" name="buy" value="'.$buy.'"/>'.
'<font color="'.$config->color['other'].'">'.str_ireplace('%id%', $q['user'], str_ireplace('%credit%', $q['credit'], str_ireplace('%sum%', doubleval($q['money']), $lang['1283']))).'</font>'.
'<br/><br/>'.
$lang['1284'].':<br/>'.
'<input type="text" name="credit" value="'.$q['credit'].'" maxlength="9"/><br/>'.
'<input type="submit" value="'.$lang['1028'].'"/><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v=html&id='.$id.'&ps='.$ps.'&act=buy">'.$lang['1027'].'</a>'.
'</form>';
}
else
{
if($config->vers == 'wml') print '<small>';
$credit = intval($_POST['credit']);
if($credit > $q['credit'])
echo '<u>'.$lang['1285'].'</u><br/><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=buy&buy='.$buy.'">'.$lang['1029'].'</a><br/><br/>';
elseif($credit < 1)
echo '<u>'.$lang['1286'].'</u><br/><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=buy&buy='.$buy.'">'.$lang['1029'].'</a><br/><br/>';
else{
$qu = mysql_query("SELECT `money` FROM `users` WHERE `id` = '$id';", $mysql);
$qu = mysql_fetch_array($qu) or $qu['money'] = 0;
if($credit*$q['money'] > $qu['money'])
echo '<u>'.str_ireplace('%credit%', $credit, str_ireplace('%buy%', $credit*$q['money'], str_ireplace('%all%', doubleval($qu['money']), $lang['1287']))).'</u><br/><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=buy&buy='.$buy.'">'.$lang['1029'].'</a><br/><br/>';
elseif(!mysql_query("UPDATE `users` SET `bank` = `bank`+'$credit', `money` = '".($qu['money']-($credit*$q['money']))."' WHERE `id` = '$id';", $mysql))
echo '<u>'.$lang['1288'].'</u><br/><br/>';
else{
mysql_query("UPDATE `users` SET `money` = `money`+'".($credit*$q['money'])."' WHERE `id` = '".$q['user']."';", $mysql);
mysql_query("INSERT INTO `history` VALUES('$id', '".$q['user']."', '".time()."', '".($credit*$q['money'])."', '$credit', '2', '3'), ('".$q['user']."', '$id', '".time()."', '".($credit*$q['money'])."', '$credit', '2', '4');", $mysql);
if($credit == $q['credit']) mysql_query("DELETE FROM `birzha` WHERE `id` = '$buy';");
else mysql_query("UPDATE `birzha` SET `credit` = '".($q['credit']-$credit)."' WHERE `id` = '$buy';");
echo '<u>'.$lang['1289'].'</u><br/><br/>';
}
}
echo '<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=buy">'.$lang['1232'].'</a><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1122'].'</a>';
if($config->vers == 'wml') print '</small>';
}
mysql_close($mysql); $config->finish(true);
}
################################################################################
$config->start('buy', $lang['1232']);
if($config->vers == 'wml') print '<small>';
$q = mysql_query("SELECT COUNT(`id`) FROM `birzha`;", $mysql);
$q = mysql_fetch_array($q) or $q['0'] = 0;
$count = $q['0'];
if($count < 1) print '<u>'.$lang['1271'].'</u><br/><br/>';
else{
$page = intval($_GET['p']);
if($page < 1) $page = 1;
$limit = $page*10-10;
if($limit >= $count){ $limit = 0; $page = 1; }
$pages = round($count/10);
if($pages*10 < $count) $pages++;
$q = mysql_query("SELECT `id`, `user`, `credit`, `money` FROM `birzha` ORDER BY `money`, `credit` DESC LIMIT $limit, 10;", $mysql);
$num = 1;
while($d = mysql_fetch_array($q)){
if($d['user'] == $id) $d['user'] = '<b>'.$d['user'].'</b>';
echo '<b>'.($limit+$num).'.</b> '.
str_ireplace('%id%', $d['user'], str_ireplace('%credit%', $d['credit'], str_ireplace('%sum%', doubleval($d['money']), $lang['1283'])));
if($status > 2 && $d['user'] != '<b>'.$id.'</b>') echo ' [<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=buy&buy='.$d['id'].'">+</a>]';
if($status == 4 || $status == 7 || strpos($config->conf['badmin'], '|'.$id.'|') !== false || strpos($config->conf['admin'], '|'.$id.'|') !== false) echo ' [<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=buy&p='.$page.'&del='.$d['id'].'">x</a>]';
echo '<br/>';
$num++;
}
print '<br/>';
if($page > 1 || $page < $pages){
if($page > 1)
print '<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=buy&p='.($page-1).'"><--</a> ';
if($page < $pages)
print '<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=buy&p='.($page+1).'">--></a>';
print '<br/><br/>';
}
}
echo '<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1122'].'</a><br/>'.
'<a href="panel.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1009'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
/******************************************************************************/
if($act == 'sell'){
if(isset($_GET['sell'])) $sell = $_GET['sell'];
elseif(isset($_POST['sell'])) $sell = $_POST['sell'];
else $sell = false;
################################################################################
if($sell == 'my'){
if(isset($_GET['del'])){
$del = intval($_GET['del']);
$q = mysql_query("SELECT `credit` FROM `birzha` WHERE `id` = '$del' && `user` = '$id';", $mysql);
$q = mysql_fetch_array($q);
if($q){
if(mysql_query("DELETE FROM `birzha` WHERE `id` = '$del';", $mysql))
mysql_query("UPDATE `users` SET `bank` = `bank`+'".$q['credit']."' WHERE `id` = '$id';", $mysql);
}
}
$config->start('sell', $lang['1273']);
if($config->vers == 'wml') print '<small>';
$q = mysql_query("SELECT COUNT(`id`) FROM `birzha` WHERE `user` = '$id';", $mysql);
$q = mysql_fetch_array($q) or $q['0'] = 0;
$count = $q['0'];
if($count < 1) print '<u>'.$lang['1271'].'</u><br/><br/>';
else{
$page = intval($_GET['p']);
if($page < 1) $page = 1;
$limit = $page*10-10;
if($limit >= $count){ $limit = 0; $page = 1; }
$pages = round($count/10);
if($pages*10 < $count) $pages++;
$q = mysql_query("SELECT `id`, `credit`, `money` FROM `birzha` WHERE `user` = '$id' ORDER BY `id` DESC LIMIT $limit, 10;", $mysql);
$num = 1;
while($d = mysql_fetch_array($q)){
echo '<b>'.($limit+$num).'.</b> '.
str_ireplace('%credit%', $d['credit'], str_ireplace('%sum%', doubleval($d['money']), $lang['1275'])).
' [<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=sell&sell=my&p='.$page.'&del='.$d['id'].'">x</a>]<br/>';
$num++;
}
print '<br/>';
if($page > 1 || $page < $pages){
if($page > 1)
print '<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=sell&sell=my&p='.($page-1).'"><--</a> ';
if($page < $pages)
print '<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=sell&sell=my&p='.($page+1).'">--></a>';
print '<br/><br/>';
}
}
echo '<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1122'].'</a><br/>'.
'<a href="panel.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1009'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
################################################################################
if($sell == 'new' && $status > 2){
$config->start('new', $lang['1274']);
if(!isset($_POST['credit']))
{
if($config->vers == 'wml')
echo '<small>'.$lang['1276'].':</small><br/>'.
'<input type="text" name="credit" value="" maxlength="11" format="*N"/><br/>'.
'<small>'.$lang['1277'].':</small><br/>'.
'<input type="text" name="price" value="" maxlength="9"/><br/>'.
'<small><anchor>'.$lang['1028'].'<go href="birzha.php" method="post">'.
'<postfield name="l" value="'.$config->lang.'"/>'.
'<postfield name="v" value="wml"/>'.
'<postfield name="id" value="'.$id.'"/>'.
'<postfield name="ps" value="'.$ps.'"/>'.
'<postfield name="act" value="sell"/>'.
'<postfield name="sell" value="new"/>'.
'<postfield name="credit" value="$(credit)"/>'.
'<postfield name="price" value="$(price)"/>'.
'</go></anchor><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v=wml&id='.$id.'&ps='.$ps.'">'.$lang['1027'].'</a>'.
'</small>';
else
if($config->vers == 'html')
echo '<form action="birzha.php" method="post">'.
'<input type="hidden" name="l" value="'.$config->lang.'"/>'.
'<input type="hidden" name="v" value="html"/>'.
'<input type="hidden" name="id" value="'.$id.'"/>'.
'<input type="hidden" name="ps" value="'.$ps.'"/>'.
'<input type="hidden" name="act" value="sell"/>'.
'<input type="hidden" name="sell" value="new"/>'.
$lang['1276'].':<br/>'.
'<input type="text" name="credit" value="" maxlength="11"/><br/>'.
$lang['1277'].':<br/>'.
'<input type="text" name="price" value="" maxlength="9"/><br/>'.
'<input type="submit" value="'.$lang['1028'].'"/><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v=html&id='.$id.'&ps='.$ps.'">'.$lang['1027'].'</a>'.
'</form>';
}
else
{
$credit = intval($_POST['credit']);
$price = doubleval($_POST['price']);
if($price < 0.01){
if($config->vers == 'wml') print '<small>';
echo '<u>'.$lang['1279'].'</u><br/><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=sell&sell=new">'.$lang['1029'].'</a><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1122'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
if($price > 0.1){
if($config->vers == 'wml') print '<small>';
echo '<u>'.$lang['1280'].'</u><br/><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=sell&sell=new">'.$lang['1029'].'</a><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1122'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
$q = mysql_query("SELECT `bank` FROM `users` WHERE `id` = '$id';", $mysql);
$q = mysql_fetch_array($q) or $q['0'] = 0;
if($credit > $q['0'] || $q['0'] < 1){
if($config->vers == 'wml') print '<small>';
echo '<u>'.$lang['1278'].'</u><br/><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=sell&sell=new">'.$lang['1029'].'</a><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1122'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
if(!mysql_query("INSERT INTO `birzha` VALUES('0', '$id', '$credit', '$price');", $mysql)){
if($config->vers == 'wml') print '<small>';
echo '<u>'.$lang['1281'].'</u><br/><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=sell&sell=new">'.$lang['1029'].'</a><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1122'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
mysql_query("UPDATE `users` SET `bank` = `bank`-'$credit' WHERE `id` = '$id';", $mysql);
if($config->vers == 'wml') print '<small>';
echo '<u>'.$lang['1282'].'</u><br/><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1122'].'</a><br/>'.
'<a href="panel.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1009'].'</a>';
if($config->vers == 'wml') print '</small>';
}
mysql_close($mysql); $config->finish(true);
}
################################################################################
$config->start('sell', $lang['1233']);
if($config->vers == 'wml') print '<small>';
echo '<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=sell&sell=my">'.$lang['1273'].'</a><br/>';
if($status > 2) echo '<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=sell&sell=new">'.$lang['1274'].'</a><br/>';
echo '<br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1122'].'</a><br/>'.
'<a href="panel.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1009'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
/******************************************************************************/
if($act == 'in'){
$config->start('in', $lang['1234']);
if(!isset($_POST['sum']))
{
if($config->vers == 'wml'){
echo '<small>'.$lang['1240'].':</small><br/>'.
'<input type="text" name="sum" value="" maxlength="5" format="*N"/><br/>';
if(strpos($config->conf['badmin'], '|'.$id.'|') !== false || strpos($config->conf['admin'], '|'.$id.'|') !== false)
echo '<small>'.$lang['1241'].':</small><br/>'.
'<input type="text" name="user" value="" maxlength="11" format="*N"/><br/>';
echo '<small><anchor>'.$lang['1028'].'<go href="birzha.php" method="post">'.
'<postfield name="l" value="'.$config->lang.'"/>'.
'<postfield name="v" value="wml"/>'.
'<postfield name="id" value="'.$id.'"/>'.
'<postfield name="ps" value="'.$ps.'"/>'.
'<postfield name="act" value="in"/>'.
'<postfield name="sum" value="$(sum)"/>';
if(strpos($config->conf['badmin'], '|'.$id.'|') !== false || strpos($config->conf['admin'], '|'.$id.'|') !== false)
echo '<postfield name="user" value="$(user)"/>';
echo '</go></anchor><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v=wml&id='.$id.'&ps='.$ps.'">'.$lang['1027'].'</a>'.
'</small>';
}
else
if($config->vers == 'html'){
echo '<form action="birzha.php" method="post">'.
'<input type="hidden" name="l" value="'.$config->lang.'"/>'.
'<input type="hidden" name="v" value="html"/>'.
'<input type="hidden" name="id" value="'.$id.'"/>'.
'<input type="hidden" name="ps" value="'.$ps.'"/>'.
'<input type="hidden" name="act" value="in"/>'.
$lang['1240'].':<br/>'.
'<input type="text" name="sum" value="" maxlength="5"/><br/>';
if(strpos($config->conf['badmin'], '|'.$id.'|') !== false || strpos($config->conf['admin'], '|'.$id.'|') !== false)
echo $lang['1241'].':<br/>'.
'<input type="text" name="user" value="" maxlength="11"/><br/>';
echo '<input type="submit" value="'.$lang['1028'].'"/><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v=html&id='.$id.'&ps='.$ps.'">'.$lang['1027'].'</a>'.
'</form>';
}
}
else
{
$sum = intval($_POST['sum']);
if($sum < 10 || $sum > 99999){
if($config->vers == 'wml') print '<small>';
echo '<u>'.$lang['1242'].'</u><br/><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=in">'.$lang['1029'].'</a><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1122'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
if(strpos($config->conf['badmin'], '|'.$id.'|') === false && strpos($config->conf['admin'], '|'.$id.'|') === false){
mysql_query("INSERT INTO `money` VALUES('0', '$id', '0', '$sum', '1', '".time()."');", $mysql);
if($config->vers == 'wml') print '<small>';
echo str_ireplace('%id%', $id, str_ireplace('%sum%', $sum, preg_replace('/%sum/(d+)%/ie', '$sum/1', $lang['1243']))).'<br/><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1122'].'</a><br/>'.
'<a href="panel.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1009'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
$user = intval($_POST['user']);
if($config->vers == 'wml') print '<small>';
if(mysql_query("UPDATE `users` SET `money` = `money`+'$sum' WHERE `id` = '$user';", $mysql)){
mysql_query("INSERT INTO `history` VALUES('$user', '$id', '".time()."', '$sum', '0', '2', '1');", $mysql);
echo str_ireplace('%sum%', $sum, str_ireplace('%user%', $user, $lang['1245']));
}
else echo str_ireplace('%sum%', $sum, str_ireplace('%user%', $user, $lang['1244']));
echo '<br/><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1122'].'</a><br/>'.
'<a href="panel.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1009'].'</a>';
if($config->vers == 'wml') print '</small>';
}
mysql_close($mysql); $config->finish(true);
}
/******************************************************************************/
if($act == 'out'){
$config->start('out', $lang['1235']);
if(!isset($_POST['sum']))
{
if($config->vers == 'wml'){
echo '<small>'.$lang['1240'].':</small><br/>'.
'<input type="text" name="sum" value="" maxlength="5" format="*N"/><br/>';
if(strpos($config->conf['badmin'], '|'.$id.'|') !== false || strpos($config->conf['admin'], '|'.$id.'|') !== false)
echo '<small>'.$lang['1246'].':</small><br/>'.
'<input type="text" name="user" value="" maxlength="11" format="*N"/><br/>';
else
echo '<small>'.$lang['1249'].':</small><br/>'.
'<input type="text" name="wmr" value="R" maxlength="13"/><br/>';
echo '<small><anchor>'.$lang['1028'].'<go href="birzha.php" method="post">'.
'<postfield name="l" value="'.$config->lang.'"/>'.
'<postfield name="v" value="wml"/>'.
'<postfield name="id" value="'.$id.'"/>'.
'<postfield name="ps" value="'.$ps.'"/>'.
'<postfield name="act" value="out"/>'.
'<postfield name="sum" value="$(sum)"/>';
if(strpos($config->conf['badmin'], '|'.$id.'|') !== false || strpos($config->conf['admin'], '|'.$id.'|') !== false)
echo '<postfield name="user" value="$(user)"/>';
else
echo '<postfield name="wmr" value="$(wmr)"/>';
echo '</go></anchor><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v=wml&id='.$id.'&ps='.$ps.'">'.$lang['1027'].'</a>'.
'</small>';
}
else
if($config->vers == 'html'){
echo '<form action="birzha.php" method="post">'.
'<input type="hidden" name="l" value="'.$config->lang.'"/>'.
'<input type="hidden" name="v" value="html"/>'.
'<input type="hidden" name="id" value="'.$id.'"/>'.
'<input type="hidden" name="ps" value="'.$ps.'"/>'.
'<input type="hidden" name="act" value="out"/>'.
$lang['1240'].':<br/>'.
'<input type="text" name="sum" value="" maxlength="5"/><br/>';
if(strpos($config->conf['badmin'], '|'.$id.'|') !== false || strpos($config->conf['admin'], '|'.$id.'|') !== false)
echo $lang['1246'].':<br/>'.
'<input type="text" name="user" value="" maxlength="11"/><br/>';
else
echo $lang['1249'].'<br/>'.
'<input type="text" name="wmr" value="R" maxlength="13"/><br/>';
echo '<input type="submit" value="'.$lang['1028'].'"/><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v=html&id='.$id.'&ps='.$ps.'">'.$lang['1027'].'</a>'.
'</form>';
}
}
else
{
$sum = intval($_POST['sum']);
if($sum < 10 || $sum > 99999){
if($config->vers == 'wml') print '<small>';
echo '<u>'.$lang['1242'].'</u><br/><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=out">'.$lang['1029'].'</a><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1122'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
if(strpos($config->conf['badmin'], '|'.$id.'|') === false && strpos($config->conf['admin'], '|'.$id.'|') === false){
$wmr = trim($_POST['wmr']);
if(!preg_match('/^rd{12}$/i', $wmr)){
if($config->vers == 'wml') print '<small>';
echo '<u>'.$lang['1250'].'</u><br/><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=out">'.$lang['1029'].'</a><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1122'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
$q = mysql_query("SELECT `money` FROM `users` WHERE `id` = '$id';", $mysql);
$q = mysql_fetch_array($q) or $q['money'] = 0;
if($sum > $q['money']){
if($config->vers == 'wml') print '<small>';
echo '<u>'.$lang['1251'].'</u><br/><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1122'].'</a><br/>'.
'<a href="panel.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1009'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
if($config->vers == 'wml') print '<small>';
if(mysql_query("UPDATE `users` SET `money` = `money`-'$sum' WHERE `id` = '$id';", $mysql)){
mysql_query("INSERT INTO `history` VALUES('$id', '$id', '".time()."', '$sum', '0', '2', '2');", $mysql);
mysql_query("INSERT INTO `money` VALUES('0', '$id', '$wmr', '$sum', '2', '".time()."');", $mysql);
echo '<u>'.$lang['1268'].'</u><br/><br/>';
}
else echo '<u>'.$lang['1269'].'</u><br/><br/>';
echo '<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1122'].'</a><br/>'.
'<a href="panel.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1009'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
$user = intval($_POST['user']);
if($config->vers == 'wml') print '<small>';
if(mysql_query("UPDATE `users` SET `money` = `money`-'$sum' WHERE `id` = '$user';", $mysql)){
mysql_query("INSERT INTO `history` VALUES('$user', '$id', '".time()."', '$sum', '0', '2', '2');", $mysql);
echo str_ireplace('%sum%', $sum, str_ireplace('%user%', $user, $lang['1248']));
}
else echo str_ireplace('%sum%', $sum, str_ireplace('%user%', $user, $lang['1247']));
echo '<br/><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1122'].'</a><br/>'.
'<a href="panel.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1009'].'</a>';
if($config->vers == 'wml') print '</small>';
}
mysql_close($mysql); $config->finish(true);
}
/******************************************************************************/
if(($act == 'inm') && (strpos($config->conf['badmin'], '|'.$id.'|') !== false || strpos($config->conf['admin'], '|'.$id.'|') !== false)){
if(isset($_GET['del'])){
$del = intval($_GET['del']);
mysql_query("DELETE FROM `money` WHERE `id` = '$del' && `status` = '1';", $mysql);
}
$config->start('inm', $lang['1234']);
if($config->vers == 'wml') print '<small>';
$q = mysql_query("SELECT COUNT(*) FROM `money` WHERE `status` = '1';", $mysql);
$q = mysql_fetch_array($q) or $q['0'] = 0;
$count = $q['0'];
if($count < 1) print '<u>'.$lang['1270'].'</u><br/><br/>';
else{
$page = intval($_GET['p']);
if($page < 1) $page = 1;
$limit = $page*10-10;
if($limit >= $count){ $limit = 0; $page = 1; }
$pages = round($count/10);
if($pages*10 < $count) $pages++;
$q = mysql_query("SELECT `id`, `user`, `money`, `time` FROM `money` WHERE `status` = '1' ORDER BY `time` DESC LIMIT $limit, 10;", $mysql);
$num = 1;
while($d = mysql_fetch_array($q)){
echo '<b>'.($limit+$num).'.</b> <u>['.date('d.m H:i', $d['time']).']</u> '.
doubleval($d['money']).' WMR / ID='.$d['user'].' '.
'[<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=inm&p='.$page.'&del='.$d['id'].'">x</a>]<br/>';
$num++;
}
print '<br/>';
if($page > 1 || $page < $pages){
if($page > 1)
print '<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=inm&p='.($page-1).'"><--</a> ';
if($page < $pages)
print '<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=inm&p='.($page+1).'">--></a>';
print '<br/><br/>';
}
}
echo '<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1122'].'</a><br/>'.
'<a href="panel.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1009'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
/******************************************************************************/
if(($act == 'outm') && (strpos($config->conf['badmin'], '|'.$id.'|') !== false || strpos($config->conf['admin'], '|'.$id.'|') !== false)){
if(isset($_GET['del'])){
$del = intval($_GET['del']);
mysql_query("DELETE FROM `money` WHERE `id` = '$del' && `status` = '2';", $mysql);
}
$config->start('inm', $lang['1235']);
if($config->vers == 'wml') print '<small>';
$q = mysql_query("SELECT COUNT(*) FROM `money` WHERE `status` = '2';", $mysql);
$q = mysql_fetch_array($q) or $q['0'] = 0;
$count = $q['0'];
if($count < 1) print '<u>'.$lang['1270'].'</u><br/><br/>';
else{
$page = intval($_GET['p']);
if($page < 1) $page = 1;
$limit = $page*10-10;
if($limit >= $count){ $limit = 0; $page = 1; }
$pages = round($count/10);
if($pages*10 < $count) $pages++;
$q = mysql_query("SELECT `id`, `user`, `wmr`, `money`, `time` FROM `money` WHERE `status` = '2' ORDER BY `time` DESC LIMIT $limit, 10;", $mysql);
$num = 1;
while($d = mysql_fetch_array($q)){
echo '<b>'.($limit+$num).'.</b> <u>['.date('d.m H:i', $d['time']).']</u> '.
doubleval($d['money']).' WMR ('.$d['wmr'].') / ID='.$d['user'].' '.
'[<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=outm&p='.$page.'&del='.$d['id'].'">x</a>]<br/>';
$num++;
}
print '<br/>';
if($page > 1 || $page < $pages){
if($page > 1)
print '<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=outm&p='.($page-1).'"><--</a> ';
if($page < $pages)
print '<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=outm&p='.($page+1).'">--></a>';
print '<br/><br/>';
}
}
echo '<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1122'].'</a><br/>'.
'<a href="panel.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1009'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
/******************************************************************************/
if($act == 'rules'){
$config->start('rules', $lang['1238']);
if($config->vers == 'wml') print '<small>';
echo $lang['1239'].
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1122'].'</a><br/>'.
'<a href="panel.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1009'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
/******************************************************************************/
if($act == 'history'){
$config->start('history', $lang['1236']);
if($config->vers == 'wml') print '<small>';
$q = mysql_query("SELECT COUNT(*) FROM `history` WHERE `id` = '$id' && `status` = '2';", $mysql);
$q = mysql_fetch_array($q) or $q['0'] = 0;
$count = $q['0'];
if($count < 1) print '<u>'.$lang['1263'].'</u><br/><br/>';
else{
$page = intval($_GET['p']);
if($page < 1) $page = 1;
$limit = $page*10-10;
if($limit >= $count){ $limit = 0; $page = 1; }
$pages = round($count/10);
if($pages*10 < $count) $pages++;
$q = mysql_query("SELECT `ud`, `time`, `money`, `credit`, `action` FROM `history` WHERE `id` = '$id' && `status` = '2' ORDER BY `time` DESC LIMIT $limit, 10;", $mysql);
$num = 1;
while($d = mysql_fetch_array($q)){
echo '<b>'.($limit+$num).'.</b> <u>['.date('d.m H:i', $d['time']).']</u> ';
if($d['action'] == 1)
echo str_ireplace('%sum%', doubleval($d['money']), $lang['1266']);
elseif($d['action'] == 2)
echo str_ireplace('%sum%', doubleval($d['money']), $lang['1267']);
elseif($d['action'] == 3)
echo str_ireplace('%credit%', $d['credit'], str_ireplace('%sum%', doubleval($d['money']), str_ireplace('%id%', $d['ud'], $lang['1264'])));
elseif($d['action'] == 4)
echo str_ireplace('%credit%', $d['credit'], str_ireplace('%sum%', doubleval($d['money']), str_ireplace('%id%', $d['ud'], $lang['1265'])));
echo '<br/>';
$num++;
}
print '<br/>';
if($page > 1 || $page < $pages){
if($page > 1)
print '<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=history&p='.($page-1).'"><--</a> ';
if($page < $pages)
print '<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=history&p='.($page+1).'">--></a>';
print '<br/><br/>';
}
}
echo '<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1122'].'</a><br/>'.
'<a href="panel.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1009'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
/******************************************************************************/
if($act == 'online' && $config->conf['online']['birzha'] == 'on'){
$config->start('online', $lang['1354']);
if($config->vers == 'wml') print '<small>';
$q = mysql_query("SELECT COUNT(*) as `count` FROM `users` WHERE `online_b` > '".(time()-600)."';", $mysql);
$q = mysql_fetch_array($q) or $q['count'] = 0;
$count = $q['count'];
if($count <= 0) echo '<u>'.$lang['1355'].'</u><br/><br/>';
else
{
$page = intval($_GET['p']);
if($page < 1) $page = 1;
$limit = $page*10-10;
if($limit >= $count){ $limit = 0; $page = 1; }
$pages = round($count/10);
if($pages*10 < $count) $pages++;
$c = $limit+1;
$q = mysql_query("SELECT `id`, `nick`, `online_b` FROM `users` WHERE `online_b` > '".(time()-600)."' ORDER BY `online_b` DESC LIMIT $limit, 10;", $mysql);
while($d = mysql_fetch_array($q)){
echo '<b>'.$c.'.</b> <u>';
if($config->conf['nick'] == 'on')
{
if(strlen($d['nick']) > 0)
{
$d['nick'] = htmlspecialchars($d['nick']);
$d['nick'] = str_replace('$', '$$', $d['nick']);
echo $d['nick'].'; ';
}
}
echo 'ID='.$d['id'].'</u> ['.date("H:i:s", $d['online_b']).']<br/>';
$c++;
}
echo '<br/>';
if($page > 1 || $page < $pages)
{
if($page > 1){
if($page-1 != 1)
echo '<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=online&p=1"><<</a> ';
echo '<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=online&p='.($page-1).'"><-</a> ';
}
if($page < $pages){
echo '<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=online&p='.($page+1).'">-></a> ';
if($page+1 != $pages)
echo '<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=online&p='.$pages.'">>></a> ';
}
echo '<br/><br/>';
}
}
echo '<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1122'].'</a><br/>'.
'<a href="panel.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1009'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
/******************************************************************************/
$config->start('birzha', $lang['1122']);
if($config->vers == 'wml') print '<small>';
$q = mysql_query("SELECT `bank`, `money` FROM `users` WHERE `id` = '$id';", $mysql);
$q = mysql_fetch_array($q) or $q = array('bank' => '0', 'money' => '0');
echo $lang['1230'].': <b>'.$q['bank'].'</b><br/>'.
$lang['1231'].': <b>'.doubleval($q['money']).'</b> WMR<br/><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=buy">'.$lang['1232'].'</a><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=sell">'.$lang['1233'].'</a><br/><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=in">'.$lang['1234'].'</a>';
if(strpos($config->conf['badmin'], '|'.$id.'|') !== false || strpos($config->conf['admin'], '|'.$id.'|') !== false){
$q = mysql_query("SELECT COUNT(*) FROM `money` WHERE `status` = '1';", $mysql);
$q = mysql_fetch_array($q) or $q['0'] = 0;
if($q['0'] > 0) echo ' [<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=inm">'.$q['0'].'</a>]';
else echo ' ['.$q['0'].']';
}
echo '<br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=out">'.$lang['1235'].'</a>';
if(strpos($config->conf['badmin'], '|'.$id.'|') !== false || strpos($config->conf['admin'], '|'.$id.'|') !== false){
$q = mysql_query("SELECT COUNT(*) FROM `money` WHERE `status` = '2';", $mysql);
$q = mysql_fetch_array($q) or $q['0'] = 0;
if($q['0'] > 0) echo ' [<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=outm">'.$q['0'].'</a>]';
else echo ' ['.$q['0'].']';
}
echo '<br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=rules">'.$lang['1238'].'</a><br/>'.
'<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=history">'.$lang['1236'].'</a><br/><br/>';
if($config->conf['online']['birzha'] == 'on')
{
$q = mysql_query("SELECT COUNT(*) as `count` FROM `users` WHERE `online_b` > '".(time()-600)."';", $mysql);
$q = mysql_fetch_array($q) or $q['count'] = 0;
echo $lang['1353'].': ';
if($q['count'] <= 0) echo '0';
else echo '<a href="birzha.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&act=online">'.$q['count'].'</a>';
echo '<br/><br/>';
}
echo '<a href="panel.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1009'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish();
?>