From f1a377b8f764275248ef91fa84a79576efe84136 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Mon, 25 Oct 2004 17:16:07 +0000 Subject: More error messages. Fixed default paths everywhere. --- admin/index.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'admin') diff --git a/admin/index.php b/admin/index.php index 95f60c7..b2775e8 100644 --- a/admin/index.php +++ b/admin/index.php @@ -5,12 +5,15 @@ require_once(BASE.'functions/ical_parser.php'); require_once(BASE.'functions/template.php'); header("Content-Type: text/html; charset=$charset"); -$default_path = 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].substr($_SERVER['PHP_SELF'],0,strpos($_SERVER['PHP_SELF'],'/admin/')); - -// Redirect if administration is not allowed -if ($allow_admin != "yes") { - header("Location: index.php"); - die(); +if (empty($default_path)) { + if (isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) == 'on' ) { + $default_path = 'https://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].substr($_SERVER['PHP_SELF'],0,strpos($_SERVER['PHP_SELF'],'/admin/')); + } else { + $default_path = 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].substr($_SERVER['PHP_SELF'],0,strpos($_SERVER['PHP_SELF'],'/admin/')); + } +} +if ($allow_admin != 'yes') { + exit(error('The administration menu has been turned off.', $cal, '../')); } // Load variables from forms and query strings into local scope -- cgit v1.2.3