function change_password($newPassword) { global $root; $sessionID = get_session(); //echo "SESSION ID IS: " . htmlspecialchars($sessionID) . "\n"; if (!isset($sessionID)) { echo "sessionID is not set?"; //echo htmlspecialchars($sessionID); die; } else { //$sessionID = $session->SessionID; // required parameters for /changePassword $args = array('accountNum' => API_ACCOUNT_NUM, 'session' => $sessionID, 'newPassword' => $newPassword, 'password' => $_POST['current_password']); $result = build_api_request('/changePassword', $args); // error handling for changing the password $json_result = json_decode($result); //echo "json_result-Status = " . $json_result->Status; if (!isset($json_result->Status)) { echo '<div id="bigContent">'; echo "Invalid request."; echo '</div>'; include "{$root}/footer.php"; die; } else { echo '<div id="bigContent">'; echo $json_result->Status . '<br />'; echo "Please update your config.inc.php file to reflect your changed password in order to prevent errors when accessing the fed API."; echo '</div>'; include "{$root}/footer.php"; die; } } }
function get_fed_balance() { $sessionID = get_session(); // required parameters for /getBalance $args = array('accountNum' => API_ACCOUNT_NUM, 'session' => $sessionID); $result = build_api_request('/getBalance', $args); $json_result = json_decode($result); // catch error here if (!isset($json_result->Balance)) { echo $result; die; } return number_format($json_result->Balance, 2); }
<?php include_once 'content.php'; include_once '../includes.php'; /*if (!is_null($_POST['new_pin'])) { $new_pin = $_POST['new_pin']; }*/ // should probably do error handling here. that's a later problem. $new_pin = $_POST['new_pin']; $old_pin = $_POST['old_pin']; $sessionID = get_session(); // required parameters for /getPin //required = ["accountNum","session","newPin"] $args = array('accountNum' => API_ACCOUNT_NUM, 'session' => $sessionID, 'newPin' => $new_pin, 'pin' => $old_pin); $result = build_api_request('/changePin', $args); $json_result = json_decode($result); $title = "Change PIN"; include "{$root}/header.php"; ?> <div id="bigContent"> <table id="contentTable"> <tr> <td id="contentText"> <?php // catch error here if (!isset($json_result[0]->Status)) { //echo '$json_result[\'Status\'] = ' . $json_result['Status'] . " lollollol\n"; echo $result . ' Click <a href="panel.php">here</a> to return to the admin panel.'; echo '</div>'; include "{$root}/footer.php"; exit;
} $amount = $_POST['amount']; //$destAccount = $_POST['destAccount']; if ($_POST['whiteteam'] === "true") { $destAccount = WHITE_TEAM_ACCT_NUM; } elseif (isset($_POST['destAccount'])) { $destAccount = $_POST['destAccount']; } else { $destAccount = "abc"; // arbitrary value if something goes wrong } $sessionID = get_session(); // required parameters for /transferMoney // "accountNum","session","destAccount","amount"] $args = array('accountNum' => API_ACCOUNT_NUM, 'session' => $sessionID, 'destAccount' => $destAccount, 'amount' => $amount); $result = build_api_request('/transferMoney', $args); $json_result = json_decode($result); $title = "Home"; include "{$root}/header.php"; ?> <div id="bigContent"> <table id="contentTable"> <tr> <td id="contentText"> <?php // catch error here if (!isset($json_result[0]->Status)) { //echo '$json_result[\'Status\'] = ' . $json_result['Status'] . " lollollol\n"; echo $result . ' Click <a href="panel.php">here</a> to return to the admin panel.'; echo '</div>'; include "{$root}/footer.php";