From 034d1df34b15827f7014343095a3572c1f581eef Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 21 May 2008 20:00:26 +0000 Subject: [PATCH] Random code generation added. This can be used for so-called cash-buster codes in banner rotations --- inc/mysql-connect.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/inc/mysql-connect.php b/inc/mysql-connect.php index 813bcb6762..cdde847e5d 100644 --- a/inc/mysql-connect.php +++ b/inc/mysql-connect.php @@ -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"); +// 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 @@ -79,9 +82,6 @@ if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndT } $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; @@ -205,6 +205,13 @@ LIMIT 1", __FILE__, __LINE__); // 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); -- 2.39.5