r/setup.php
author olof@olof-desktop
Sun Oct 05 11:16:59 2008 +0200 (2008-10-05)
changeset 91 4fc7027ebc67
parent 0 d4d79c790987
child 200 a393922249c6
permissions -rw-r--r--
Make login html adaptable, first application specific, then login, and finally defailt.
     1 <?php // (c) 2008 Olof Tjerngren, GPLv3
     2 $GLOBAL['TWOSPOT_GLOBAL_CHARSET']='UTF8';
     3 $hackSettingSkipLoginDie=1; // Remove this hack after old spot is
     4 			    // truly decommissioned.
     5 $hackSettingSkipHTTPLogin=1; // Need to tidy this up a bit. This hack
     6 			     // setting makes sure you don't get a
     7 			     // popup - instead you get the html below.
     8 
     9 
    10 require_once("../2lib/sessionclass.php");
    11 
    12 if (array_key_exists("_currentAppLoc",$_REQUEST)) {
    13   $_SESSION["configLocation"]=$_REQUEST["_currentAppLoc"];
    14 }
    15 
    16 require_once("../2lib/loginToDb.php");
    17 header('Content-type: text/html; charset=UTF-8');
    18 
    19 
    20 if (array_key_exists("configLocation",$_REQUEST)) {
    21   $_SESSION["configLocation"]=$_REQUEST["configLocation"];
    22  }
    23 
    24 if ($conn && $int_user_no) {
    25   echo '<script type="text/javascript">getMenu("../r/menu.php?level=main")</script>';
    26 } else {
    27   if (array_key_exists("login",$_REQUEST) && 
    28       array_key_exists("password",$_REQUEST)) {
    29     if (doLogin($_REQUEST["login"],$_REQUEST["password"])) {
    30       echo '<script type="text/javascript">getMenu("../r/menu.php?level=main")</script>';
    31       return;
    32     }
    33     echo "<blockquote>Login failed, your username or password is not correct.</blockquote><br>";
    34   }
    35 
    36   // Find the most specific login page and include it to be shown to the user.
    37   if (file_exists($_SESSION["configLocation"]."login.html")) {
    38     include_once($_SESSION["configLocation"]."login.html");
    39   } else if (file_exists("../local/login.html")) {
    40     include_once("../local/login.html");
    41   } else {
    42     include_once("../share/login.html");
    43   }
    44 }
    45 ?>