Variable rewritten to ['ref_level'] to avoid trouble with referal system
authorRoland Häder <roland@mxchange.org>
Fri, 19 Dec 2008 16:37:39 +0000 (16:37 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 19 Dec 2008 16:37:39 +0000 (16:37 +0000)
birthday_confirm.php
inc/databases.php
inc/libs/beg_functions.php
inc/libs/refback_functions.php
inc/modules/admin/admin-inc.php
inc/modules/admin/what-add_points.php
inc/modules/guest/what-confirm.php
inc/modules/member/what-wernis.php
inc/mysql-manager.php
mailid_top.php

index a29859a8d6a348a582cd728c180a6ef39d8e4e3c..69530f99f06390558687a38c93831ba015030da6 100644 (file)
@@ -79,12 +79,12 @@ WHERE b.userid=%s AND b.chk_value='%s' LIMIT 1",
                        if (($data['ref_payout'] > 0) && (getConfig('allow_direct_pay') == "N")) $locked = true;
 
                        // Add points to account
                        if (($data['ref_payout'] > 0) && (getConfig('allow_direct_pay') == "N")) $locked = true;
 
                        // Add points to account
-                       unset($DEPTH);
+                       unset($GLOBALS['ref_level']);
                        ADD_POINTS_REFSYSTEM("birthday_confirm", $uid, $data['points'], false, "0", $locked, strtolower(getConfig('birthday_mode')));
 
                        // Remove entry from table
                        $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_birthday WHERE userid=%s AND chk_value='%s' LIMIT 1",
                        ADD_POINTS_REFSYSTEM("birthday_confirm", $uid, $data['points'], false, "0", $locked, strtolower(getConfig('birthday_mode')));
 
                        // Remove entry from table
                        $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_birthday WHERE userid=%s AND chk_value='%s' LIMIT 1",
-                        array($uid, $chk), __FILE__, __LINE__);
+                               array($uid, $chk), __FILE__, __LINE__);
 
                        // Update mediadata if version is 0.0.4 or newer
                        if (GET_EXT_VERSION("mediadata") >= "0.0.4") {
 
                        // Update mediadata if version is 0.0.4 or newer
                        if (GET_EXT_VERSION("mediadata") >= "0.0.4") {
index f0e384bf4fb97773144b2570e584803ddcbc9f8f..c348b3e7dff4cafef31c69cd9673d721e9222d2e 100644 (file)
@@ -115,7 +115,7 @@ define('USAGE_BASE', "usage");
 define('SERVER_URL', "http://www.mxchange.org");
 
 // Current SVN revision
 define('SERVER_URL', "http://www.mxchange.org");
 
 // Current SVN revision
-define('CURR_SVN_REVISION', "662");
+define('CURR_SVN_REVISION', "663");
 
 // Take a prime number which is long (if you know a longer one please try it out!)
 define('_PRIME', 591623);
 
 // Take a prime number which is long (if you know a longer one please try it out!)
 define('_PRIME', 591623);
index 04db5702d15d147ac96b41750fd3a46766c18a23..7eeb42072aee47488c02c9db1c4a48490499689d 100644 (file)
@@ -52,7 +52,7 @@ function BEG_ADD_POINTS ($uid, $points) {
                        array($points, $uid), __FILE__, __LINE__);
        } else {
                // Add points to account
                        array($points, $uid), __FILE__, __LINE__);
        } else {
                // Add points to account
-               unset($DEPTH);
+               unset($GLOBALS['ref_level']);
                ADD_POINTS_REFSYSTEM("beg", $uid, $points, false, "0", $locked, strtolower(getConfig('beg_mode')));
        }
 
                ADD_POINTS_REFSYSTEM("beg", $uid, $points, false, "0", $locked, strtolower(getConfig('beg_mode')));
        }
 
