public function __construct($host, $username, $password, $db, $port = 3306) { $i = 0; do { $this->_mysqli = new mysqli($host, $username, $password, $db); if (mysqli_connect_error()) { if (in_array(mysqli_connect_errno(), array(2002, 1049))) { sleep(1); } else { trigger_error('Error connecting to MySQL : ' . mysqli_connect_errno() . ' ' . mysqli_connect_error(), E_USER_ERROR); $i = 31; } } $i++; } while (in_array(mysqli_connect_errno(), array(2002, 1049)) && $i < 30); self::$_instance = $this; }
<?php if (!$argv) { die('browser'); } define('DC', true); define('ABSPATH', dirname(dirname(__FILE__)) . '/'); set_time_limit(0); require_once ABSPATH . 'db_config.php'; require_once ABSPATH . 'includes/autoload.php'; require_once ABSPATH . 'includes/errors.php'; $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); // гео-декодирование $res = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT `id`,\n\t\t\t\t\t `latitude`,\n\t\t\t\t\t `longitude`\n\t\tFROM `" . DB_PREFIX . "cf_projects`\n\t\tWHERE `geo_checked`= 0\n\t\t"); while ($row = $db->fetchArray($res)) { $tpl['projects'][$row['id']] = $row; $data = json_decode(file_get_contents("http://maps.googleapis.com/maps/api/geocode/json?latlng={$row['latitude']},{$row['longitude']}&sensor=true_or_false"), true); $data = $data['results'][sizeof($data['results']) - 2]; $country = $db->escape($data['address_components'][1]['short_name']); $city = $db->escape($data['address_components'][0]['long_name']); print $country . ' / ' . $city . "\n"; $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tUPDATE `" . DB_PREFIX . "cf_projects`\n\t\t\tSET `country` = '{$country}',\n\t\t\t\t\t`city` = '{$city}',\n\t\t\t\t\t`geo_checked`= 1\n\t\t\tWHERE `id` = {$row['id']}\n\t\t"); } // финансирование проектов $res = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT `id`,\n\t\t\t\t\t `project_id`,\n\t\t\t\t\t `amount`\n\t\tFROM `" . DB_PREFIX . "cf_funding`\n\t\tWHERE `checked`= 0\n\t\t"); while ($row = $db->fetchArray($res)) { // отмечаем, чтобы больше не брать $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tUPDATE `" . DB_PREFIX . "cf_funding`\n\t\t\tSET `checked` = 1\n\t\t\tWHERE `id` = {$row['id']}\n\t\t"); // сколько собрано средств $funding = (int) $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tSELECT sum(`amount`)\n\t\t\tFROM `" . DB_PREFIX . "cf_funding`\n\t\t\tWHERE `project_id` = {$row['project_id']} AND\n\t\t\t\t\t\t`del_block_id` = 0\n\t\t\t", 'fetch_one'); // сколько всего фундеров
<?php define('DC', TRUE); define('ABSPATH', dirname(dirname(__FILE__)) . '/'); set_time_limit(30); require_once ABSPATH . 'db_config.php'; require_once ABSPATH . 'includes/autoload.php'; $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); $start = intval(@$_REQUEST['start']); $block_id = intval(@$_REQUEST['block_id']); if (!empty($start) && !check_input_data($start, 'bigint')) { die('bad input data'); } if (!empty($block_id) && !check_input_data($block_id, 'bigint')) { die('bad input data'); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> <html> <head> <title>Block explorer</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link href="../css/bootstrap.min.css" rel="stylesheet"> <link href="../css/sb-admin.css" rel="stylesheet"> <style type="text/css"> body { padding: 10px 10px 10px 10px; } </style> </head> <body>
<?php define('DC', TRUE); define('ABSPATH', dirname(dirname(__FILE__)) . '/'); set_time_limit(0); //require_once( ABSPATH . 'includes/errors.php' ); require_once ABSPATH . 'db_config.php'; require_once ABSPATH . 'includes/autoload.php'; $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); $lang = get_lang(); // получаем кол-во DC на кошельках $res = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tSELECT `currency_id`,\n\t\t\t\t\t\t sum(`amount`) as sum_amount\n\t\t\tFROM `" . DB_PREFIX . "wallets`\n\t\t\tGROUP BY `currency_id`\n\t\t\t"); while ($row = $db->fetchArray($res)) { $sum_wallets[$row['currency_id']] = $row['sum_amount']; } // получаем кол-во TDC на обещанных суммах $res = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tSELECT `currency_id`,\n\t\t\t\t\t\t sum(`tdc_amount`) as sum_amount\n\t\t\tFROM `" . DB_PREFIX . "promised_amount`\n\t\t\tGROUP BY `currency_id`\n\t\t\t"); while ($row = $db->fetchArray($res)) { if (!isset($sum_wallets[$row['currency_id']])) { $sum_wallets[$row['currency_id']] = $row['sum_amount']; } else { $sum_wallets[$row['currency_id']] += $row['sum_amount']; } } $need_array = array(72 => '3 000 000 000 000', 58 => '31 000 000 000 000'); header("Access-Control-Allow-Origin: *"); $currency_list = get_currency_list($db); foreach ($sum_wallets as $currency_id => $sum) { if ($currency_id == 1 || $sum < 1 || $currency_id >= 1000) { continue; }
<?php define('DC', TRUE); define('ABSPATH', dirname(dirname(__FILE__)) . '/'); //require_once( ABSPATH . 'includes/errors.php' ); require_once ABSPATH . 'db_config.php'; require_once ABSPATH . 'includes/autoload.php'; $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); $user_id = intval($_REQUEST['user_id']); if (!check_input_data($user_id, 'int')) { die('error user_id'); } $lang = get_lang(); require_once ABSPATH . 'lang/' . $lang . '.php'; $sec = 3600 * 24 * 365; $prognosis = array(); $counters_ids = array(); $miners_data = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT *\n\t\tFROM `" . DB_PREFIX . "miners_data`\n\t\tWHERE `user_id` = {$user_id}\n\t\tLIMIT 1\n\t\t", 'fetch_array'); // получим ID майнеров, у которых лежат фото нужного нам юзера $miners_ids = ParseData::get_miners_keepers($miners_data['photo_block_id'], $miners_data['photo_max_miner_id'], $miners_data['miners_keepers'], true); $hosts = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT `host`\n\t\tFROM `" . DB_PREFIX . "miners_data`\n\t\tWHERE `miner_id` IN (" . implode(',', $miners_ids) . ")\n\t\t", 'array'); $currency_list = get_currency_list($db); /* * Обещанные * */ get_promised_amounts($user_id); if (!empty($tpl['promised_amount_list_gen'][72])) { $data = $tpl['promised_amount_list_gen'][72]; } else { if (!empty($tpl['promised_amount_list_gen'][72])) { $data = $tpl['promised_amount_list_gen'][72];
<?php session_start(); if (empty($_SESSION['user_id'])) { die('!user_id'); } define('DC', TRUE); define('ABSPATH', dirname(dirname(__FILE__)) . '/'); set_time_limit(0); //require_once( ABSPATH . 'includes/errors.php' ); require_once ABSPATH . 'db_config.php'; require_once ABSPATH . 'includes/autoload.php'; $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); require_once ABSPATH . 'lang/' . get_lang() . '.php'; $project_currency_name = $db->escape($_REQUEST['project_currency_name']); if (!check_input_data($project_currency_name, 'cf_currency_name')) { die(json_encode(array('error' => $lng['incorrect_currency_name']))); } // проверим, не занято ли имя валюты $currency = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\t\tSELECT `id`\n\t\t\t\tFROM `" . DB_PREFIX . "cf_projects`\n\t\t\t\tWHERE `project_currency_name` = '{$project_currency_name}' AND\n\t\t\t\t\t\t\t `close_block_id` = 0 AND\n\t\t\t\t\t\t\t `del_block_id` = 0\n\t\t\t\tLIMIT 1\n\t\t\t\t", 'fetch_one'); if ($currency) { die(json_encode(array('error' => $lng['currency_name_busy']))); } // проверим, не занято ли имя валюты $currency = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\t\tSELECT `id`\n\t\t\t\tFROM `" . DB_PREFIX . "cf_currency`\n\t\t\t\tWHERE `name` = '{$project_currency_name}'\n\t\t\t\tLIMIT 1\n\t\t\t\t", 'fetch_one'); if ($currency) { die(json_encode(array('error' => $lng['currency_name_busy']))); } print json_encode(array('success' => $lng['name_is_not_occupied']));
<?php /* * Получаем тр-ии, которые есть у юзера, в ответ выдаем те, что недостают и * их порядок следования, чтобы получить валидный блок */ define('DC', TRUE); define('ABSPATH', dirname(__FILE__) . '/'); set_time_limit(0); require_once ABSPATH . 'db_config.php'; require_once ABSPATH . 'includes/autoload.php'; require_once ABSPATH . 'includes/errors.php'; $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); $data = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tSELECT *\n\t\t\tFROM `" . DB_PREFIX . "testblock`\n\t\t\tLIMIT 1\n\t\t\t", 'fetch_array'); $response_binary_data = dec_binary($data['block_id'], 4) . dec_binary($data['time'], 4) . dec_binary($data['user_id'], 5) . encode_length(strlen($data['signature'])) . $data['signature']; // разбираем присланные данные $binary_data = $_POST['data']; $add_sql = ''; if ($binary_data) { $tr_array = array(); // получим хэши тр-ий, которые надо исключить do { list(, $tr) = unpack("H*", ParseData::string_shift($binary_data, 16)); // проверим if (!check_input_data($tr, 'md5')) { die('error md5 (' . $tr . ')'); } $add_sql .= $tr . ','; } while ($binary_data); $add_sql = substr($add_sql, 0, -1); $add_sql = "WHERE `id` NOT IN ({$add_sql})";
if (!file_exists(ABSPATH . 'db_config.php')) { sleep(1); $i++; } } while (!file_exists(ABSPATH . 'db_config.php') && $i < 120); require_once ABSPATH . 'db_config.php'; require_once ABSPATH . 'includes/autoload.php'; require_once ABSPATH . 'includes/errors.php'; require_once ABSPATH . 'cron/daemons_inc.php'; define('WAIT_SCRIPT', 300); // **************************************************************************** // Берем скрипты, которые более 300 сек не отстукивались в таблицу // Т.к. данный скрипт запускается каждые 60 сек в nix и работает в цикле в windows, то у всех демнов есть ровно 60 сек, // чтобы сообщить, что они запущены // **************************************************************************** $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); // в винде запуск данного скрипты означает, что все php процессы были убиты, значит можно обнулить время демонов if (OS == 'WIN') { $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, ' UPDATE `' . DB_PREFIX . 'daemons` SET `time`=0 '); } do { // если это первый запуск в авто-установке в винде, то таблы могут не успеть создаться. $tables_array = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tSHOW TABLES\n\t\t\t", 'array'); if (!in_array(DB_PREFIX . "config", $tables_array) || !in_array(DB_PREFIX . "main_lock", $tables_array) || !in_array(DB_PREFIX . "daemons", $tables_array)) { sleep(1); continue; } $php_path = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tSELECT `php_path`\n\t\t\tFROM `" . DB_PREFIX . "config`\n\t\t\t", 'fetch_one');
<?php define('DC', TRUE); define('ABSPATH', dirname(dirname(__FILE__)) . '/'); require_once ABSPATH . 'db_config.php'; require_once ABSPATH . 'includes/autoload.php'; $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); $lang = get_lang(); require_once ABSPATH . 'lang/' . $lang . '.php'; $get_user_id = intval($_REQUEST['user_id']); $currency_id = intval($_REQUEST['currency_id']); $arbitration_trust_list = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT `arbitrator_user_id`\n\t\tFROM `" . DB_PREFIX . "arbitration_trust_list`\n\t\tWHERE `user_id` = {$get_user_id}\n\t\t", 'array'); /* * Статистика по продавцу * */ // оборот всего $seller_turnover = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT sum(`amount`)\n\t\tFROM `" . DB_PREFIX . "orders`\n\t\tWHERE `seller` = {$get_user_id} AND\n\t\t\t\t\t `currency_id` = {$currency_id}\n\t\t", 'fetch_one'); // оборот за месяц $seller_turnover_m = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT sum(`amount`)\n\t\tFROM `" . DB_PREFIX . "orders`\n\t\tWHERE `seller` = {$get_user_id} AND\n\t\t\t\t\t `time` > " . (time() - 3600 * 24 * 30) . " AND\n\t\t\t\t\t `currency_id` = {$currency_id}\n\t\t", 'fetch_one'); // Кол-во покупателей за последний месяц $buyers_count_m = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT count(`id`)\n\t\tFROM (\n\t\t\tSELECT `id`\n\t\t\tFROM `" . DB_PREFIX . "orders`\n\t\t\tWHERE `seller` = {$get_user_id} AND\n\t\t\t\t\t\t `time` > " . (time() - 3600 * 24 * 30) . " AND\n\t\t\t\t\t\t `currency_id` = {$currency_id}\n\t\t\tGROUP BY `buyer`\n\t\t) as t1\n\t\t", 'fetch_one'); // Кол-во покупателей-майнеров за последний месяц $buyers_miners_count_m = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT count(`id`)\n\t\tFROM (\n\t\t\tSELECT `" . DB_PREFIX . "orders`.`id`\n\t\t\tFROM `" . DB_PREFIX . "orders`\n\t\t\tLEFT JOIN `" . DB_PREFIX . "miners_data` ON `" . DB_PREFIX . "miners_data`.`user_id` = `" . DB_PREFIX . "orders`.`buyer`\n\t\t\tWHERE `seller` = {$get_user_id} AND\n\t\t\t\t\t\t `" . DB_PREFIX . "orders`.`time` > " . (time() - 3600 * 24 * 30) . " AND\n\t\t\t\t\t\t `" . DB_PREFIX . "orders`.`currency_id` = {$currency_id} AND\n\t\t\t\t\t\t `miner_id` > 0\n\t\t\tGROUP BY `buyer`\n\t\t) as t1\n\t\t", 'fetch_one'); // Кол-во покупателей всего $buyers_count = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT count(`id`)\n\t\tFROM (\n\t\t\tSELECT `id`\n\t\t\tFROM `" . DB_PREFIX . "orders`\n\t\t\tWHERE `seller` = {$get_user_id} AND\n\t\t\t\t\t\t `currency_id` = {$currency_id}\n\t\t\tGROUP BY `buyer`\n\t\t) as t1\n\t\t", 'fetch_one'); // Кол-во покупателей-майнеров всего $buyers_miners_count = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT count(`id`)\n\t\tFROM (\n\t\t\tSELECT `" . DB_PREFIX . "orders`.`id`\n\t\t\tFROM `" . DB_PREFIX . "orders`\n\t\t\tLEFT JOIN `" . DB_PREFIX . "miners_data` ON `" . DB_PREFIX . "miners_data`.`user_id` = `" . DB_PREFIX . "orders`.`buyer`\n\t\t\tWHERE `seller` = {$get_user_id} AND\n\t\t\t\t\t\t `" . DB_PREFIX . "orders`.`currency_id` = {$currency_id} AND\n\t\t\t\t\t\t `miner_id` > 0\n\t\t\tGROUP BY `buyer`\n\t\t) as t1\n\t\t", 'fetch_one'); // Заморожено для манибека $hold_amount = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT sum(`hold_back_amount`)\n\t\tFROM `" . DB_PREFIX . "orders`\n\t\tLEFT JOIN `" . DB_PREFIX . "miners_data` ON `" . DB_PREFIX . "miners_data`.`user_id` = `" . DB_PREFIX . "orders`.`buyer`\n\t\tWHERE `seller` = {$get_user_id} AND\n\t\t\t\t\t `" . DB_PREFIX . "orders`.`currency_id` = {$currency_id} AND\n\t\t\t\t\t `miner_id` > 0\n\t\tGROUP BY `buyer`\n\t\t", 'fetch_one'); // Холдбек % на 30 дней $seller_data = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT `seller_hold_back_pct`,\n\t\t\t\t\t `arbitration_days_refund`\n\t\tFROM `" . DB_PREFIX . "users`\n\t\tWHERE `user_id` = {$get_user_id}\n\t\t", 'fetch_array');
<?php session_start(); define('DC', TRUE); define('ABSPATH', dirname(dirname(__FILE__)) . '/'); set_time_limit(0); require_once ABSPATH . 'db_config.php'; require_once ABSPATH . 'includes/autoload.php'; $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "SET NAMES UTF8"); $lang = get_lang(); require_once ABSPATH . 'lang/' . $lang . '.php'; $tpl['ver'] = file_get_contents(ABSPATH . 'version'); if ($_GET) { $page = each($_REQUEST); if (preg_match('/category\\-([0-9]+)/', $page[0], $m)) { $tpl['nav'] = "fc_navigate ('cf_catalog', {'category_id':{$m[1]}})\n"; } else { if (preg_match('/([A-Z0-9]{7}|id-[0-9]+)\\-?([0-9]+)?\\-?(funders|comments|news|home|payment)?/', $page[0], $m)) { // $m[1] - название валюты или id валюты // $m[2] - id языка // $m[3] - тип страницы (funders|comments|news) $add_nav = ''; if (preg_match('/id\\-([0-9]+)/', $m[1], $c_id)) { $add_nav .= "'only_project_id':'{$c_id[1]}',"; } else { $add_nav .= "'only_cf_currency_name':'{$m[1]}',"; } if (@$m[2]) { $add_nav .= "'lang_id':'{$m[2]}',"; }
<?php session_start(); define('DC', TRUE); define('ABSPATH', dirname(__FILE__) . '/'); set_time_limit(0); require_once ABSPATH . 'db_config.php'; require_once ABSPATH . 'includes/autoload.php'; require_once ABSPATH . 'includes/errors.php'; $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); $max_block_id = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, 'SELECT `block_id` FROM `' . DB_PREFIX . 'info_block`', 'fetch_one'); echo $max_block_id;
<?php session_start(); if (empty($_SESSION['user_id'])) { die('!user_id'); } define('DC', TRUE); define('ABSPATH', dirname(dirname(__FILE__)) . '/'); set_time_limit(0); //require_once( ABSPATH . 'includes/errors.php' ); require_once ABSPATH . 'db_config.php'; require_once ABSPATH . 'includes/autoload.php'; $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); if (!empty($_SESSION['restricted'])) { die('Permission denied'); } $_REQUEST['data'] = str_ireplace("\n", "<br>", $_REQUEST['data']); $data = json_decode($_REQUEST['data'], true); $id = intval($_REQUEST['id']); if (!check_input_data($data['parent_id'], 'int')) { die('error parent_id'); } if (!check_input_data($data['type'], 'int')) { die('error type'); } if (!check_input_data($data['subtype'], 'int')) { die('error subtype'); } $data['subject'] = filter_var($data['subject'], FILTER_SANITIZE_STRING); $data['subject'] = str_ireplace(array('\'', '"'), '', $data['subject']); $data['subject'] = $db->escape($data['subject']);
<?php session_start(); define('DC', TRUE); define('ABSPATH', dirname(dirname(__FILE__)) . '/'); set_time_limit(0); require_once ABSPATH . 'db_config.php'; require_once ABSPATH . 'includes/autoload.php'; $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); if (@$_REQUEST['parameters'] == 'lang=42' || $_REQUEST['parameters']['lang_id'] == '42') { $lang = 42; setlang($lang); } else { if (@$_REQUEST['parameters'] == 'lang=1' || $_REQUEST['parameters']['lang_id'] == '1') { $lang = 1; setlang($lang); } } $lang = get_lang(); require_once ABSPATH . 'lang/' . $lang . '.php'; $tpl['cf_url'] = get_cf_url(); if (!$tpl['cf_url']) { die('content access denied'); } // проверим, не идут ли тех. работы на пуле $config = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, ' SELECT `pool_admin_user_id`, `pool_tech_works` FROM `' . DB_PREFIX . 'config` ', 'fetch_array'); if ($config['pool_admin_user_id'] && $config['pool_admin_user_id'] != $_SESSION['user_id'] && $config['pool_tech_works'] == 1) {
if (mysqli_error($mysqli_link)) { $tpl['error'][] = 'Error performing query (' . $my_queries[$j] . ') - Error message : ' . mysqli_error($mysqli_link); } } mysqli_query($mysqli_link, "\n\t\t\tINSERT INTO `" . $tpl['mysql_prefix'] . "my_table` (\n\t\t\t\t`user_id`\n\t\t\t)\n\t\t\tVALUES (\n\t\t\t\t0\n\t\t\t)"); // конфиг mysqli_query($mysqli_link, "\n\t\t\tINSERT INTO `" . $tpl['mysql_prefix'] . "config` (\n\t\t\t\t`php_path`,\n\t\t\t\t`auto_reload`\n\t\t\t)\n\t\t\tVALUES (\n\t\t\t\t'{$php_path}',\n\t\t\t\t86400\n\t\t\t)"); // отметим, что установка завершена mysqli_query($mysqli_link, "\n\t\t\tINSERT INTO\n\t\t\t`" . $tpl['mysql_prefix'] . "install` (\n\t\t\t\t`progress`\n\t\t\t)\n\t\t\tVALUES (\n\t\t\t\t'complete'\n\t\t\t)"); require_once ABSPATH . 'templates/after_install.tpl'; } else { if (is_file(ABSPATH . 'db_config.php')) { require_once ABSPATH . 'db_config.php'; } if (defined('DB_HOST') && defined('DB_USER') && defined('DB_NAME')) { $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); } if ($db) { // проверим, точно ли в БД есть отметка об установке с нуля $progress = get_install_progress(); if ($progress == 'complete') { die('access denied'); } require_once ABSPATH . 'cron/daemons_inc.php'; foreach ($daemons as $script_name) { $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\t\t\tINSERT INTO `" . DB_PREFIX . "daemons` (\n\t\t\t\t\t\t`script`,\n\t\t\t\t\t\t`restart`\n\t\t\t\t\t)\n\t\t\t\t\tVALUES (\n\t\t\t\t\t\t'{$script_name}',\n\t\t\t\t\t\t1\n\t\t\t\t\t) ON DUPLICATE KEY UPDATE restart=1\n\t\t\t\t\t"); } } unset($_SESSION['user_id']); unset($_SESSION['restricted']); /* Для защиты от перехода злоумышленника к шагам, которые идут после проверки данных от БД
<?php define('DC', TRUE); define('ABSPATH', dirname(dirname(__FILE__)) . '/'); set_time_limit(30); require_once ABSPATH . 'db_config.php'; require_once ABSPATH . 'includes/autoload.php'; $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); if ($_POST) { $private_key = $_REQUEST['private_key']; $rsa = new Crypt_RSA(); $rsa->loadKey($private_key, CRYPT_RSA_PRIVATE_FORMAT_PKCS1); $public_key = clear_public_key($rsa->getPublicKey()); $user_id = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tSELECT `user_id`\n\t\t\tFROM `" . DB_PREFIX . "users`\n\t\t\tWHERE `public_key_0` = 0x{$public_key}\n\t\t\t", 'fetch_one'); if ($user_id) { print 'All right! user_id: ' . $user_id; } else { print 'Sorry, bad key'; } } print '<br><form method="post"><textarea name="private_key" style="width: 700px; height: 400px"></textarea><br><input type="submit"></form>';
<?php session_start(); if (empty($_SESSION['user_id'])) { die('!user_id'); } define('DC', TRUE); define('ABSPATH', dirname(dirname(__FILE__)) . '/'); //require_once( ABSPATH . 'includes/errors.php' ); require_once ABSPATH . 'db_config.php'; require_once ABSPATH . 'includes/autoload.php'; $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); $to_id = array(); if (isset($_REQUEST['to_id'])) { if (is_array($_REQUEST['to_id'])) { for ($i = 0; $i < sizeof($_REQUEST['to_id']); $i++) { $to_id[$i] = intval($_REQUEST['to_id'][$i]); } } else { $to_id = intval($_REQUEST['to_id']); } } if (!$to_id) { $to_id = intval($_REQUEST['to_user_id']); } if (strlen($_REQUEST['comment']) > 1024) { die('error comment'); } if ($_REQUEST['type'] == 'project') { $to_user_id = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tSELECT `user_id`\n\t\t\tFROM `" . DB_PREFIX . "cf_projects`\n\t\t\tWHERE `id` = {$to_id}\n\t\t\tLIMIT 1\n\t\t\t", 'fetch_one'); } else {
<?php session_start(); define('DC', TRUE); define('ABSPATH', dirname(__FILE__) . '/'); set_time_limit(0); $first_load_blockchain = false; $install_progress = 0; if (file_exists(ABSPATH . 'db_config.php')) { require_once ABSPATH . 'db_config.php'; require_once ABSPATH . 'includes/autoload.php'; $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, 'SET NAMES utf8'); // узнаем, на каком шаге остановились $install_progress = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, ' SELECT `progress` FROM `' . DB_PREFIX . 'install` ', 'fetch_one'); // выбрали ли вариант первичной загрузки блок-чейна $first_load_blockchain = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, ' SELECT `first_load_blockchain` FROM `' . DB_PREFIX . 'config` ', 'fetch_one'); // нужно узнать время последнего блока $confirmed_block_id = get_confirmed_block_id($db); $confirmed_block_id = $confirmed_block_id ? $confirmed_block_id : 1; // получим время из последнего подвержденного блока $last_block_bin = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tSELECT `data`\n\t\t\tFROM `" . DB_PREFIX . "block_chain`\n\t\t\tWHERE `id` = {$confirmed_block_id}\n\t\t\tLIMIT 1\n\t\t\t", 'fetch_one'); ParseData::string_shift($last_block_bin, 5); // уберем тип и id блока $block_time = ParseData::binary_dec_string_shift($last_block_bin, 4);
<?php define('DC', TRUE); define('ABSPATH', dirname(dirname(__FILE__)) . '/'); //require_once( ABSPATH . 'includes/errors.php' ); require_once ABSPATH . 'db_config.php'; require_once ABSPATH . 'includes/autoload.php'; $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); if (!check_input_data($_POST['sign'], 'hex_sign')) { json_encode(array('result' => 'bad hex_sign')); } if (!preg_match("/^[0-9a-z]{1,2048}\$/D", $_POST['e'])) { json_encode(array('result' => 'bad e')); } if (!preg_match("/^[0-9a-z]{1,2048}\$/D", $_POST['n'])) { json_encode(array('result' => 'bad n')); } $sign = hextobin($_POST['sign']); $tables_array = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tSHOW TABLES\n\t\t\t", 'array'); $community = get_community_users($db); $result = 0; if ($community) { // в цикле проверяем, кому подойдет присланная подпись for ($i = 0; $i < sizeof($community); $i++) { $my_prefix = $community[$i] . '_'; if (!in_array("{$my_prefix}my_keys", $tables_array)) { continue; } // получим открытый ключ юзера $public_key = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\t\tSELECT `public_key`\n\t\t\t\tFROM `" . DB_PREFIX . "{$my_prefix}my_keys`\n\t\t\t\tWHERE `block_id` = (SELECT max(`block_id`) FROM `" . DB_PREFIX . "{$my_prefix}my_keys` )\n\t\t\t\t", 'fetch_one'); $ini_array = parse_ini_file(ABSPATH . "config.ini", true);
<?php define('DC', TRUE); define('ABSPATH', dirname(__FILE__) . '/'); set_time_limit(0); require_once ABSPATH . 'db_config.php'; require_once ABSPATH . 'includes/autoload.php'; require_once ABSPATH . 'includes/errors.php'; $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); if (isset($_REQUEST['id'])) { $id = intval($_REQUEST['id']); } if ($id) { if (isset($_REQUEST['download'])) { header('Content-type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . $id . '.binary"'); } $block = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tSELECT `data`\n\t\t\tFROM `" . DB_PREFIX . "block_chain`\n\t\t\tWHERE `id` = {$id}\n\t\t\t", 'fetch_one'); echo $block; } else { echo json_encode(array('error' => 'bad id')); }
upd_deamon_time($db); if (check_deamon_restart($db)) { main_unlock(); exit; } } } } if ($file) { fclose($file); } if ($newf) { fclose($newf); } } $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); if (!$db) { exit; } if (substr(PHP_OS, 0, 3) == "WIN") { // для win, когда идет сбор блоков делаем очистку main_lock $block_time = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, ' SELECT `time` FROM `' . DB_PREFIX . 'info_block` ', 'fetch_one'); if (time() - $block_time > 3600 * 24 * 7) { $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, ' TRUNCATE TABLE `' . DB_PREFIX . 'main_lock` '); } }
<?php session_start(); if (empty($_SESSION['user_id'])) { die('!user_id'); } define('DC', TRUE); define('ABSPATH', dirname(dirname(__FILE__)) . '/'); set_time_limit(0); //require_once( ABSPATH . 'includes/errors.php' ); require_once ABSPATH . 'db_config.php'; require_once ABSPATH . 'includes/autoload.php'; $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); if (!empty($_SESSION['restricted'])) { die('Permission denied'); } $my_user_id = $_SESSION['user_id']; $min_amount = $db->escape($_REQUEST['min_amount']); $currency_id = $db->escape($_REQUEST['currency_id']); $ps_id = $db->escape($_REQUEST['payment_system_id']); if (!check_input_data($min_amount, 'amount')) { die('error min_amount'); } if (!check_input_data($currency_id, 'int')) { die('error currency_id'); } if (!check_input_data($ps_id, 'int')) { die('error payment_system_id'); } $max_promised_amounts = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT `amount`\n\t\tFROM `" . DB_PREFIX . "max_promised_amounts`\n\t\tWHERE `currency_id` = {$currency_id}\n\t\tORDER BY `time` DESC\n\t\tLIMIT 1\n\t\t", 'fetch_one'); if ($ps_id) {
<?php if (!$argv) { die('browser'); } define('DC', true); define('ABSPATH', dirname(dirname(__FILE__)) . '/'); set_time_limit(0); require_once ABSPATH . 'db_config.php'; require_once ABSPATH . 'includes/autoload.php'; require_once ABSPATH . 'includes/errors.php'; $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); // валюты $res = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, ' SELECT `id`, `name` FROM `' . DB_PREFIX . 'currency` ORDER BY `name` '); while ($row = $db->fetchArray($res)) { $currency_list[$row['id']] = $row['name']; } $notifications_array = array(); $user_email_sms_data = array(); $my_users_ids = get_community_users($db); if (!$my_users_ids) { $community = false; // сингл-мод $my_users_ids[0] = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tSELECT `user_id`\n\t\t\tFROM `" . DB_PREFIX . "my_table`\n\t\t\t", 'fetch_one'); } else { $community = true;
$tpl['mysql_username'] = clear_quotes($_POST['mysql_username']); $tpl['mysql_password'] = clear_quotes($_POST['mysql_password']); $tpl['mysql_prefix'] = clear_quotes(@$_POST['mysql_prefix']); if (!check_input_data($tpl['mysql_prefix'], 'db_prefix')) { die('bad mysql_prefix'); } } // проверям, можно ли подключиться к БД $tpl['mysql_port'] = !empty($tpl['mysql_port']) ? $tpl['mysql_port'] : 3306; $mysqli_link = mysqli_connect($tpl['mysql_host'], $tpl['mysql_username'], $tpl['mysql_password'], $tpl['mysql_db_name'], $tpl['mysql_port']); if (mysqli_connect_errno()) { $tpl['error'][] = 'Error connecting to MySQL : ' . mysqli_connect_errno() . ' ' . mysqli_connect_error(); } if (!isset($tpl['error'])) { require_once ABSPATH . 'includes/MySQLidb.php'; $db = new MySQLidb($tpl['mysql_host'], $tpl['mysql_username'], $tpl['mysql_password'], $tpl['mysql_db_name'], $tpl['mysql_port']); $db_name = $tpl['mysql_db_name']; $prefix = $tpl['mysql_prefix']; // пробуем создать таблицы в БД include ABSPATH . 'schema.php'; mysqli_query($mysqli_link, 'SET NAMES "utf8" '); for ($i = 0; $i < sizeof($queries); $i++) { mysqli_multi_query($mysqli_link, $queries[$i]); while (@mysqli_next_result($mysqli_link)) { } if (mysqli_error($mysqli_link)) { $tpl['error'][] = 'Error performing query (' . $queries[$i] . ') - Error message : ' . mysqli_error($mysqli_link); } } // возможно идет установка пула, тогда ловим файл c user_id;public_key if ($_POST['pool_data']) {
<?php session_start(); if (empty($_SESSION['user_id'])) { die('!user_id'); } $user_id = intval($_SESSION['user_id']); define('DC', TRUE); define('ABSPATH', dirname(dirname(__FILE__)) . '/'); set_time_limit(0); //require_once( ABSPATH . 'includes/errors.php' ); require_once ABSPATH . 'db_config.php'; require_once ABSPATH . 'includes/autoload.php'; $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); $lang = get_lang(); $project_id = intval($_REQUEST['project_id']); $cf_project = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT *\n\t\tFROM `" . DB_PREFIX . "cf_projects`\n\t\tWHERE `del_block_id`=0 AND\n\t\t\t\t\t `id` = {$project_id}\n\t\t", 'fetch_array'); if (!$cf_project) { die(json_encode(array('error' => 'No project'))); } $cf_project = array_merge(project_data($cf_project), $cf_project); // сколько у нас есть DC данной валюты $wallet = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tSELECT *\n\t\t\tFROM `" . DB_PREFIX . "wallets`\n\t\t\tWHERE `user_id` = {$user_id} AND\n\t\t\t\t\t\t `currency_id` = {$cf_project['currency_id']}\n\t\t\t", 'fetch_array'); if ($wallet) { $wallet['amount'] += calc_profit_($wallet['currency_id'], $wallet['amount'], $user_id, $db, $wallet['last_update'], time(), 'wallet'); $wallet['amount'] = floor(round($wallet['amount'], 3) * 100) / 100; $forex_orders_amount = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\t\t\tSELECT sum(`amount`)\n\t\t\t\t\tFROM `" . DB_PREFIX . "forex_orders`\n\t\t\t\t\tWHERE `user_id` = {$user_id} AND\n\t\t\t\t\t\t\t\t `sell_currency_id` = {$wallet['currency_id']} AND\n\t\t\t\t\t\t\t\t `del_block_id` = 0\n\t\t\t\t\t", 'fetch_one'); $wallet['amount'] -= $forex_orders_amount; } else { $wallet['amount'] = 0; }
<?php session_start(); define('DC', TRUE); define('ABSPATH', dirname(dirname(__FILE__)) . '/'); set_time_limit(0); //require_once( ABSPATH . 'includes/errors.php' ); require_once ABSPATH . 'db_config.php'; require_once ABSPATH . 'includes/autoload.php'; require_once ABSPATH . 'cron/daemons_inc.php'; $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); $arr = array(); foreach ($daemons as $daemon) { $arr[str_replace('.php', '', $daemon)] = 'no'; } $res = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, ' SELECT `script`, `time` FROM `' . DB_PREFIX . 'daemons` '); while ($row = $db->fetchArray($res)) { $name = substr($row['script'], 0, strpos($row['script'], '.')); if ($row['time'] > time() - 600) { $arr[$name] = 'ok'; } } // **************************************************************************** // CHMOD // **************************************************************************** // Очищаем кэш состояния файлов clearstatcache(); $perms = fileperms(ABSPATH);
<?php session_start(); define('DC', TRUE); define('ABSPATH', dirname(dirname(__FILE__)) . '/'); //require_once( ABSPATH . 'includes/errors.php' ); require_once ABSPATH . 'db_config.php'; require_once ABSPATH . 'includes/autoload.php'; $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); $lang = get_lang(); require_once ABSPATH . 'lang/' . $lang . '.php'; $dc_currency_id = intval($_REQUEST['dc_currency_id']); $currency_id = intval($_REQUEST['currency_id']); $amount = $db->escape($_REQUEST['amount']); if (!preg_match('/^[0-9]{0,6}(\\.[0-9]{0,8})?$/D', $amount) || $amount == 0) { die(json_encode(array('error' => 'amount_error'))); } $currency_list = get_currency_list($db); $config = get_node_config(); if ($config['cf_available_coins_url']) { $url = "{$config['cf_available_coins_url']}?dc_currency_id={$dc_currency_id}¤cy_id={$currency_id}&amount={$amount}"; $answer = file_get_contents($url); $answer_array = json_decode($answer, true); if (!isset($answer_array['success'])) { echo json_encode(array('error' => str_ireplace(array('[url]', '[amount]', '[currency_name]'), array('<a href="' . $config['cf_exchange_url'] . '">' . $config['cf_exchange_url'] . '</a>', $answer_array['error'], 'D' . $currency_list[$dc_currency_id]), $lng['no_DC']))); } else { echo $answer; } }
<?php session_start(); if (empty($_SESSION['user_id'])) { die('!user_id'); } define('DC', TRUE); define('ABSPATH', dirname(dirname(__FILE__)) . '/'); //require_once( ABSPATH . 'includes/errors.php' ); require_once ABSPATH . 'db_config.php'; require_once ABSPATH . 'includes/autoload.php'; $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); $user_id = intval($_REQUEST['user_id']); if (!check_input_data($user_id, 'int')) { die('error user_id'); } $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "SET NAMES UTF8"); $res = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT *\n\t\tFROM `" . DB_PREFIX . "abuses`\n\t\tWHERE `user_id` = {$user_id}\n\t\t"); $abuses = ''; while ($row = $db->fetchArray($res)) { $abuses .= 'from_user_id: ' . $row['from_user_id'] . '; time: ' . date('d-m-Y H:i:s', $row['time']) . '; comment: ' . $row['comment'] . "<br>"; } if (!$abuses) { $abuses = 'No'; } $reg_time = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT `reg_time`\n\t\tFROM `" . DB_PREFIX . "miners_data`\n\t\tWHERE `user_id` = {$user_id}\n\t\t", 'fetch_one'); $reg_time = date('d-m-Y H:i:s', $reg_time); echo json_encode(array('abuses' => $abuses, 'reg_time' => $reg_time));
<?php session_start(); if (empty($_SESSION['user_id'])) { die('!user_id'); } define('DC', TRUE); define('ABSPATH', dirname(dirname(__FILE__)) . '/'); //require_once( ABSPATH . 'includes/errors.php' ); require_once ABSPATH . 'db_config.php'; require_once ABSPATH . 'includes/autoload.php'; if (!empty($_SESSION['restricted'])) { die('Permission denied'); } $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); if (!check_input_data($_REQUEST['parent_id'], 'int')) { die('error parent_id'); } if (!check_input_data($_REQUEST['message_type'], 'int')) { die('error type'); } if (!check_input_data($_REQUEST['message_subtype'], 'int')) { die('error subtype'); } $parent_id = intval($_REQUEST['parent_id']); $message_type = intval($_REQUEST['message_type']); $message_subtype = intval($_REQUEST['message_subtype']); $subject = $db->escape($_REQUEST['subject']); $message = $db->escape($_REQUEST['message']); define('MY_PREFIX', get_my_prefix($db)); $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "SET NAMES UTF8");
<?php if (!$argv) { die('browser'); } define('DC', true); /* * просто шлем всем, кто есть в nodes_connection хэши блока и тр-ий * если мы не майнер, то шлем всю тр-ию целиком, блоки слать не можем * если майнер - то шлем только хэши, т.к. у нас есть хост, откуда всё можно скачать * */ define('ABSPATH', dirname(dirname(__FILE__)) . '/'); require_once ABSPATH . 'db_config.php'; require_once ABSPATH . 'includes/autoload.php'; require_once ABSPATH . 'includes/errors.php'; $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); while (true) { debug_print("START", __FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__); $urls = array(); $hosts = array(); $my_config = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tSELECT `local_gate_ip`,\n\t\t\t\t\t\t `static_node_user_id`\n\t\t\tFROM `" . DB_PREFIX . "config`\n\t\t\t", 'fetch_array'); // отметимся в БД, что мы живы. upd_deamon_time($db); // проверим, не нужно нам выйти, т.к. обновилась версия скрипта if (check_deamon_restart($db)) { exit; } if (!$my_config['local_gate_ip']) { // обычнй режим $res = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\t\t\tSELECT `" . DB_PREFIX . "miners_data`.`user_id`, `" . DB_PREFIX . "miners_data`.`host`, `node_public_key`\n\t\t\t\t\tFROM `" . DB_PREFIX . "nodes_connection`\n\t\t\t\t\tLEFT JOIN `" . DB_PREFIX . "miners_data` ON `" . DB_PREFIX . "nodes_connection`.`user_id` = `" . DB_PREFIX . "miners_data`.`user_id`\n\t\t\t\t\t"); while ($row = $db->fetchArray($res)) {
<?php session_start(); define('DC', TRUE); define('ABSPATH', dirname(dirname(__FILE__)) . '/'); set_time_limit(0); //require_once( ABSPATH . 'includes/errors.php' ); if (file_exists(ABSPATH . 'db_config.php')) { require_once ABSPATH . 'db_config.php'; require_once ABSPATH . 'includes/autoload.php'; $lang = get_lang(); require_once ABSPATH . 'lang/' . $lang . '.php'; $db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT); $block_id = 0; $block_time = 0; $data = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tSELECT `block_id`,\n\t\t\t\t\t\t `time`\n\t\t\tFROM `" . DB_PREFIX . "info_block`\n\t\t\t", 'fetch_array'); $block_id = $data['block_id']; $block_time = $data['time']; // если время более 12 часов от текущего, то выдаем не подвержденные, а просто те, что есть в блокчейне if (time() - $block_time < 3600 * 12) { $confirmed_block_id = get_confirmed_block_id($db); if ($confirmed_block_id) { // получим время из последнего подвержденного блока $last_block_bin = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\t\tSELECT `data`\n\t\t\t\tFROM `" . DB_PREFIX . "block_chain`\n\t\t\t\tWHERE `id` = {$confirmed_block_id}\n\t\t\t\tLIMIT 1\n\t\t\t\t", 'fetch_one'); ParseData::string_shift($last_block_bin, 1); // уберем тип $block_id = ParseData::binary_dec_string_shift($last_block_bin, 4); $block_time = ParseData::binary_dec_string_shift($last_block_bin, 4); if (time() - $block_time < 3600) { $block_id = -1; $block_time = -1;