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