X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fadmin-inc.php;h=2f2d9bb0fc3bb9b1f4de3e7aea4385ae4aab0017;hp=4ee9340b32aba67d244665a28f9d4423c5d8d428;hb=0e269568bd666186509e98594e83bac199ac26da;hpb=97cc48768dde69e5a98aab29b54ae7326422f9cb diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 4ee9340b32..2f2d9bb0fc 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -51,7 +51,7 @@ function addAdminAccount ($user, $md5, $email) { array($user), __FUNCTION__, __LINE__); // Is the entry there? - if (SQL_NUMROWS($result) == 0) { + if (SQL_NUMROWS($result) == '0') { // Ok, let's create the admin login SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admins` (`login`, `password`, `email`) VALUES ('%s', '%s', '%s')", array( @@ -59,6 +59,8 @@ function addAdminAccount ($user, $md5, $email) { $md5, $email ), __FUNCTION__, __LINE__); + + // All done $ret = 'done'; } // END - if @@ -210,8 +212,6 @@ function doAdminLogin ($adminLogin, $passHash) { setSession('admin_login', $adminLogin) ) && ( setSession('admin_last', time()) - ) && ( - setSession('admin_to', bigintval(postRequestElement('timeout'))) )); } @@ -228,7 +228,7 @@ function ifAdminCookiesAreValid ($admin, $password) { //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):".generatePassString($pass).'('.strlen($pass).")/".$password.'('.strlen($password).")
"); // Check if password matches - if (($ret == 'pass') && ((generatePassString($pass) == $password) || ($pass == $password) || ((strlen($pass) == 32) && (md5($password) == $pass)))) { + if (($ret == 'pass') && ((generatePassString($pass) == $password) || ($pass == $password) || ((strlen($pass) == 32) && (md5($password) == $pass))) && (isAdmin())) { // Passwords matches! $ret = 'done'; } // END - if @@ -238,7 +238,10 @@ function ifAdminCookiesAreValid ($admin, $password) { } // Do an admin action -function doAdminAction ($what) { +function doAdminAction () { + // Get default what + $what = getWhat(); + //* DEBUG: */ outputHtml(__LINE__."*".$what.'/'.getModule().'/'.getAction().'/'.getWhat()."*
"); // Remove any spaces from variable @@ -246,14 +249,14 @@ function doAdminAction ($what) { // Default admin action is the overview page $what = 'overview'; } else { - // Compile out some chars - $what = compileCode($what, false, false, false); + // Secure it + $what = secureString($what); } // Get action value $action = getModeAction(getModule(), $what); - // Define admin login name and ID number + // Define admin login name and id number $content['login'] = getSession('admin_login'); $content['id'] = getCurrentAdminId(); @@ -287,7 +290,14 @@ WHERE ) ) ) -LIMIT 1", array($action, $what, $what), __FUNCTION__, __LINE__); +LIMIT 1", + array( + $action, + $what, + $what + ), __FUNCTION__, __LINE__); + + // Do we have an entry? if (SQL_NUMROWS($result_action) == 1) { // Is valid but does the inlcude file exists? $inc = sprintf("inc/modules/admin/action-%s.php", $action); @@ -333,6 +343,8 @@ WHERE ORDER BY `sort` ASC, `id` DESC", __FUNCTION__, __LINE__); + + // Do we have entries? if (SQL_NUMROWS($result_main) > 0) { $OUT = "
 
\n"; $OUT .= "