Better checking of admin user stuff

This commit is contained in:
moodler
2004-03-22 01:58:40 +00:00
parent cae86de785
commit 01f2900014
2 changed files with 9 additions and 2 deletions
+7 -2
View File
@@ -17,7 +17,9 @@
require_once("../config.php");
$USER = get_admin();
if (!$alreadyadmin = isadmin()) {
$USER = get_admin(); /// Temporarily, to provide environment for this script
}
echo "<pre>\n";
@@ -133,7 +135,10 @@
echo "Cron script completed correctly\n";
unset($USER);
if (!$alreadyadmin) {
$SESSION = NULL;
$USER = NULL;
}
$difftime = microtime_diff($starttime, microtime());
echo "Execution took ".$difftime." seconds\n";
+2
View File
@@ -346,6 +346,8 @@
}
/// Check for valid admin user
require_login();
if (!isadmin()) {
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
}