Random code generation added. This can be used for so-called cash-buster codes in...
authorRoland Häder <roland@mxchange.org>
Wed, 21 May 2008 20:00:26 +0000 (20:00 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 21 May 2008 20:00:26 +0000 (20:00 +0000)
inc/mysql-connect.php

index 813bcb6762ee73837ba309bf162b1a78d7ce19eb..cdde847e5d1f4f67b4fceb07ef058115d10f2535 100644 (file)
@@ -48,6 +48,9 @@ require_once(PATH."inc/functions.php");  // Non-database functions
 require_once(PATH."inc/extensions.php");
 require_once(PATH."inc/language.php");
 
 require_once(PATH."inc/extensions.php");
 require_once(PATH."inc/language.php");
 
+// Load "databases" aka static arrays
+require_once(PATH."inc/databases.php");     // Several hard-coded databases (arrays, constants)
+
 // Check if the user setups his MySQL stuff...
 if ((empty($MySQL['login'])) && (!isBooleanConstantAndTrue('mxchange_installing')) && (!isset($_GET['installing'])) && (isBooleanConstantAndTrue('mxchange_installed'))) {
        // No login entered and outside installation mode
 // Check if the user setups his MySQL stuff...
 if ((empty($MySQL['login'])) && (!isBooleanConstantAndTrue('mxchange_installing')) && (!isset($_GET['installing'])) && (isBooleanConstantAndTrue('mxchange_installed'))) {
        // No login entered and outside installation mode
@@ -79,9 +82,6 @@ if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndT
        }
        $EXT_CSS_FILES = array();
 
        }
        $EXT_CSS_FILES = array();
 
-       // Load "databases" aka static arrays
-       require_once(PATH."inc/databases.php");     // Several hard-coded databases (arrays, constants)
-
        if ((!empty($MySQL['host'])) && (!empty($MySQL['login'])) && (!empty($MySQL['password'])) && (!empty($MySQL['dbase']))) {
                // Connect to DB
                global $link;
        if ((!empty($MySQL['host'])) && (!empty($MySQL['login'])) && (!empty($MySQL['password'])) && (!empty($MySQL['dbase']))) {
                // Connect to DB
                global $link;
@@ -205,6 +205,13 @@ LIMIT 1", __FILE__, __LINE__);
 
                                // Free memory
                                SQL_FREERESULT($result);
 
                                // Free memory
                                SQL_FREERESULT($result);
+
+                               // Generate random number
+                               if (isset($GLOBALS['userid'])) {
+                                       define('RAND_NUMBER', GEN_RANDOM_CODE(10, mt_rand(10000,32766), $GLOBALS['userid'], ""));
+                               } else {
+                                       define('RAND_NUMBER', GEN_RANDOM_CODE(10, mt_rand(10000,32766), 0, ""));
+                               }
                        } else {
                                // Wrong database?
                                ADD_FATAL(WRONG_DB_SELECTED);
                        } else {
                                // Wrong database?
                                ADD_FATAL(WRONG_DB_SELECTED);