X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fadmin-inc.php;h=cf76c3b12c0d4daee8bd01f4ef451f511a4abb1b;hb=0ddf8f6c578aa2c1ff1db9fb8eb0b93a1e247b73;hp=b4b8d03dcdae100f9937b6398c3c4646163f7401;hpb=42d36ab276be084305ebdb57feb4e60c6b3ec916;p=mailer.git diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index b4b8d03dcd..cf76c3b12c 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -14,8 +14,6 @@ * $Date:: $ * * $Tag:: 0.2.1-FINAL $ * * $Author:: $ * - * Needs to be in all Files and every File needs "svn propset * - * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * * Copyright (c) 2009, 2010 by Mailer Developer Team * @@ -77,29 +75,36 @@ function ifAdminLoginDataIsValid ($adminLogin, $adminPassword) { // First of all, no admin login is found $ret = '404'; - // Then we need to lookup the login name by getting the admin hash - $adminHash = getAdminHash($adminLogin); + // Get admin id from login + $adminId = getAdminId($adminLogin); - // If this is fine, we can continue - if ($adminHash != '-1') { - // Get admin id and set it as current - setCurrentAdminId(getAdminId($adminLogin)); + // Continue only with found admin ids + if ($adminId > 0) { + // Then we need to lookup the login name by getting the admin hash + $adminHash = getAdminHash($adminId); - // Now, we need to encode the password in the same way the one is encoded in database - $testHash = generateHash($adminPassword, $adminHash); + // If this is fine, we can continue + if ($adminHash != '-1') { + // Get admin id and set it as current + setCurrentAdminId($adminId); - // If they both match, the login data is valid - if ($testHash == $adminHash) { - // All fine - $ret = 'done'; - } else { - // Set status - $ret = 'pass'; - } + // Now, we need to encode the password in the same way the one is encoded in database + $testHash = generateHash($adminPassword, $adminHash); + + // If they both match, the login data is valid + if ($testHash == $adminHash) { + // All fine + $ret = 'done'; + } else { + // Set status + $ret = 'password'; + } + } // END - if } // END - if // Prepare data array $data = array( + 'id' => $adminId, 'login' => $adminLogin, 'plain_pass' => $adminPassword, 'pass_hash' => $adminHash @@ -124,7 +129,7 @@ function ifAdminCookiesAreValid ($adminLogin, $passHash) { if ($adminHash != '-1') { // Now, we need to encode the password in the same way the one is encoded in database $testHash = encodeHashForCookie($adminHash); - //* DEBUG: */ outputHtml('adminLogin='.$adminLogin.',
passHash='.$passHash.',
adminHash='.$adminHash.',
testHash='.$testHash.'
'); + //* DEBUG: */ debugOutput('adminLogin=' . $adminLogin . ',passHash='.$passHash.',adminHash='.$adminHash.',testHash='.$testHash); // If they both match, the login data is valid if ($testHash == $passHash) { @@ -132,12 +137,12 @@ function ifAdminCookiesAreValid ($adminLogin, $passHash) { $ret = 'done'; } else { // Set status - $ret = 'pass'; + $ret = 'password'; } } // END - if // Return status - //* DEBUG: */ outputHtml('ret='.$ret); + //* DEBUG: */ debugOutput('ret='.$ret); return $ret; } @@ -146,7 +151,7 @@ function doAdminAction () { // Get default what $what = getWhat(); - //* DEBUG: */ outputHtml(__LINE__.'*'.$what.'/'.getModule().'/'.getAction().'/'.getWhat().'*
'); + //* DEBUG: */ debugOutput(__LINE__.'*'.$what.'/'.getModule().'/'.getAction().'/'.getWhat().'*'); // Remove any spaces from variable if (empty($what)) { @@ -161,7 +166,7 @@ function doAdminAction () { $action = getActionFromModuleWhat(getModule(), $what); // Define admin login name and id number - $content['login'] = getSession('admin_login'); + $content['login'] = getAdminLogin(getSession('admin_id')); $content['id'] = getCurrentAdminId(); // Preload templates @@ -170,6 +175,9 @@ function doAdminAction () { } else { $content['welcome'] = loadTemplate('admin_welcome', true, $content); } + + // Load header, footer, render menu + $content['header'] = loadTemplate('admin_header' , true, $content); $content['footer'] = loadTemplate('admin_footer' , true, $content); $content['menu'] = addAdminMenu($action, $what, true); @@ -249,7 +257,7 @@ ORDER BY `id` DESC", __FUNCTION__, __LINE__); // Do we have entries? - if (SQL_NUMROWS($result_main) > 0) { + if (!SQL_HASZERONUMS($result_main)) { $OUT .= '