<? require_once($_SERVER['DOCUMENT_ROOT'].'/private/class/easydarkcoin.php'); require_once($_SERVER['DOCUMENT_ROOT'].'/private/config.php'); require_once($_SERVER['DOCUMENT_ROOT'].'/private/init/mysql.php'); require_once($_SERVER['DOCUMENT_ROOT'].'/private/func.php'); $darkcoin = new Darkcoin('xxx','xxx','localhost','9998'); $info = $darkcoin->masternode('list', 'addr'); function check_mn($ip){ global $darkcoin, $info, $db; $i = 'NO'; $query = $db->prepare("SELECT * FROM `hosting` WHERE `ip` = :ip"); $query->bindParam(':ip', $ip, PDO::PARAM_STR); $query->execute(); $row = $query->fetch(); if (in_array("$ip:9999", $info) && $row['txid'] !== NULL) $i = 'OK'; return $i; } $mn_online = 1; // +1 => it`s my node work too ;) $query = $db->query("SELECT * FROM `hosting`"); $query->execute(); $mn_all = $query->rowCount()+1; // +1 => it`s my node work too ;) while($row=$query->fetch()){ if(check_mn($row['ip']) == 'OK' || time()-60*60*24 < $row['last'] || time()-60*60*12 < $row['time']){ $mn_online++; } } $fail_mn = ''; $pay_mn = ''; $j_time = time()-60*60;
<? require_once($_SERVER['DOCUMENT_ROOT'].'/private/class/easydarkcoin.php'); require_once($_SERVER['DOCUMENT_ROOT'].'/private/config.php'); require_once($_SERVER['DOCUMENT_ROOT'].'/private/init/mysql.php'); require_once($_SERVER['DOCUMENT_ROOT'].'/private/func.php'); $darkcoin = new Darkcoin('xxx','xxx','localhost','9998'); $info = $darkcoin->masternode('list', 'addr'); $donate = "XkB8ySpiqyVHeAXHsNhU83mUJ7Jd3CJaqW:10"; $name = "mn1"; $auth = "secret"; function send_do($command, $ip, $key){ global $auth, $db; $query = $db->prepare("SELECT * FROM `hosting` WHERE `ip` = :ip"); $query->bindParam(':ip', $ip, PDO::PARAM_STR); $query->execute(); $row = $query->fetch(); $api = $row['api']; $query = $db->prepare("SELECT * FROM `api` WHERE `id` = :id"); $query->bindParam(':id', $api, PDO::PARAM_STR); $query->execute(); $row = $query->fetch(); $api = $row['api']; return file_get_contents("http://$api/index.php?do=$command&ip=$ip&key=$key&auth=$auth"); } function check_mn($ip){ global $darkcoin, $info, $db; $i = 'NO';
<?php require_once '/var/www/dash/root/private/class/easydarkcoin.php'; require_once '/var/www/dash/root/private/config.php'; require_once '/var/www/dash/root/private/init/mysql.php'; require_once '/var/www/dash/root/private/func.php'; $darkcoin = new Darkcoin('xxx', 'xxx', 'localhost', '9998'); $price = 3; // Получаем массив и делаем цикл $a = $darkcoin->listtransactions("*", 1000); for ($i = 0; count($a) > $i; $i++) { if ($a["{$i}"]["category"] != "receive" || $a["{$i}"]["confirmations"] < 6 || $a["{$i}"]["amount"] < 0.1) { continue; } // Есть ли в базе эта транзакция? $select_query = $db->prepare("SELECT * FROM `pay_logs` WHERE `txid` =:id"); $select_query->bindParam(':id', $a["{$i}"]["txid"], PDO::PARAM_STR); $select_query->execute(); if ($select_query->rowCount() > 0) { continue; } $select_query = $db->prepare("SELECT * FROM `hosting` WHERE `pay_address` = :address"); $select_query->bindParam(':address', $a["{$i}"]["address"], PDO::PARAM_STR); $select_query->execute(); if ($select_query->rowCount() != 1) { continue; } $row = $select_query->fetch(); $time_now = time(); $time_pay = $row['pay_time'] + 60 * 60 * 24 * 30 * ($a["{$i}"]["amount"] / $price); $extra = $row['pay_time'] . " => {$time_pay} | price: {$price}";