]> git.mxchange.org Git - mailer.git/commitdiff
Primera fixed, primera/wernis extensions now use SUB_POINTS()
authorRoland Häder <roland@mxchange.org>
Sat, 13 Sep 2008 16:03:47 +0000 (16:03 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 13 Sep 2008 16:03:47 +0000 (16:03 +0000)
inc/databases.php
inc/modules/member/what-primera.php
inc/modules/member/what-wernis.php

index 424bd8c5a633a86bb107abdc391472ed37a1bbf8..76acbfc656c55441cb07e461a28d4ea6a9d60189 100644 (file)
@@ -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);
index d17f48551787fadd84a532b81d40d065ec2d8e19..78f68da347cf6dce7b6b159e2a009d84ab2caacf 100644 (file)
@@ -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("<br />");
                        } 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("<br />");
                        } elseif (empty($_POST['amount'])) {
                                // Nothing entered in amount
                                LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_EMPTY_AMOUNT);
                                OUTPUT_HTML("<br />");
-                       } 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("<br />");
                        } 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);
index ca832333d9e8352bccfe8f406c741a5b85b5db6b..5edf6ac7a63150580d7e1a47c9bf60ce46649fce 100644 (file)
@@ -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);