Fix for first admin login
authorRoland Häder <roland@mxchange.org>
Sun, 18 May 2008 17:13:38 +0000 (17:13 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 18 May 2008 17:13:38 +0000 (17:13 +0000)
inc/modules/admin/admin-inc.php

index 4d3cde5ab730a03bba13a61e79b3832635ce4f97..899bd4c36ae215796af42622702046358dd6a016 100644 (file)
@@ -79,7 +79,7 @@ function CHECK_ADMIN_LOGIN ($admin_login, $password)
                }
        }
 
                }
        }
 
-       //* DEBUG: */ echo "*".$pass."/".md5($password)."/".$ret."<br />";
+       /* DEBUG: */ echo "*".$pass."/".md5($password)."/".$ret."<br />";
        if ((strlen($pass) == 32) && ($pass == md5($password))) {
                // Generate new hash
                $pass = generateHash($password);
        if ((strlen($pass) == 32) && ($pass == md5($password))) {
                // Generate new hash
                $pass = generateHash($password);
@@ -96,6 +96,7 @@ function CHECK_ADMIN_LOGIN ($admin_login, $password)
        $salt = __SALT;
 
        // Check if password is same
        $salt = __SALT;
 
        // Check if password is same
+       //* DEBUG: */ echo "*".$ret.",".$pass.",".$password.",".$salt."*<br >\n";
        if (($ret == "pass") && ($pass == generateHash($password, $salt)) && (!empty($salt)))   {
                // Change the passord hash here
                $pass = generateHash($password);
        if (($ret == "pass") && ($pass == generateHash($password, $salt)) && (!empty($salt)))   {
                // Change the passord hash here
                $pass = generateHash($password);
@@ -120,9 +121,16 @@ function CHECK_ADMIN_LOGIN ($admin_login, $password)
        } elseif ((empty($salt)) && ($ret == "pass")) {
                // Something bad went wrong
                $ret = "failed";
        } elseif ((empty($salt)) && ($ret == "pass")) {
                // Something bad went wrong
                $ret = "failed";
+       } elseif ($ret == "done") {
+               // Try to login here if we have the old hashing way (sql_patches not installed?)
+               if (!LOGIN_ADMIN($admin_login, $pass)) {
+                       // Something went wrong
+                       $ret = "failed";
+               }
        }
 
        // Return the result
        }
 
        // Return the result
+       //* DEBUG: */ die("RETURN=".$ret);
        return $ret;
 }
 
        return $ret;
 }