Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
authent.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  * Re-authenticate a user
9  * Send a 401 Unauthorized HTTP header to force re-authentification or by redirect to index.php
10  * which need also an authentification
11  *
12  * @author Anakeen 2003
13  * @version $Id: authent.php,v 1.17 2006/05/30 16:55:10 marc Exp $
14  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
15  * @package FDL
16  * @subpackage CORE
17  */
18 /**
19  */
20 include_once ('Class.User.php');
21 /**
22  * Send a 401 Unauthorized HTTP header
23  * @deprecated use logout action instead
24  */
25 function authenticate()
26 {
27  // Header( "WWW-Authenticate: Basic realm=\"WHAT Connection\", stale=FALSE");
28  //Header( "WWW-Authenticate: Basic realm=\"WHAT Connection\", stale=true");
29  //Header( "HTTP/1.0 401 Unauthorized");
30  $CoreNull = "";
31  $core = new Application();
32  $core->Set("CORE", $CoreNull);
33  $action = new Action();
34  $action->Set("", $core);
35  header('WWW-Authenticate: Basic realm="' . $action->getParam("CORE_REALM", "Dynacase Platform connection") . '"');
36  header('HTTP/1.0 401 Unauthorized');
37  // Header("Location:guest.php");
38  echo _("Vous devez entrer un nom d'utilisateur valide et un mot de passe correct pour acceder a cette ressource");
39  exit;
40 }
41 
42 global $_SERVER;
43 global $_POST;
44 
45 $target = GetHttpVars("url", "/freedom/index.php?sole=R");
46 
47 if (!isset($_SERVER['PHP_AUTH_USER']) || ($_POST["SeenBefore"] == 1 && !strcmp($_POST["OldAuth"], $_SERVER['PHP_AUTH_USER']))) {
48 
49  authenticate();
50 } else {
51  Header("Location: $target");
53 }
54 ?>
← centre documentaire © anakeen - published under CC License - Dynacase