-if ((isset($_POST['ok'])) && (isset($_GET['mode']))) {
- // Check input data depending on the mode and execute the requested mode
- switch ($_GET['mode']) {
- case "withdraw": // Widthdraws WDS66 -> This exchange
- // Is the user ID and password set?
- if (empty($_POST['wds66_id'])) {
- // Nothing entered in WDS66 user ID
- LOAD_TEMPLATE("admin_settings_saved", false, WERNIS_MEMBER_EMPTY_USERNAME);
- OUTPUT_HTML("<br />");
- } elseif (empty($_POST['wds66_password'])) {
- // Nothing entered in WDS66 password
- LOAD_TEMPLATE("admin_settings_saved", false, WERNIS_MEMBER_EMPTY_PASSWORD);
- OUTPUT_HTML("<br />");
- } elseif (empty($_POST['amount'])) {
- // Nothing entered in amount
- LOAD_TEMPLATE("admin_settings_saved", false, WERNIS_MEMBER_EMPTY_AMOUNT);
- OUTPUT_HTML("<br />");
- } elseif ($_POST['wds66_id'] != bigintval($_POST['wds66_id'])) {
- // Only numbers in account ID!
- LOAD_TEMPLATE("admin_settings_saved", false, WERNIS_MEMBER_INVALID_USERNAME);
- OUTPUT_HTML("<br />");
- } elseif ($_POST['amount'] != bigintval($_POST['amount'])) {
- // Only numbers in amount!
- LOAD_TEMPLATE("admin_settings_saved", false, WERNIS_MEMBER_INVALID_AMOUNT);
- OUTPUT_HTML("<br />");
- } elseif ($_POST['amount'] < $_CONFIG['wernis_min_widthdraw']) {
- // Not enougth entered!
- LOAD_TEMPLATE("admin_settings_saved", false, sprintf(WERNIS_MEMBER_AMOUNT_SMALLER_MIN, bigintval($_CONFIG['wernis_min_withdraw'])));
- OUTPUT_HTML("<br />");
- } else {
- // All is fine here so do the withdraw
- $success = WERNIS_EXECUTE_WITHDRAW($_POST['wds66_id'], md5($_POST['wds66_password']), $_POST['amount']);
- if ($success) {
- // Default is locked!
- $locked = true;
-
- // Shall I "pay" the referral points imidiately?
- if ($_CONFIG['ref_payout'] == "0") {
- // Yes, "pay" it now
- $locked = false;
- }
-
- // Add it to this amount
- $DEPTH = 0;
- ADD_POINTS_REFSYSTEM($GLOBALS['userid'], bigintval($_POST['amount']), false, 0, $locked, "direct");
-
- // Register this wernis movement
- $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_wernis (`userid`, `wernis_account`, `wernis_amount`, `wernis_timestamp`, `wernis_type`) VALUES(%d, %d, %d, UNIX_TIMESTAMP(), 'IN')",
- array($GLOBALS['userid'], bigintval($_POST['wds66_id']), bigintval($_POST['amount'])), __FILE__, __LINE__);
-
- // Update the user data as well..
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET `wernis_userid`=%d WHERE userid=%d LIMIT 1",
- array(bigintval($_POST['wds66_id']), $GLOBALS['userid']), __FILE__, __LINE__);
-
- // All done!
- LOAD_TEMPLATE("admin_settings_saved", false, WERNIS_MEMBER_WITHDRAW_DONE);
- return;
- } elseif ((GET_WERNIS_ERROR_CODE() == "user_failed") || (GET_WERNIS_ERROR_CODE() == "own_failed") || (GET_WERNIS_ERROR_CODE() == "amount_failed")) {
- // Wrong login data
- LOAD_TEMPLATE("admin_settings_saved", false, GET_WERNIS_ERROR_MESSAGE());
- OUTPUT_HTML("<br />");
+if ((isFormSent()) && (isGetRequestElementSet('mode'))) {
+ // Is the user ID and password set?
+ if (!isPostRequestElementSet(('wds66_id'))) {
+ // Nothing entered in WDS66 user ID
+ loadTemplate('admin_settings_saved', false, getMessage('WERNIS_MEMBER_EMPTY_USERNAME'));
+ } elseif (!isPostRequestElementSet(('wds66_password'))) {
+ // Nothing entered in WDS66 password
+ loadTemplate('admin_settings_saved', false, getMessage('WERNIS_MEMBER_EMPTY_PASSWORD'));
+ } elseif (!isPostRequestElementSet(('amount'))) {
+ // Nothing entered in amount
+ loadTemplate('admin_settings_saved', false, getMessage('WERNIS_MEMBER_EMPTY_AMOUNT'));
+ } elseif (postRequestElement('wds66_id') != bigintval(postRequestElement('wds66_id'))) {
+ // Only numbers in account ID!
+ loadTemplate('admin_settings_saved', false, getMessage('WERNIS_MEMBER_INVALID_USERNAME'));
+ } elseif (postRequestElement('amount') != bigintval(postRequestElement('amount'))) {
+ // Only numbers in amount!
+ loadTemplate('admin_settings_saved', false, getMessage('WERNIS_MEMBER_INVALID_AMOUNT'));
+ } else {
+ // Check input data depending on the mode and execute the requested mode
+ switch (getRequestElement('mode')) {
+ case 'withdraw': // Widthdraws WDS66 -> This exchange
+ if (postRequestElement('amount') < getConfig('wernis_min_withdraw')) {
+ // Not enougth entered!
+ loadTemplate('admin_settings_saved', false, sprintf(getMessage('WERNIS_MEMBER_AMOUNT_SMALLER_MIN'), translateComma(getConfig('wernis_min_withdraw'))));