index 85722cdad7cc8fbc1946ce543e46154ea480a357..cd8d0fb4de53ae16d9a2ebdc048185a10cefc779 100644 (file)
@@ -40,10 +40,10 @@ if (!defined('__SECURITY')) {
 // Payback refback for refid and reduce it for current user
 function ADD_REFBACK_POINTS ($uid, $ref, $points, $ref_points) {
        //* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
 // Payback refback for refid and reduce it for current user
 function ADD_REFBACK_POINTS ($uid, $ref, $points, $ref_points) {
        //* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
-       global $DEPTH, $cacheArray;
+       global $cacheArray;
 
        // Back ref depths
 
        // Back ref depths
-       $cacheArray['depth'][$uid][$ref] = $DEPTH
+       $cacheArray['depth'][$uid][$ref] = $GLOBALS['ref_level']
 
        // Init points
        $return = $points;
 
        // Init points
        $return = $points;
@@ -54,7 +54,7 @@ function ADD_REFBACK_POINTS ($uid, $ref, $points, $ref_points) {
        // "Walk" through all level
        while (list($level, $perc) = SQL_FETCHROW($result_refs)) {
                // Reset ref depths
        // "Walk" through all level
        while (list($level, $perc) = SQL_FETCHROW($result_refs)) {
                // Reset ref depths
-               unset($DEPTH);
+               unset($GLOBALS['ref_level']);
 
                // "Walk" through all refids
                //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},ref={$ref},level={$level},points={$points}<br />\n";
 
                // "Walk" through all refids
                //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},ref={$ref},level={$level},points={$points}<br />\n";
@@ -95,7 +95,7 @@ function ADD_REFBACK_POINTS ($uid, $ref, $points, $ref_points) {
        SQL_FREERESULT($result_refs);
 
        // Restore ref depth
        SQL_FREERESULT($result_refs);
 
        // Restore ref depth
-       $DEPTH = $cacheArray['depth'][$uid][$ref];
+       $GLOBALS['ref_level'] = $cacheArray['depth'][$uid][$ref];
 
        // Return them
        //* DEBUG: */ print "</li></ul>----------------------- <font color=\"#aa0000\">".__FUNCTION__." - EXIT</font> ------------------------<br />\n";
 
        // Return them
        //* DEBUG: */ print "</li></ul>----------------------- <font color=\"#aa0000\">".__FUNCTION__." - EXIT</font> ------------------------<br />\n";
index 4937318b2e01cf8bf8436101012f3bd053140bf2..1c30a49649e7d66e39f2f7f5fe2a8e8fd7f99c36 100644 (file)
@@ -303,7 +303,7 @@ function admin_WriteData ($file, $comment, $prefix, $suffix, $DATA, $seek=0) {
 
 //
 function ADMIN_DO_ACTION($wht) {
 
 //
 function ADMIN_DO_ACTION($wht) {
-       global $menuDesription, $menuTitle, $_CONFIG, $cacheArray, $DATA, $DEPTH;
+       global $menuDesription, $menuTitle, $_CONFIG, $cacheArray, $DATA;
 
        //* DEBUG: */ echo __LINE__."*".$wht."/".$GLOBALS['module']."/".$GLOBALS['action']."/".$GLOBALS['what']."*<br />\n";
        if (EXT_IS_ACTIVE("cache")) {
 
        //* DEBUG: */ echo __LINE__."*".$wht."/".$GLOBALS['module']."/".$GLOBALS['action']."/".$GLOBALS['what']."*<br />\n";
        if (EXT_IS_ACTIVE("cache")) {
index 97c5c157b038079f99f54ab14062f44c449e4a08..f96c1e1dc394cd70d5e116533438f6bb33c9327b 100644 (file)
@@ -49,36 +49,24 @@ if ($_GET['u_id'] == "all") {
                define('__POINTS_VALUE', $_POST['points']);
                $result_main = SQL_QUERY("SELECT userid FROM `"._MYSQL_PREFIX."_user_data` WHERE status='CONFIRMED' ORDER BY userid", __FILE__, __LINE__);
                while (list($uid) = SQL_FETCHROW($result_main)) {
                define('__POINTS_VALUE', $_POST['points']);
                $result_main = SQL_QUERY("SELECT userid FROM `"._MYSQL_PREFIX."_user_data` WHERE status='CONFIRMED' ORDER BY userid", __FILE__, __LINE__);
                while (list($uid) = SQL_FETCHROW($result_main)) {
-                       // User ID found in URL so we use this give him some credits
-                       $result = SQL_QUERY_ESC("SELECT surname, family, email FROM `"._MYSQL_PREFIX."_user_data` WHERE userid=%s AND status='CONFIRMED' LIMIT 1",
-                               array(bigintval($uid)), __FILE__, __LINE__);
-                       if (SQL_NUMROWS($result) == 1) {
-                               // Selected user does exist
-                               list($sname, $fname, $email) = SQL_FETCHROW($result);
-                               SQL_FREERESULT($result);
-
-                               if ((isset($_POST['ok'])) && (!empty($_POST['points']))) {
-                                       global $DEPTH;
-                                       // Remove depth to prevent booking errors. This is a bad coding
-                                       // practice, thats also why we need to write this project from
-                                       // scratch...
-                                       unset($DEPTH);
+                       // Remove depth to prevent booking errors. This is a bad coding
+                       // practice, thats also why we need to write this project from
+                       // scratch...
+                       $GLOBALS['ref_level'] = -1;
 
 
-                                       // Ok, add points and send an email to him...
-                                       ADD_POINTS_REFSYSTEM("admin_all", $uid, bigintval($_POST['points']), false, "0", false, "direct");
+                       // Ok, add points and send an email to him...
+                       ADD_POINTS_REFSYSTEM("admin_all", $uid, bigintval($_POST['points']), false, "0", false, "direct");
 
 
-                                       // Prepare content
-                                       $content = array(
-                                               'text'   => SQL_ESCAPE($_POST['reason']),
-                                               'points' => bigintval($_POST['points'])
-                                       );
+                       // Prepare content
+                       $content = array(
+                               'text'   => SQL_ESCAPE($_POST['reason']),
+                               'points' => bigintval($_POST['points'])
+                       );
 
 
-                                       // Load email template and send email away
-                                       $msg = LOAD_EMAIL_TEMPLATE("add-points", $content, bigintval($uid));
-                                       SEND_EMAIL(bigintval($uid), ADMIN_ADD_SUBJ, $msg);
-                               }
-                       }
-               }
+                       // Load email template and send email away
+                       $msg = LOAD_EMAIL_TEMPLATE("add-points", $content, bigintval($uid));
+                       SEND_EMAIL(bigintval($uid), ADMIN_ADD_SUBJ, $msg);
+               } // END - while
 
                // Free memory
                SQL_FREERESULT($result_main);
 
                // Free memory
                SQL_FREERESULT($result_main);
@@ -99,11 +87,10 @@ if ($_GET['u_id'] == "all") {
                SQL_FREERESULT($result);
 
                if ((isset($_POST['ok'])) && (!empty($_POST['points']))) {
                SQL_FREERESULT($result);
 
                if ((isset($_POST['ok'])) && (!empty($_POST['points']))) {
-                       global $DEPTH;
                        // Remove depth to prevent booking errors. This is a bad coding
                        // practice, thats also why we need to write this project from
                        // scratch...
                        // Remove depth to prevent booking errors. This is a bad coding
                        // practice, thats also why we need to write this project from
                        // scratch...
-                       unset($DEPTH);
+                       unset($GLOBALS['ref_level']);
 
                        // Ok, add points and send an email to him...
                        ADD_POINTS_REFSYSTEM("admin_single", bigintval($_GET['u_id']), bigintval($_POST['points']), false, "0", false, "direct");
 
                        // Ok, add points and send an email to him...
                        ADD_POINTS_REFSYSTEM("admin_single", bigintval($_GET['u_id']), bigintval($_POST['points']), false, "0", false, "direct");
index 6f5a7cbe9dc9c9c3c86d5d4f80c76902c0a594aa..902efb8165af2d4eae30f3baf530e5c37305c798 100644 (file)
@@ -70,7 +70,7 @@ if (!empty($_GET['hash'])) {
                                        UPDATE_REF_COUNTER($rid);
 
                                        // Ok, write the ref-points to this user and his parent-ref
                                        UPDATE_REF_COUNTER($rid);
 
                                        // Ok, write the ref-points to this user and his parent-ref
-                                       unset($DEPTH);
+                                       unset($GLOBALS['ref_level']);
 
                                        // Shall I "pay" the referal points imidiately?
                                        if (getConfig('ref_payout') == "0") {
 
                                        // Shall I "pay" the referal points imidiately?
                                        if (getConfig('ref_payout') == "0") {
@@ -92,7 +92,7 @@ if (!empty($_GET['hash'])) {
                                        } // END - if
 
                                        // Add one-time referal bonus over referal system or directly
                                        } // END - if
 
                                        // Add one-time referal bonus over referal system or directly
-                                       unset($DEPTH);
+                                       unset($GLOBALS['ref_level']);
                                        ADD_POINTS_REFSYSTEM("referal_bonus", $rid, getConfig('points_ref'), true, bigintval($uid), $locked, getConfig('reg_points_mode'));
                                } // END - if
                        } // END - if
                                        ADD_POINTS_REFSYSTEM("referal_bonus", $rid, getConfig('points_ref'), true, bigintval($uid), $locked, getConfig('reg_points_mode'));
                                } // END - if
                        } // END - if
index ae45f45c00107ffd57c66f389f8d2bad82f9b2d6..1773a61282e6101235036f8dd64ca53e9f6387cb 100644 (file)
@@ -231,7 +231,7 @@ if ((isset($_POST['ok'])) && (isset($_GET['mode']))) {
                                        $success = WERNIS_EXECUTE_WITHDRAW($_POST['wds66_id'], md5($_POST['wds66_password']), $_POST['amount']);
                                        if ($success) {
                                                // Add it to this amount
                                        $success = WERNIS_EXECUTE_WITHDRAW($_POST['wds66_id'], md5($_POST['wds66_password']), $_POST['amount']);
                                        if ($success) {
                                                // Add it to this amount
-                                               unset($DEPTH);
+                                               unset($GLOBALS['ref_level']);
                                                ADD_POINTS_REFSYSTEM("wernis_withdraw", $GLOBALS['userid'], bigintval($_POST['amount']), false, 0, false, "direct");
 
                                                // Update the user data as well..
                                                ADD_POINTS_REFSYSTEM("wernis_withdraw", $GLOBALS['userid'], bigintval($_POST['amount']), false, 0, false, "direct");
 
                                                // Update the user data as well..
index 4544a12929f4df7a27f14bcc6ff2908bc2c408c5..1f261f4f3b656668aa1804431fe3b54eabfc798b 100644 (file)
@@ -1106,8 +1106,8 @@ function GET_REF_LEVEL_PERCENTS ($level) {
  *               for default value will cause no referal will get points ever!!!)
  */
 function ADD_POINTS_REFSYSTEM ($subject, $uid, $points, $send_notify=false, $rid="0", $locked=false, $add_mode="ref") {
  *               for default value will cause no referal will get points ever!!!)
  */
 function ADD_POINTS_REFSYSTEM ($subject, $uid, $points, $send_notify=false, $rid="0", $locked=false, $add_mode="ref") {
-       //* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
-       global $DEPTH, $_CONFIG, $DATA, $cacheArray;
+       /* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
+       global $_CONFIG, $DATA, $cacheArray;
 
        // Convert mode to lower-case
        $add_mode = strtolower($add_mode);
 
        // Convert mode to lower-case
        $add_mode = strtolower($add_mode);
@@ -1126,14 +1126,14 @@ function ADD_POINTS_REFSYSTEM ($subject, $uid, $points, $send_notify=false, $rid
        } // END - if
 
        // Count up referal depth
        } // END - if
 
        // Count up referal depth
-       if (!isset($DEPTH)) {
+       if (!isset($GLOBALS['ref_level'])) {
                // Initialialize referal system
                // Initialialize referal system
-               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): Referal system initialized!<br />\n";
-               $DEPTH = 0;
+               /* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): Referal system initialized!<br />\n";
+               $GLOBALS['ref_level'] = 0;
        } else {
                // Increase referal level
        } else {
                // Increase referal level
-               $DEPTH++;
-               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): Referal level increased. DEPTH={$DEPTH}<br />\n";
+               $GLOBALS['ref_level']++;
+               /* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): Referal level increased. DEPTH={$GLOBALS['ref_level']}<br />\n";
        }
 
        // Default is "normal" points
        }
 
        // Default is "normal" points
@@ -1146,39 +1146,39 @@ function ADD_POINTS_REFSYSTEM ($subject, $uid, $points, $send_notify=false, $rid
        $result_user = SQL_QUERY_ESC("SELECT refid, email FROM `"._MYSQL_PREFIX."_user_data` WHERE userid=%s AND status='CONFIRMED' LIMIT 1",
         array(bigintval($uid)), __FILE__, __LINE__);
 
        $result_user = SQL_QUERY_ESC("SELECT refid, email FROM `"._MYSQL_PREFIX."_user_data` WHERE userid=%s AND status='CONFIRMED' LIMIT 1",
         array(bigintval($uid)), __FILE__, __LINE__);
 
-       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},numRows=".SQL_NUMROWS($result_user).",points={$points}<br />\n";
+       /* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},numRows=".SQL_NUMROWS($result_user).",points={$points}<br />\n";
        if (SQL_NUMROWS($result_user) == 1) {
                // This is the user and his ref
                list($ref, $email) = SQL_FETCHROW($result_user);
                $cacheArray['add_uid'][$ref] = $uid;
 
                // Get percents
        if (SQL_NUMROWS($result_user) == 1) {
                // This is the user and his ref
                list($ref, $email) = SQL_FETCHROW($result_user);
                $cacheArray['add_uid'][$ref] = $uid;
 
                // Get percents
-               $per = GET_REF_LEVEL_PERCENTS($DEPTH);
-               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},points={$points},depth={$DEPTH},per={$per},mode={$add_mode}<br />\n";
+               $per = GET_REF_LEVEL_PERCENTS($GLOBALS['ref_level']);
+               /* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},points={$points},depth={$GLOBALS['ref_level']},per={$per},mode={$add_mode}<br />\n";
 
                // Some percents found?
                if ($per > 0) {
                        // Calculate new points
 
                // Some percents found?
                if ($per > 0) {
                        // Calculate new points
-                       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},points={$points},per={$per},depth={$DEPTH}<br />\n";
+                       /* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},points={$points},per={$per},depth={$GLOBALS['ref_level']}<br />\n";
                        $ref_points = $points * $per / 100;
 
                        // Pay refback here if level > 0 and in ref-mode
                        $ref_points = $points * $per / 100;
 
                        // Pay refback here if level > 0 and in ref-mode
-                       if ((EXT_IS_ACTIVE("refback")) && ($DEPTH > 0) && ($per < 100) && ($add_mode == "ref") && (isset($cacheArray['add_uid'][$uid]))) {
-                               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},data={$cacheArray['add_uid'][$uid]},ref_points={$ref_points},depth={$DEPTH} - BEFORE!<br />\n";
+                       if ((EXT_IS_ACTIVE("refback")) && ($GLOBALS['ref_level'] > 0) && ($per < 100) && ($add_mode == "ref") && (isset($cacheArray['add_uid'][$uid]))) {
+                               /* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},data={$cacheArray['add_uid'][$uid]},ref_points={$ref_points},depth={$GLOBALS['ref_level']} - BEFORE!<br />\n";
                                $ref_points = ADD_REFBACK_POINTS($cacheArray['add_uid'][$uid], $uid, $points, $ref_points);
                                $ref_points = ADD_REFBACK_POINTS($cacheArray['add_uid'][$uid], $uid, $points, $ref_points);
-                               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},data={$cacheArray['add_uid'][$uid]},ref_points={$ref_points},depth={$DEPTH} - AFTER!<br />\n";
+                               /* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},data={$cacheArray['add_uid'][$uid]},ref_points={$ref_points},depth={$GLOBALS['ref_level']} - AFTER!<br />\n";
                        } // END - if
 
                        // Update points...
                        SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_points SET %s=%s+%s WHERE userid=%s AND ref_depth='%s' LIMIT 1",
                        } // END - if
 
                        // Update points...
                        SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_points SET %s=%s+%s WHERE userid=%s AND ref_depth='%s' LIMIT 1",
-                        array($data, $data, $ref_points, bigintval($uid), bigintval($DEPTH)), __FILE__, __LINE__);
-                       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):data={$data},ref_points={$ref_points},uid={$uid},depth={$DEPTH},mode={$add_mode} - UPDATE! (".SQL_AFFECTEDROWS().")<br />\n";
+                        array($data, $data, $ref_points, bigintval($uid), bigintval($GLOBALS['ref_level'])), __FILE__, __LINE__);
+                       /* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):data={$data},ref_points={$ref_points},uid={$uid},depth={$GLOBALS['ref_level']},mode={$add_mode} - UPDATE! (".SQL_AFFECTEDROWS().")<br />\n";
 
                        // No entry updated?
                        if (SQL_AFFECTEDROWS() < 1) {
                                // First ref in this level! :-)
                                $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_points (userid,ref_depth,%s) VALUES (%s,%s,%s)",
 
                        // No entry updated?
                        if (SQL_AFFECTEDROWS() < 1) {
                                // First ref in this level! :-)
                                $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_points (userid,ref_depth,%s) VALUES (%s,%s,%s)",
-                                array($data, bigintval($uid), bigintval($DEPTH), $ref_points), __FILE__, __LINE__);
+                                array($data, bigintval($uid), bigintval($GLOBALS['ref_level']), $ref_points), __FILE__, __LINE__);
                        } // END - if
 
                        // Update mediadata as well
                        } // END - if
 
                        // Update mediadata as well
@@ -1192,7 +1192,7 @@ function ADD_POINTS_REFSYSTEM ($subject, $uid, $points, $send_notify=false, $rid
                                // Prepare content
                                $content = array(
                                        'percent' => $per,
                                // Prepare content
                                $content = array(
                                        'percent' => $per,
-                                       'level'   => bigintval($DEPTH),
+                                       'level'   => bigintval($GLOBALS['ref_level']),
                                        'points'  => $ref_points,
                                        'refid'   => bigintval($ref)
                                );
                                        'points'  => $ref_points,
                                        'refid'   => bigintval($ref)
                                );
@@ -1222,15 +1222,15 @@ function ADD_POINTS_REFSYSTEM ($subject, $uid, $points, $send_notify=false, $rid
                        // Maybe there's another ref?
                        if (($ref > 0) && ($points > 0) && ($ref != $uid) && ($add_mode == "ref")) {
                                // Then let's credit him here...
                        // Maybe there's another ref?
                        if (($ref > 0) && ($points > 0) && ($ref != $uid) && ($add_mode == "ref")) {
                                // Then let's credit him here...
-                               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},ref={$ref},points={$points} - ADVANCE!<br />\n";
-                               ADD_POINTS_REFSYSTEM(sprintf("%s_ref:%s", $subject, $DEPTH), $ref, $points, $send_notify, $ref, $locked);
+                               /* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},ref={$ref},points={$points} - ADVANCE!<br />\n";
+                               ADD_POINTS_REFSYSTEM(sprintf("%s_ref:%s", $subject, $GLOBALS['ref_level']), $ref, $points, $send_notify, $ref, $locked);
                        } // END - if
                } // END - if
        } // END - if
 
        // Free result
        SQL_FREERESULT($result_user);
                        } // END - if
                } // END - if
        } // END - if
 
        // Free result
        SQL_FREERESULT($result_user);
-       //* DEBUG: */ print "</li></ul>----------------------- <font color=\"#aa0000\">".__FUNCTION__." - EXIT</font> ------------------------<br />\n";
+       /* DEBUG: */ print "</li></ul>----------------------- <font color=\"#aa0000\">".__FUNCTION__." - EXIT</font> ------------------------<br />\n";
 }
 //
 function UPDATE_REF_COUNTER ($uid) {
 }
 //
 function UPDATE_REF_COUNTER ($uid) {
@@ -1562,7 +1562,7 @@ WHERE p.userid=%s", array(bigintval($uid)), __FILE__, __LINE__);
 }
 //
 function META_DESCRIPTION ($mod, $wht) {
 }
 //
 function META_DESCRIPTION ($mod, $wht) {
-       global $_CONFIG, $DEPTH;
+       global $_CONFIG;
 
        // Exclude admin and member's area
        if (($mod != "admin") && ($mod != "login")) {
 
        // Exclude admin and member's area
        if (($mod != "admin") && ($mod != "login")) {
@@ -1574,7 +1574,7 @@ function META_DESCRIPTION ($mod, $wht) {
        } // END - if
 
        // Remove depth
        } // END - if
 
        // Remove depth
-       unset($DEPTH);
+       unset($GLOBALS['ref_level']);
 }
 //
 function ADD_JACKPOT($points) {
 }
 //
 function ADD_JACKPOT($points) {
index 344bed250c87cda81517f7b8dfea14e021c29cae..f95e1af07d11824348beabf49b6075cd91e25cdd 100644 (file)
@@ -236,7 +236,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
                                                                                        array($url_uid), __FILE__, __LINE__);
 
                                                                                // Add points
                                                                                        array($url_uid), __FILE__, __LINE__);
 
                                                                                // Add points
-                                                                               unset($DEPTH);
+                                                                               unset($GLOBALS['ref_level']);
                                                                                ADD_POINTS_REFSYSTEM("mailid_okay", $url_uid, $payment, false, "0", $locked);
 
                                                                                // Shall I add bonus points for "turbo clickers" ?
                                                                                ADD_POINTS_REFSYSTEM("mailid_okay", $url_uid, $payment, false, "0", $locked);
 
                                                                                // Shall I add bonus points for "turbo clickers" ?
@@ -268,7 +268,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
                                                                                LOAD_TEMPLATE($template);
                                                                        } else {
                                                                                // Wrong image code! So add points to sender's account
                                                                                LOAD_TEMPLATE($template);
                                                                        } else {
                                                                                // Wrong image code! So add points to sender's account
-                                                                               unset($DEPTH);
+                                                                               unset($GLOBALS['ref_level']);
                                                                                ADD_POINTS_REFSYSTEM("mailid_payback", $sender, $payment, false, 0, false, "direct");
 
                                                                                // Load template
                                                                                ADD_POINTS_REFSYSTEM("mailid_payback", $sender, $payment, false, 0, false, "direct");
 
                                                                                // Load template