2010-06-16 18:21:58 +00:00
|
|
|
<?php
|
|
|
|
$TOPDIR = '..';
|
|
|
|
require_once "$TOPDIR/lib/functions.php";
|
|
|
|
require_once "$TOPDIR/lib/jsonwrapper.php";
|
|
|
|
|
2011-11-15 00:47:09 +00:00
|
|
|
session_start();
|
|
|
|
|
2010-06-16 18:21:58 +00:00
|
|
|
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
|
|
|
header("Cache-Control: no-store, no-cache, must-revalidate");
|
|
|
|
header("Cache-Control: post-check=0, pre-check=0", false);
|
|
|
|
header("Pragma: no-cache");
|
|
|
|
|
|
|
|
if (isset($_REQUEST["password"])) {
|
2012-09-13 16:04:42 +00:00
|
|
|
// Clear data from session
|
|
|
|
$_SESSION = array();
|
2010-06-16 18:21:58 +00:00
|
|
|
|
2012-09-13 16:04:42 +00:00
|
|
|
// Zap existing session entirely
|
|
|
|
session_regenerate_id(true);
|
|
|
|
setpassword($_REQUEST["password"]);
|
2010-06-16 18:21:58 +00:00
|
|
|
|
2012-09-13 16:04:42 +00:00
|
|
|
// Invalid password
|
|
|
|
$_SESSION["xcatpassvalid"] = -1;
|
2010-06-16 18:21:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($_REQUEST["username"])) {
|
2012-09-13 16:04:42 +00:00
|
|
|
$_SESSION["username"] = $_REQUEST["username"];
|
2010-06-16 18:21:58 +00:00
|
|
|
|
2012-09-13 16:04:42 +00:00
|
|
|
// Invalid user name
|
|
|
|
$_SESSION["xcatpassvalid"]=-1;
|
2010-06-16 18:21:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$jdata = array();
|
2012-02-03 18:22:33 +00:00
|
|
|
if (isAuthenticated() && isRootAcess()) {
|
2012-09-13 16:04:42 +00:00
|
|
|
$jdata["authenticated"]="yes";
|
2010-06-16 18:21:58 +00:00
|
|
|
} else {
|
2012-09-13 16:04:42 +00:00
|
|
|
$jdata["authenticated"]="no";
|
2010-06-16 18:21:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
echo json_encode($jdata);
|
|
|
|
?>
|
|
|
|
|