define('SERVER_URL', "http://www.mxchange.org");
// This current patch level
-define('CURR_SVN_REVISION', "323");
+define('CURR_SVN_REVISION', "324");
// Take a prime number which is long (if you know a longer one please try it out!)
define('_PRIME', 591623);
// At least 10 numbers shall be secure enought!
$len = $_CONFIG['code_length'];
+ if ($len == 0) $len = $length;
if ($len == 0) $len = 10;
// Cut off requested counts of number
function SURFBAR_GENERATE_VALIDATION_CODE ($id, $salt="") {
global $_CONFIG, $SURFBAR_CACHE;
+ // @TODO Invalid salt should be refused
+ $SURFBAR_CACHE['salt'] = "INVALID";
+
+ // Get code length from config
+ $length = $_CONFIG['code_length'];
+
+ // Fix length to 10
+ if ($length == 0) $length = 10;
+
// Generate a code until the length matches
$valCode = "";
- while (strlen($valCode) != $_CONFIG['code_length']) {
+ while (strlen($valCode) != $length) {
// Is the salt set?
if (empty($salt)) {
// Generate random hashed string
}
// ... and now the validation code
- $valCode = GEN_RANDOM_CODE($_CONFIG['code_length'], sha1(SURFBAR_GET_SALT().":".$id), $GLOBALS['userid']);
+ $valCode = GEN_RANDOM_CODE($length, sha1(SURFBAR_GET_SALT().":".$id), $GLOBALS['userid']);
//DEBUG_LOG(__FUNCTION__.":valCode={$valCode}");
} // END - while