From bd1c7ebbcafe3833b12f782e26b2f7c4460c11f4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 23 Sep 2008 17:27:52 +0000 Subject: [PATCH] Fix for installation phase (thx to AndreasJung) --- inc/databases.php | 2 +- inc/mysql-connect.php | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/inc/databases.php b/inc/databases.php index 629140b684..f674ba049e 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -113,7 +113,7 @@ define('USAGE_BASE', "usage"); define('SERVER_URL', "http://www.mxchange.org"); // This current patch level -define('CURR_SVN_REVISION', "386"); +define('CURR_SVN_REVISION', "387"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/mysql-connect.php b/inc/mysql-connect.php index f7df593665..ccbc5ac41e 100644 --- a/inc/mysql-connect.php +++ b/inc/mysql-connect.php @@ -180,11 +180,17 @@ if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndT // Shall we activate the exchange? if ($_CONFIG['activate_xchange'] > 0) activateExchange(); - // Generate random number - if (isset($GLOBALS['userid'])) { - define('RAND_NUMBER', GEN_RANDOM_CODE(10, mt_rand(10000,32766), $GLOBALS['userid'], "")); + // Is the extension sql_patches installed and at least 0.3.6? + if (GET_EXT_VERSION("sql_patches") >= "0.3.6") { + // 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 { - define('RAND_NUMBER', GEN_RANDOM_CODE(10, mt_rand(10000,32766), 0, "")); + // Generate weak (!!!) code + define('RAND_NUMBER', mt_rand(1000000, 9999999)); } } else { // Wrong database? -- 2.30.2