function isBruteForce() { $rList = array(); $where = "`ip`='" . $_SERVER['REMOTE_ADDR'] . "' "; $where .= empty($_SERVER["HTTP_X_FORWARDED_FOR"]) ? "" : " OR `ip`='" . $_SERVER["HTTP_X_FORWARDED_FOR"] . "'"; if (!DB_GetRows($rList, DB_TABLE_BRUTES, array('id'), array('WHERE' => $where))) { return true; } if (count($rList) >= MAX_BRUTE_COUNT) { return true; } return false; }
continue; } $rData[] = array('server' => $srv['host'] . ':' . $srv['port'], 'title' => $srv['title'], 'balance' => $rpcOut->result); } $jsonData = array('success' => true, 'root' => $rData, 'message' => sprintf("Total: %d record found. ", count($rData)), 'error' => array()); } } } else { if ($currentAction == "backup") { $srvList = array(); $rData = array(); $rpcOut = array(); if (!isLoggedIn()) { $jsonData = array('success' => false, 'root' => array(), 'error' => array('title' => 'Login Required', 'reason' => 'You have to login for this operation.')); } else { if (!DB_GetRows($srvList, DB_TABLE_RPC_SERVER, $rDbStruct[DB_TABLE_RPC_SERVER], array('WHERE' => "1"))) { $jsonData = array('success' => false, 'root' => array(), 'error' => array('title' => 'Error!', 'reason' => 'Unable to load server information.')); } else { foreach ($srvList as $srv) { $backupFileName = $srv['backup_path'] . date("Y_M_d_H_i_s") . ".dat"; if (empty($srv['backup_path'])) { $tmp = array('title' => $srv['title'], 'server' => $srv['host'] . ':' . $srv['port'], 'backupfilepath' => "---", 'status' => 'ERROR: Backup Destination is not set. Backup Disabled'); } else { if (!rpc_request($rpcOut, $srv, array('method' => 'backupwallet', 'params' => array($backupFileName)))) { $tmp = array('title' => $srv['title'], 'server' => $srv['host'] . ':' . $srv['port'], 'backupfilepath' => $backupFileName, 'status' => 'ERROR: ' . $rpcOut->error->message); } else { $tmp = array('title' => $srv['title'], 'server' => $srv['host'] . ':' . $srv['port'], 'backupfilepath' => $backupFileName, 'status' => 'DONE'); } } $rData[] = $tmp; }
} table, th, td { border: 1px solid #D4E0EE; border-collapse: collapse; font-family: "Trebuchet MS", Arial, sans-serif; align: center; } td, th { padding: 4px; } </style> </head> <body>'; $rData = array(); if (!DB_GetRows($rData, DB_TABLE_RPC_SERVER, $rDbStruct[DB_TABLE_RPC_SERVER], array('WHERE' => '1'))) { die("<h2>UNABLE TO LOAD RPC SERVERS</h2>"); } echo '<center><h2 style="color:red">' . SCRIPT_NAME . ' ' . SCRIPT_VER . '<br />PANIC MODE</h2></center> <table width="100%" border="1"><tr><th>ID</th><th>SERVER LINK</th><th>ACTION</th><th>RESULT</th></tr>'; $i = 0; foreach ($rData as $srv) { $srvLink = "rcp://" . $srv['username'] . ":***@" . $srv['host'] . ":" . $srv['port']; $pText = "<tr><td>" . ($i + 1) . "</td><td>" . $srvLink . "</td><td>Sending stop command</td><td>"; $c = rpc_request($rpcOut, $srv, array('method' => 'stop', 'params' => array())); $pText .= _getPanicStatusText($c); $pText .= "</td></tr>"; $pText .= "<tr><td>" . ($i + 2) . "</td><td>" . $srvLink . "</td><td>Removing record from database </td><td>"; $c = DB_delete(DB_TABLE_RPC_SERVER, array('WHERE' => "`id`='" . $srv['id'] . "'")); $pText .= _getPanicStatusText($c); $pText .= "</td></tr>";