Some fixes for password scrambling.
authorRoland Haeder <roland@mxchange.org>
Fri, 18 Apr 2014 15:37:41 +0000 (17:37 +0200)
committerRoland Haeder <roland@mxchange.org>
Fri, 18 Apr 2014 15:37:41 +0000 (17:37 +0200)
Signed-off-by: Roland H├Ąder <roland@mxchange.org>
inc/functions.php

index f55c9a3..a5a92f5 100644 (file)
@@ -832,14 +832,17 @@ function scrambleString ($str) {
        if (strlen($str) > 40) {
                // The string is to long
                return $str;
-       } elseif (strlen($str) == 40) {
+       } elseif ((strlen($str) == 40) && (getPassScramble() != '')) {
                // From database
-               $scrambleNums = explode(':', getPassScramble());
+               $scramble = getPassScramble();
        } else {
                // Generate new numbers
-               $scrambleNums = explode(':', genScrambleString(strlen($str)));
+               $scramble = genScrambleString(strlen($str));
        }
 
+       // Convert it into an array
+       $scrambleNums = explode(':', $scramble);
+
        // Assert on both lengths
        assert(strlen($str) == count($scrambleNums));