Can\'t communicate with LDAP Server' );
// Slava put thisin to make the cookie last forever. CR 48383 made us remove it.
// session_set_cookie_params(60 * 60 * 24 * 365);
echo"";
if( file_exists(REBOOT_FLAG_FILE) )
{
error_log("SETTING 10 MIN TIMEOUT FOR SECOND REBOOT");
//## NOTE: This same time is also set in common.js Reboot and RebootSys
echo"";
}
else
echo"";
$CheckForOthers = $_POST['CheckForOthers'];
//error_log("CheckForOthers = ". $_POST['CheckForOthers'] );
//error_log("Username = ". $_POST['username'] );
// If this is 2 - The user has answered NO to the question of kicking off another user.
if($CheckForOthers == '2' )
$DoTheLogin = false;
else
$DoTheLogin = true;
//error_log("DoTheLogin = ". $DoTheLogin);
$UserName = $_POST['username'];
$PassWord = $_POST['password'];
//error_log("\n\n\n\n Username = $UserName | Password = $PassWord\n\n\n");
// If 1 we need to check to see if any users will be kicked off.
if($CheckForOthers == '1' )
{
error_log("We are checking for others this time around...............");
if( logout_others( $_POST['username'] ) )
{
error_log("We will be logging others out if we login." );
$DoTheLogin = false;
}
}
if( $DoTheLogin )
{
error_log("We are doing the login process with '". $_POST['username'] ."' & '". $_POST['password']);
if( isset($_POST['username'] ) && isset($_POST['password']) )
{
if( strcmp($_POST['username'],"") && strcmp($_POST['password'],"") )
{
session_start();
$result = login( $_POST['username'], $_POST['password'],
$_SERVER[REMOTE_HOST], $_SERVER[REMOTE_ADDR], $_POST['LDAPDomain'], session_id() );
$username = $result->username;
$role = $result->role;
if( strcmp($username,"") && strcmp($role,"") )
{
//
// Save last click time for inactivity timeout
//
$lastClick = time();
$_SESSION['lastclick'] = $lastClick;
//
// set a hash of the user name
//
$_SESSION['login'] = $_REQUEST['username'].','.md5($_REQUEST['username'].$secret_word);
$_SESSION['user'] = $result;
log_versions($result);
error_log( print_r($_SERVER, true ));
header('location:'.HOME_VIEW_PAGE );
}
else
{
error_log("There was an error with the username and password");
$_REQUEST['login_error'] = True;
$_REQUEST['reason'] = $result->reason;
}
}
else
{
error_log("There was an error with the username and password being blank");
$_REQUEST['login_error'] = True;
$_REQUEST['reason'] = $result->reason;
}
}
else
{
//
// User coming to the page
//
session_start();
//
// check to see if the user is coming back to page; already logged in
//
if( isset($_SESSION['login']) )
{
if( isset($_SESSION['user']) )
{
$user = $_SESSION['user'];
list($tmp_username,$cookie_hash) =
explode(',',$_SESSION['login']);
if( md5($tmp_username.$secret_word) == $cookie_hash )
{
//
// Check for inactivity
//
$currentClick = time();
if( isset($_SESSION['lastclick']) )
{
if( ($currentClick - $_SESSION['lastclick']) > TIMEOUT_SECS )
{
//
// inactivity; logout
//
logoff($_SESSION['user']);
session_destroy();
}
else
{
error_log("User was already logged in - redirecting them to the homepage");
$_SESSION['lastclick'] = $currentClick;
// User is coming back; send to homeview
header('location:'.HOME_VIEW_PAGE);
}
}
else
{
logoff($_SESSION['user']);
session_destroy();
}
}
else
{
logoff($_SESSION['user']);
session_destroy();
}
}
else
{
session_destroy();
}
}
else
{
session_destroy();
}
}
}
// Load stuff up for the first time
$ldap = get_ldap();
error_log( "ldap = ". print_r($ldap, true) );
$LDAPisEnabled = $ldap->enabled;
$ldapDomains = get_ldap_domains();
error_log( "ldapDomains = ". print_r($ldapDomains, true) );
$currentDomain = $ldap->domain;
?>
=LIBTYPE_BRAND ?> - =LIBTYPE_NAME ?> Login Screen
if($CheckForOthers == '1' && $_REQUEST['login_error'] != True )
{
error_log("We are switching to the cautionDiv");
echo "";
}
else
error_log("We are not switching to the cautionDiv.");
?>