From: Roland Häder Date: Sat, 13 Sep 2008 16:03:47 +0000 (+0000) Subject: Primera fixed, primera/wernis extensions now use SUB_POINTS() X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=752ebf38ef93c3b92187c5aad2c734fc5c5caf74;p=mailer.git Primera fixed, primera/wernis extensions now use SUB_POINTS() --- diff --git a/inc/databases.php b/inc/databases.php index 424bd8c5a6..76acbfc656 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -114,7 +114,7 @@ define('USAGE_BASE', "usage"); define('SERVER_URL', "http://www.mxchange.org"); // This current patch level -define('CURR_SVN_REVISION', "316"); +define('CURR_SVN_REVISION', "317"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/modules/member/what-primera.php b/inc/modules/member/what-primera.php index d17f485517..78f68da347 100644 --- a/inc/modules/member/what-primera.php +++ b/inc/modules/member/what-primera.php @@ -62,7 +62,7 @@ if (!isset($_GET['mode'])) { // Get referral id $content['refid'] = bigintval($_CONFIG['primera_refid']); - // Get WDS66 id + // Get Primus id $result = SQL_QUERY_ESC("SELECT primera_userid FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1", array($GLOBALS['userid']), __FILE__, __LINE__); @@ -91,7 +91,7 @@ if (!isset($_GET['mode'])) { $rowContent = array( 'stamp' => MAKE_DATETIME($data['primera_timestamp'], "2"), 'points' => TRANSLATE_COMMA($data['primera_amount']), - 'acc' => bigintval($data['primera_account']), + 'acc' => SQL_ESCAPE($data['primera_account']), 'status' => PRIMERA_TRANSFER_STATUS($data['primera_type']), 'raw_type' => strtolower($data['primera_type']), 'sw' => $SW, @@ -131,7 +131,7 @@ if ($_GET['mode'] == "pay") { $content['points'] = $points; $content['min_points'] = TRANSLATE_COMMA($_CONFIG['primera_min_payout']); - // Get WDS66 id + // Get Primera id $content['primus_nickname'] = ""; $result = SQL_QUERY_ESC("SELECT primera_userid FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1", array($GLOBALS['userid']), __FILE__, __LINE__); @@ -154,24 +154,20 @@ if ($_GET['mode'] == "pay") { if ((isset($_POST['ok'])) && (isset($_GET['mode']))) { // Check input data depending on the mode and execute the requested mode switch ($_GET['mode']) { - case "pay": // Payout this exchange -> WDS66 + case "pay": // Payout this exchange -> Primus // Is the user ID and password set? if (empty($_POST['primus_nickname'])) { - // Nothing entered in WDS66 user ID + // Nothing entered in Primus nickname LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_EMPTY_USERNAME); OUTPUT_HTML("
"); } elseif (empty($_POST['primera_password'])) { - // Nothing entered in WDS66 password + // Nothing entered in Primera password LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_EMPTY_PASSWORD); OUTPUT_HTML("
"); } elseif (empty($_POST['amount'])) { // Nothing entered in amount LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_EMPTY_AMOUNT); OUTPUT_HTML("
"); - } elseif ($_POST['primus_nickname'] != bigintval($_POST['primus_nickname'])) { - // Only numbers in account ID! - LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_INVALID_USERNAME); - OUTPUT_HTML("
"); } elseif ($_POST['amount'] != bigintval($_POST['amount'])) { // Only numbers in amount! LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_INVALID_AMOUNT); @@ -197,9 +193,12 @@ if ((isset($_POST['ok'])) && (isset($_GET['mode']))) { $locked = false; } // END - if - // Remove the points from the account - $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET `used_points` = `used_points` + %s, `primera_userid`=%s WHERE userid=%s LIMIT 1", - array(bigintval($_POST['amount']), bigintval($_POST['primus_nickname']), $GLOBALS['userid']), __FILE__, __LINE__); + // Remove points from account + SUB_POINTS($GLOBALS['userid'], $_POST['amount']); + + // Update primera nickname + $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET `primera_userid`=%s WHERE userid=%s LIMIT 1", + array($_POST['primus_nickname'], $GLOBALS['userid']), __FILE__, __LINE__); // All done! LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_PAYOUT_DONE); diff --git a/inc/modules/member/what-wernis.php b/inc/modules/member/what-wernis.php index ca832333d9..5edf6ac7a6 100644 --- a/inc/modules/member/what-wernis.php +++ b/inc/modules/member/what-wernis.php @@ -197,9 +197,12 @@ if ((isset($_POST['ok'])) && (isset($_GET['mode']))) { $locked = false; } - // Remove the points from the account - $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET `used_points` = `used_points` + %s, `wernis_userid`=%s WHERE userid=%s LIMIT 1", - array(bigintval($_POST['amount']), bigintval($_POST['wds66_id']), $GLOBALS['userid']), __FILE__, __LINE__); + // Sub points + SUB_POINTS($GLOBALS['userid'], $_POST['amount']); + + // Update WDS66 id + $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__); // All done! LOAD_TEMPLATE("admin_settings_saved", false, WERNIS_MEMBER_PAYOUT_DONE);