Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
index.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * Main program to activate action in WHAT software
9  *
10  * All HTTP requests call index.php to execute action within application
11  *
12  * @author Anakeen 2000
13  * @version $Id: index.php,v 1.64 2008/12/16 15:51:53 jerome Exp $
14  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
15  * @package FDL
16  * @subpackage
17  */
18 /**
19  */
20 
21 include_once ('WHAT/Lib.Main.php');
22 include_once ('WHAT/Class.AuthenticatorManager.php');
23 
25 
26 if ($authtype == 'apache') {
27  // Apache has already handled the authentication
28  global $_SERVER;
29  if ($_SERVER['PHP_AUTH_USER'] == "") {
30  header('HTTP/1.0 403 Forbidden');
31  echo _("User must be authenticate");
32  exit;
33  }
34 } else {
35 
37  switch ($status) {
38  case 0: // it'good, user is authentified
39  break;
40 
41  case -1:
42  // User must change his password
43  // $action->session->close();
44  AuthenticatorManager::$auth->logout("guest.php?sole=A&app=AUTHENT&action=ERRNO_BUG_639");
45  exit(0);
46  break;
47 
48  default:
49  sleep(1); // for robots
50  // Redirect to authentication
51  AuthenticatorManager::$auth->askAuthentication();
52  // AuthenticatorManager::$auth->logout("guest.php?sole=A&app=AUTHENT&action=ERRNO_BUG_639");
53  // AuthenticatorManager::$auth->askAuthentication(array("error" => $status));
54  // Redirect($action, 'AUTHENT', 'LOGINFORM&error='.$status.'&auth_user='.urlencode($_POST['auth_user']));
55  exit(0);
56  }
57 
58  $_SERVER['PHP_AUTH_USER'] = AuthenticatorManager::$auth->getAuthUser();
59 }
60 
61 if (file_exists('maintenance.lock')) {
62  if ($_SERVER['PHP_AUTH_USER'] != 'admin') {
63  include_once ('TOOLBOX/stop.php');
64  exit(0);
65  }
66 }
67 #
68 # This is the main body of App manager
69 # It is used to launch application and
70 # function giving them all necessary environment
71 # element
72 #
73 #
74 // First control
75 if (!isset($_SERVER['PHP_AUTH_USER'])) {
76  $dirname = dirname($_SERVER["SCRIPT_NAME"]);
77 
78  Header("Location:" . $dirname . "/guest.php");
79  exit();
80 }
81 // ----------------------------------------
82 getmainAction(AuthenticatorManager::$auth, $action);
84 ?>
← centre documentaire © anakeen - published under CC License - Dynacase