// ============================================================================ // ============================================================================ // POST Method // ============================================================================ if ($_SERVER['REQUEST_METHOD'] == 'POST') { // Prevent editors to administrate other users. if ($Login->role() !== 'admin') { $_POST['username'] = $Login->username(); unset($_POST['role']); } if (isset($_POST['delete-user-all'])) { deleteUser($_POST, true); } elseif (isset($_POST['delete-user-associate'])) { deleteUser($_POST, false); } elseif (isset($_POST['disable-user'])) { disableUser($_POST['username']); } else { editUser($_POST); } } // ============================================================================ // Main after POST // ============================================================================ if ($Login->role() !== 'admin') { $layout['parameters'] = $Login->username(); } $_User = $dbUsers->getUser($layout['parameters']); // If the user doesn't exist, redirect to the users list. if ($_User === false) { Redirect::page('admin', 'users'); }
function displayDelUser($config) { if ($config->adminLvl >= 75) { $error = ''; if (isset($_POST['removeBtn'])) { // Get user input $username = isset($_POST['user_to_Delete']) ? $_POST['user_to_Delete'] : ''; $error = delUser($username); } if (isset($_POST['disableBtn'])) { // Get user input $username = isset($_POST['user_to_Delete']) ? $_POST['user_to_Delete'] : ''; $userID = getUserID($config, $username); $error = disableUser($config, $userID); } if (!isset($_POST['submitBtn']) || $error != '') { ?> <a href="<?php echo $_SERVER['PHP_SELF']; ?> ?usermenu=true">Back</a> <form action="<?php echo $_SERVER['REQUEST_URI']; ?> ?DelUserBtn=true" method="post" name="delform"> <table width="100%"><?php echo '<tr><td align="center"><select name="user_to_Delete">'; showAllUsers(); echo '</select>'; ?> </td></tr> <tr><td colspan="2" align="center"><input class="text" type="submit" name="removeBtn" value="Delete User" /> <input class="text" type="submit" name="disableBtn" value="Disable User" /></td></tr> </table> </form> <?php } if (isset($_POST['removeBtn']) || isset($_POST['disableBtn'])) { if (isset($_POST['disableBtn'])) { echo '<h2>Disable Results</h2>'; } else { echo '<h2>Deletion result:</h2>'; } ?> <div id="icon2"> </div> <div id="result"> <table width="100%"><tr><td><br/> <?php echo $error; ?> <br/><br/><br/></td></tr> </table> </div> <?php } } }
function provisionUser($dbSocket, $txnId, $txn_id) { include 'library/config_read.php'; // find the pin code to activate using the pin $sql = "SELECT username," . $configValues['CONFIG_DB_TBL_DALOBILLINGMERCHANT'] . ".planId," . $configValues['CONFIG_DB_TBL_DALOBILLINGPLANS'] . ".planName, " . $configValues['CONFIG_DB_TBL_DALOBILLINGPLANS'] . ".id, txn_type,payment_status,payment_date,payment_cost FROM " . $configValues['CONFIG_DB_TBL_DALOBILLINGMERCHANT'] . " LEFT JOIN " . $configValues['CONFIG_DB_TBL_DALOBILLINGPLANS'] . " ON " . $configValues['CONFIG_DB_TBL_DALOBILLINGMERCHANT'] . ".planId=" . $configValues['CONFIG_DB_TBL_DALOBILLINGPLANS'] . ".id " . " WHERE txnId='{$txnId}' AND txn_id='{$txn_id}' ORDER BY " . $configValues['CONFIG_DB_TBL_DALOBILLINGMERCHANT'] . ".id DESC LIMIT 1"; $res = $dbSocket->query($sql); $row = $res->fetchRow(DB_FETCHMODE_ASSOC); $data['pin'] = $row['username']; $data['planId'] = $row['planId']; $data['planName'] = $row['planName']; $data['txn_type'] = $row['txn_type']; $data['payment_status'] = $row['payment_status']; $data['payment_date'] = $row['payment_date']; $data['payment_cost'] = $row['payment_cost']; switch ($data['txn_type']) { case "web_accept": if ($data['payment_status'] == "Completed") { enableUser($dbSocket, $data); } // update a new billing record updateBilling($dbSocket, $data); break; // Subscription started // Subscription started case "subscr_signup": // a signup from paypal is always followed by a subscr_payment for // a payment to be made enableUser($dbSocket, $data); break; // Subscription canceled // Subscription canceled case "subscr_cancel": // a user is canceled for whatever reason, when that happens, paypal // sends a notice disableUser($dbSocket, $data); break; // Subscription expired // Subscription expired case "subscr_eot": break; // Subscription signup failed // Subscription signup failed case "subscr_failed": break; // Subscription modified // Subscription modified case "subscr_modify": break; // Subscription payment received // Subscription payment received case "subscr_payment": updateBilling($dbSocket, $data); break; // Recurring payment received // Recurring payment received case "recurring_payment": break; default: break; } }