Platform
3.1
PHP API documentation
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Pages
checkauth.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
* PHP Authentification control
9
*
10
* @author Anakeen 1999
11
* @license http://www.gnu.org/licenses/lgpl-3.0.html GNU Lesser General Public License
12
* @package FDL
13
* @subpackage CORE
14
* @deprecated since HTTP Authentification
15
*/
16
17
function
checkauth
(&
$action
)
18
{
19
include_once (
'WHAT/Lib.Common.php'
);
20
include_once (
'WHAT/Class.AuthenticatorManager.php'
);
21
include_once (
'WHAT/Class.htmlAuthenticator.php'
);
22
include_once (
'WHAT/Class.User.php'
);
23
include_once (
'WHAT/Class.Log.php'
);
24
25
$status =
AuthenticatorManager::checkAccess
();
26
//error_log("checkauth: AuthenticatorManager::checkAccess() = {$status}");
27
switch
($status) {
28
case
0:
// it'good, user is authentified, just log the connexion
29
AuthenticatorManager::secureLog
(
"success"
,
"welcome"
,
AuthenticatorManager::$auth
->provider->parms[
'type'
] .
"/"
.
AuthenticatorManager::$auth
->provider->parms[
'provider'
],
$_SERVER
[
"REMOTE_ADDR"
],
AuthenticatorManager::$auth
->getAuthUser() ,
$_SERVER
[
"HTTP_USER_AGENT"
]);
30
break
;
31
32
case
-1:
33
// User must change his password
34
$action
->session->close();
35
global
$_POST
;
36
Redirect
(
$action
,
'AUTHENT'
,
'ERRNO_BUG_639'
);
37
exit
(0);
38
break
;
39
40
default
:
41
AuthenticatorManager::$auth
->askAuthentication(array(
42
'error'
=> $status,
43
'auth_user'
=> urlencode($_POST[
'auth_user'
])
44
));
45
exit
(0);
46
}
47
48
$fromuri =
AuthenticatorManager::$session
->read(
'fromuri'
);
49
if
(($fromuri ==
""
) || (preg_match(
'/app=AUTHENT/'
, $fromuri))) {
50
$fromuri =
"."
;
51
}
52
53
include_once (
'CORE/lang.php'
);
54
$core_lang = getHttpVars(
'CORE_LANG'
);
55
if
($core_lang !=
""
&& array_key_exists($core_lang,
$lang
)) {
56
// error_log(__CLASS__."::".__FUNCTION__." "."Registering vaviable CORE_LANG = '".$core_lang."' in session_auth");
57
AuthenticatorManager::$session
->register(
'CORE_LANG'
, $core_lang);
58
}
59
// error_log(__CLASS__."::".__FUNCTION__." ".'Redirect Location: '.$fromuri);
60
// clean $fromuri
61
$fromuri = preg_replace(
'!//+!'
,
'/'
, $fromuri);
62
$fromuri = preg_replace(
'!&&+!'
,
'&'
, $fromuri);
63
// Redirect to initial page
64
header(
'Location: '
. $fromuri);
65
exit
(0);
66
}
67
?>
← centre documentaire
© anakeen
- published under
CC License
-
Dynacase