- // Check input data depending on the mode and execute the requested mode
- switch ($_GET['mode']) {
- case "pay": // Payout this exchange -> WDS66
- // 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_payout']) {
- // Not enougth entered!
- LOAD_TEMPLATE("admin_settings_saved", false, sprintf(WERNIS_MEMBER_AMOUNT_SMALLER_MIN, bigintval($_CONFIG['wernis_min_payout'])));
- OUTPUT_HTML("<br />");
- } elseif ($_POST['amount'] > $points) {
- // Not enougth points left!
- LOAD_TEMPLATE("admin_settings_saved", false, sprintf(WERNIS_MEMBER_PAYOUT_POINTS_DEPLETED, bigintval($_POST['amount']), bigintval($points)));
- OUTPUT_HTML("<br />");
- } else {
- // All is fine here so do the payout
- $success = WERNIS_EXECUTE_PAYOUT($_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;
- }
+ // 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 />");
+ } else {
+ // Check input data depending on the mode and execute the requested mode
+ switch ($_GET['mode']) {
+ case "withdraw": // Widthdraws WDS66 -> This exchange
+ if ($_POST['amount'] < getConfig('wernis_min_withdraw')) {
+ // Not enougth entered!
+ LOAD_TEMPLATE("admin_settings_saved", false, sprintf(WERNIS_MEMBER_AMOUNT_SMALLER_MIN, bigintval(getConfig('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) {
+ // Add it to this amount
+ unset($DEPTH);
+ ADD_POINTS_REFSYSTEM("wernis_withdraw", $GLOBALS['userid'], bigintval($_POST['amount']), false, 0, false, "direct");
+
+ // Update the user data as well..
+ $result = SQL_QUERY_ESC("UPDATE `"._MYSQL_PREFIX."_user_data` SET `wernis_userid`=%s WHERE userid=%s LIMIT 1",
+ array(bigintval($_POST['wds66_id']), $GLOBALS['userid']), __FILE__, __LINE__);