diff --git a/AI.php b/AI.php index 0fa85209..9916b50b 100644 --- a/AI.php +++ b/AI.php @@ -141,14 +141,9 @@ if (isset($_GET['test'])) { die(); } -function getIP() -{ - return isset($_SERVER['HTTP_X_REAL_IP']) ? $_SERVER['HTTP_X_REAL_IP'] : $_SERVER['REMOTE_ADDR']; -} - -if (!isset($_GET['robot']) && getIP() != $_SERVER['SERVER_ADDR'] && getIP() != '127.0.0.1' && getIP() != '' && getIP( - ) != '31.131.116.166' && !isset($_GET['test'])) { - die(getIP() . '' . $_SERVER['SERVER_ADDR']); +if (!isset($_GET['robot']) && UserIp::get() != $_SERVER['SERVER_ADDR'] && UserIp::get() != '127.0.0.1' && UserIp::get( + ) != '' && UserIp::get() != '31.131.116.166') { + die(UserIp::get() . '' . $_SERVER['SERVER_ADDR']); } diff --git a/aunitpay.php b/aunitpay.php index 8aadfcbd..aab24e57 100644 --- a/aunitpay.php +++ b/aunitpay.php @@ -1,196 +1,168 @@ - array( - 'message' => $message - ) - ) - ); - } - - function getResponseSuccess($message) - { - return json_encode( - array( - 'result' => array( - 'message' => $message - ) - ) - ); - } -date_default_timezone_set('Europe/Moscow'); - $c = array( - /* MySQL База данных */ - 'db_name' => 'pay_operations', //Таблица в которую заносятся данные - 'db_host' => 'localhost', - 'db_user' => 'newcom1_abk', - 'db_pass' => '4nWYsIM[c?}P', - 'db_base' => 'newcom1_abk', - /* Настройки платежей - 'ip_list' => array('127,0,0,1,188.166.34.68,136.243.38.147,136.243.38.149,136.243.38.150,136.243.38.151,136.243.38.189,88.198.88.98'), //Указывать через запятую (Разрешенные IP) - 'key' => 'qtzl0igb', //gamedealer key - 'id' => '65643' //ID проекта*/ + return json_encode( + [ + 'error' => [ + 'message' => $message, + ], + ] ); - - - function connect_db($c) { - $db = mysql_connect($c['db_host'],$c['db_user'],$c['db_pass']) or die('Ошибка подключения к MySQL серверу!'); - mysql_select_db($c['db_base'],$db) or die('Ошибка подключения к базе данных!'); - mysql_query('SET NAMES cp1251'); - } - - function getFormSignature($account, $currency, $sum, $secretKey) - { - $hashStr = $account.'{up}'.$currency.'{up}'.$sum.'{up}'.$secretKey; - return hash('sha256', $hashStr); - } - - - - - - $request=$_GET; - if (empty($request['method']) - || empty($request['params']) - || !is_array($request['params']) - ) - { - echo getResponseError('Invalid request'); - die(); - } - $method = $request['method']; - $params = $request['params']; - if ($_GET['method']=="check") - { - - echo getResponseSuccess('CHECK is successful'); - die(); - //echo "Запрос успешно обработан".$pays['account']; - //echo getFormSignature($_GET['params[account]'],"RUB",$_GET['params[payerSum]'],"392bb04608af9aa823a277173c83f633");; - } - //MERCHANT_ORDER_ID=142&P_PHONE=380688028300&P_EMAIL=evhenii_kula%40mail.ru&CUR_ID=94&AMOUNT=90&MERCHANT_ID=65643&SIGN=c0fc70d5446614597d44ff13f2c7a6a5&intid=29728441 - /* - MERCHANT_ORDER_ID - P_PHONE - P_EMAIL - CUR_ID - AMOUNT - MERCHANT_ID - SIGN - intid - - https://адрес_вашего_обработчика? - method=check - params[account]=userId - params[date]=2012-10-01 12:32:00 - params[operator]=beeline - params[paymentType]=mc - params[projectId]=1 - params[phone]=9XXXXXXXXX - params[payerSum]=10.00 - params[payerCurrency]=RUB - params[signature]=9bdf52a4830779a1383ac24f1b3ed054 - params[orderSum]=10.00 - params[orderCurrency]=RUB - params[unitpayId]=1234567 - params[test]=0 - */ -if ($_GET['method']=="pay") - { - connect_db($c); - $nick = mysql_fetch_array(mysql_query('SELECT * FROM `pay_operation` WHERE `id` = "'.$params['account'].'" LIMIT 1')); - if (!isset($nick['good'])) - { - echo getResponseError('Bad order'); - die(); - } - $user = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$nick['uid'].'" LIMIT 1')); - if (isset ($params['account'])) - { - if ($nick['good']!=0) - { - echo getResponseError('Already Used'); - die(); - } - else - { - - mysql_query('UPDATE `users` SET `money2` = `money2` + '.$nick['ekr'].' WHERE `id` = "'.$nick['uid'].'" LIMIT 1'); - mysql_query('UPDATE `pay_operation` SET `good` = "'.time().'" WHERE `id` = "'.$params['account'].'" LIMIT 1'); - mysql_query('UPDATE `users` SET `catch` = `catch` + '.$nick['ekr'].' WHERE `id` = "'.$nick['uid'].'" LIMIT 1'); - - //mysql_query('INSERT INTO `'.$c['db_name'].'` (`time`,`type`,`ip`,`value`,`money`,`project`) VALUES ("'.time().'","'.mysql_real_escape_string($type).'","'.$_SERVER['HTTP_X_REAL_IP'].'","'.mysql_real_escape_string($value).'","'.mysql_real_escape_string($money).'","'.mysql_real_escape_string($this->id).'")'); - - $r = ''.date('d.m.Y H:i').' Алхимик Администратор / Автоматическая оплата сообщает: '; - if($user['sex'] == 1) - { - $r .= 'Уважаемая'; - } - else - { - $r .= 'Уважаемый'; - } - $r .= ' '.$user['login'].', на Ваш игровой счет зачислено '.$nick['ekr'].' Еврокредитов. Благодарим Вас за покупку!'; - //$str1 = iconv("cp1251","UTF-8",$r); - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','".$user['city']."','".$user['room']."','','".$user['login']."','".$r."','-1','5','0')"); - //echo $r."r"; - - - if ($nick['ref'] !=0) - { - $refecr=round(($nick['ekr']/10)); - mysql_query('UPDATE `users` SET `money2` = `money2` + '.$refecr.' WHERE `id` = "'.$nick['ref'].'" LIMIT 1'); - $referal = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$nick['ref'].'" LIMIT 1')); - $r = ''.date('d.m.Y H:i').' Алхимик Администратор / Реферальный заработок сообщает: '; - if($referal['sex'] == 1) - { - $r .= 'Уважаемая'; - } - else - { - $r .= 'Уважаемый'; - } - $r .= ' '.$referal['login'].', на Ваш игровой счет зачислено '.$refecr.' Еврокредитов. Благодоря вашему рефералу!'.$user['login'].''; - //$str1 = iconv("cp1251","UTF-8",$r); - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','".$referal['city']."','".$referal['room']."','','".$referal['login']."','".$r."','-1','5','0')"); - - - } - - //echo "Покупател: ".$user['login']." | ID: ".$nick['uid']." | Сумма: ".$nick['ekr']." | ID операции: ".$params['account'].""; - if (isset ($referal['id'])) - { - //echo "Реферал(тот кто привел): ".$referal['login']." | ID: ".$referal['id']." | Сумма: ".$refecr.""; - } - else - { - //echo "Пользователь реферал не найден!!"; - } - - echo getResponseSuccess('PAY is successful'); - die(); - } - - } - else - { - echo getResponseError('No order'); - die(); - } } -?> + +function getResponseSuccess($message) +{ + return json_encode( + [ + 'result' => [ + 'message' => $message, + ], + ] + ); +} + +date_default_timezone_set('Europe/Moscow'); +$c = [ + /* MySQL База данных */ + 'db_name' => 'pay_operations', //Таблица в которую заносятся данные + 'db_host' => 'localhost', + 'db_user' => 'newcom1_abk', + 'db_pass' => '4nWYsIM[c?}P', + 'db_base' => 'newcom1_abk', + /* Настройки платежей + 'ip_list' => array('127,0,0,1,188.166.34.68,136.243.38.147,136.243.38.149,136.243.38.150,136.243.38.151,136.243.38.189,88.198.88.98'), //Указывать через запятую (Разрешенные IP) + 'key' => 'qtzl0igb', //gamedealer key + 'id' => '65643' //ID проекта*/ +]; + + +function connect_db($c) +{ + $db = mysql_connect($c['db_host'], $c['db_user'], $c['db_pass']) or die('Ошибка подключения к MySQL серверу!'); + mysql_select_db($c['db_base'], $db) or die('Ошибка подключения к базе данных!'); + mysql_query('SET NAMES cp1251'); +} + +function getFormSignature($account, $currency, $sum, $secretKey) +{ + $hashStr = $account . '{up}' . $currency . '{up}' . $sum . '{up}' . $secretKey; + return hash('sha256', $hashStr); +} + + +$request = $_GET; +if (empty($request['method']) + || empty($request['params']) + || !is_array($request['params']) +) { + echo getResponseError('Invalid request'); + die(); +} +$method = $request['method']; +$params = $request['params']; +if ($_GET['method'] == "check") { + + echo getResponseSuccess('CHECK is successful'); + die(); + +} +//MERCHANT_ORDER_ID=142&P_PHONE=380688028300&P_EMAIL=evhenii_kula%40mail.ru&CUR_ID=94&AMOUNT=90&MERCHANT_ID=65643&SIGN=c0fc70d5446614597d44ff13f2c7a6a5&intid=29728441 +/* +MERCHANT_ORDER_ID +P_PHONE +P_EMAIL +CUR_ID +AMOUNT +MERCHANT_ID +SIGN +intid + +https://адрес_вашего_обработчика? + method=check + params[account]=userId + params[date]=2012-10-01 12:32:00 + params[operator]=beeline + params[paymentType]=mc + params[projectId]=1 + params[phone]=9XXXXXXXXX + params[payerSum]=10.00 + params[payerCurrency]=RUB + params[signature]=9bdf52a4830779a1383ac24f1b3ed054 + params[orderSum]=10.00 + params[orderCurrency]=RUB + params[unitpayId]=1234567 + params[test]=0 +*/ +if ($_GET['method'] == "pay") { + connect_db($c); + $nick = mysql_fetch_array( + mysql_query('SELECT * FROM `pay_operation` WHERE `id` = "' . $params['account'] . '" LIMIT 1') + ); + if (!isset($nick['good'])) { + echo getResponseError('Bad order'); + die(); + } + $user = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $nick['uid'] . '" LIMIT 1')); + if (isset ($params['account'])) { + if ($nick['good'] != 0) { + echo getResponseError('Already Used'); + die(); + } else { + + mysql_query( + 'UPDATE `users` SET `money2` = `money2` + ' . $nick['ekr'] . ' WHERE `id` = "' . $nick['uid'] . '" LIMIT 1' + ); + mysql_query( + 'UPDATE `pay_operation` SET `good` = "' . time() . '" WHERE `id` = "' . $params['account'] . '" LIMIT 1' + ); + mysql_query( + 'UPDATE `users` SET `catch` = `catch` + ' . $nick['ekr'] . ' WHERE `id` = "' . $nick['uid'] . '" LIMIT 1' + ); + + $r = '' . date( + 'd.m.Y H:i' + ) . ' Алхимик Администратор / Автоматическая оплата сообщает: '; + if ($user['sex'] == 1) { + $r .= 'Уважаемая'; + } else { + $r .= 'Уважаемый'; + } + $r .= ' ' . $user['login'] . ', на Ваш игровой счет зачислено ' . $nick['ekr'] . ' Еврокредитов. Благодарим Вас за покупку!'; + + mysql_query( + "INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $user['city'] . "','" . $user['room'] . "','','" . $user['login'] . "','" . $r . "','-1','5','0')" + ); + + if ($nick['ref'] != 0) { + $refecr = round(($nick['ekr'] / 10)); + mysql_query( + 'UPDATE `users` SET `money2` = `money2` + ' . $refecr . ' WHERE `id` = "' . $nick['ref'] . '" LIMIT 1' + ); + $referal = mysql_fetch_array( + mysql_query('SELECT * FROM `users` WHERE `id` = "' . $nick['ref'] . '" LIMIT 1') + ); + $r = '' . date( + 'd.m.Y H:i' + ) . ' Алхимик Администратор / Реферальный заработок сообщает: '; + if ($referal['sex'] == 1) { + $r .= 'Уважаемая'; + } else { + $r .= 'Уважаемый'; + } + $r .= ' ' . $referal['login'] . ', на Ваш игровой счет зачислено ' . $refecr . ' Еврокредитов. Благодоря вашему рефералу!' . $user['login'] . ''; + //$str1 = iconv("cp1251","UTF-8",$r); + mysql_query( + "INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $referal['city'] . "','" . $referal['room'] . "','','" . $referal['login'] . "','" . $r . "','-1','5','0')" + ); + } + + echo getResponseSuccess('PAY is successful'); + die(); + } + + } else { + echo getResponseError('No order'); + die(); + } +} diff --git a/cron_GAMECORE.php b/cron_GAMECORE.php index efc5239f..94e776be 100644 --- a/cron_GAMECORE.php +++ b/cron_GAMECORE.php @@ -6,82 +6,61 @@ */ - - -//if( $_SERVER['HTTP_CF_CONNECTING_IP'] != $_SERVER['SERVER_ADDR'] && $_SERVER['HTTP_CF_CONNECTING_IP'] != '127.0.0.1' ) { die('Hello pussy!'); } - -function getIP() { - if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP']; - return $_SERVER['REMOTE_ADDR']; -} - -if(getIP() != $_SERVER['SERVER_ADDR'] && getIP() != '127.0.0.1' && getIP() != '' && getIP() != '5.187.7.71') { - if(!isset($_GET['test'])) { - die(getIP().''.$_SERVER['SERVER_ADDR']); - } -} - - -define('GAME',true); - +const GAME = true; require_once('_incl_data/__config.php'); require_once('_incl_data/class/__db_connect.php'); -function e($t) { - mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #'.date('d.m.Y').' %'.date('H:i:s').' (Критическая ошибка): '.mysql_real_escape_string($t).'","capitalcity","LEL","6","1","-1")'); +if (UserIp::get() != $_SERVER['SERVER_ADDR'] && UserIp::get() != '127.0.0.1' && UserIp::get() != '' && UserIp::get( + ) != '5.187.7.71' && !isset($_GET['test'])) { + die(UserIp::get() . '' . $_SERVER['SERVER_ADDR']); } -$count = array( - 0, //завершенных поединков - 0, - 0, - 0, - 0, - 0 -); -function clear_user($plid) { - mysql_query('UPDATE `users` SET `login` = "delete",`login2` = `login` WHERE `id` = "'.$plid.'" LIMIT 1'); - /* mysql_query('DELETE FROM `users` WHERE `id` = "'.$plid.'" LIMIT 1'); - mysql_query('DELETE FROM `items_users` WHERE `uid` = "'.$plid.'"'); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "'.$plid.'"'); - mysql_query('DELETE FROM `bank` WHERE `uid` = "'.$plid.'"');*/ +function e($t) +{ + mysql_query( + 'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #' . date('d.m.Y') . ' %' . date( + 'H:i:s' + ) . ' (Критическая ошибка): ' . mysql_real_escape_string($t) . '","capitalcity","LEL","6","1","-1")' + ); } -/*$sp = mysql_query('SELECT `id` FROM `users` WHERE `cityreg` = "" && `timereg` = "0" LIMIT 100'); -while($pl = mysql_fetch_array($sp)) { - $n_st = mysql_fetch_array(mysql_query('SELECT `id` FROM `stats` WHERE `id` = "'.$pl['id'].'" LIMIT 1')); - if(!isset($n_st['id'])) { - clear_user($pl['id']); - } -}*/ +$count = [ + 0, //завершенных поединков + 0, + 0, + 0, + 0, + 0, +]; -function inuser_go_btl($id) { - if(isset($id['id'])) { - echo file_get_contents('https://new-combats.com/jx/battle/refresh.php?uid='.$id['id'].'&cron_core='.md5($id['id'].'_brfCOreW@!_'.$id['pass']).'&pass='.$id['pass']); - echo '
@@ -549,7 +554,9 @@ if ($_SERVER['HTTP_USER_AGENT'] != '' && } ?>
@@ -563,7 +570,9 @@ if ($_SERVER['HTTP_USER_AGENT'] != '' && цифры для надёжности.
@@ -592,7 +601,9 @@ if ($_SERVER['HTTP_USER_AGENT'] != '' && } ?>
@@ -676,7 +687,8 @@ if ($_SERVER['HTTP_USER_AGENT'] != '' &&
Критоуворот +
Критоуворот
" . $mail->getMessage() . "
Message successfully sent!
Имя вашего персонажа (login):
+
Топорщик
Уворотчик +
Танк
Критовик +
Маг + Воздуха
Маг Огня +
Маг Земли +
Маг Воды +