<?php // Ajax Handler // file configs // require_once "../inc/config.php"; // db connectors and functions // require_once "../inc/database.php"; $db = new Database(); // account functions // require_once "../inc/Accounts.php"; $act = new Accounts(); require_once '../inc/ExchangeAPIs/bitfinex.php'; if ($_REQUEST['doPause'] == 1) { // flip the pause/unpause setting on an account // $userP = $db->iquery("UPDATE `" . $config['db']['prefix'] . "Users` set status = (CASE\n\t\tWHEN status = 1 THEN 2\n\t\t\tWHEN status = 2 THEN 1\n\t\t\tWHEN status = 9 THEN 8\n\t\t\tWHEN status = 8 THEN 9\n\t\tEND)\n\tWHERE id = '" . $db->escapeStr($_REQUEST['uid']) . "' LIMIT 1"); if ($userP['num'] > 0) { echo '1'; } else { echo '0'; } }
if (strlen($_REQUEST['installAdminUser']) < 3) { $warning[] = 'Account Name must be at least 3 characters long'; } if (strlen($_REQUEST['installAdminBFXKey']) != 43) { $warning[] = 'Bitfinex API Keys are 43 Characters Long'; } if (strlen($_REQUEST['installAdminBFXSec']) != 43) { $warning[] = 'Bitfinex API Secrets are 43 Characters Long'; } // Passwords should never be longer than 72 characters to prevent DoS attacks if (strlen($_REQUEST['installAdminPassword']) > 72) { $warning[] = 'Passwords must be less than 72 Characters'; } if (count($warning) == 0) { // Check it doesn't already exits... $userCheck = $db->query("SELECT name, bfxapikey FROM `" . $config['db']['prefix'] . "Users` WHERE (name = '" . $db->escapeStr($_REQUEST['installAdminUser']) . "' OR bfxapikey = '" . $db->escapeStr($_REQUEST['installAdminBFXKey']) . "' ) LIMIT 1"); if (count($userCheck) == 1) { if ($userCheck[0]['name'] == $_REQUEST['installAdminUser']) { $warning[] = 'This user name already exists in our database'; } if ($userCheck[0]['bfxapikey'] == $_REQUEST['installAdminBFXKey']) { $warning[] = 'This bitfinex key already exists in our database'; } } } if (count($warning) == 0) { // test their bfx key and sec to see if we can pull data // $bfxTest = new Bitfinex(0, $_REQUEST['installAdminBFXKey'], $_REQUEST['installAdminBFXSec']); $bt = $bfxTest->bitfinex_get('account_infos'); if ($bt[0]['fees'][0]['pairs'] != '') { // looks good //