registerFunction("checkForOtherLogins");
$in_xAjax = false;
$xAjax_objResponse;
include_once("common_inc.htm");
class CNotification
{
var $guid;
var $alertlevel;
var $emailaddress;
var $enabled;
var $active;
var $systemAccount;
var $accountName;
var $comment;
function CNotification( $aGuid, $aAlertlevel, $aEmailaddress, $aAccountName, $aEnabled=true, $aSystemAccount=false, $aComment="" )
{
$this->guid = $aGuid;
$this->alertlevel = $aAlertlevel;
$this->emailaddress = $aEmailaddress;
$this->enabled = $aEnabled;
$this->active = $aActive;
$this->systemAccount = $aSystemAccount;
$this->accountName = $aAccountName;
$this->comment = $aComment;
}
};
function checkForOtherLogins($username)
{
global $in_xAjax;
$xAjax_objResponse = new xajaxResponse();
$in_xAjax = true;
$willLogOut = logout_others( $username );
if($willLogOut)
{
$xAjax_objResponse->script("indicateWillLogoutOthers()");
}
else
{
$xAjax_objResponse->script("indicateWillNotLogoutOthers()");
}
$in_xAjax = false;
return $xAjax_objResponse;
}
$xajax->processRequest();
$errorMap = array( 4103 => '
Invalid User Name/PasswordUser Name requiredPassword required',
4104 => 'Service in ProgressLogin not allowed',
4105 => 'Already logged in on the web clientLogin not allowed',
4125 => 'A Library Software Update is in progressLogin not allowed',
4106 => 'System has too many login sessionsNo more logins allowed',
4126 => 'Can\'t communicate with LDAP Server',
4129 => 'Diagnostics in ProgressLogin not allowed' );
// 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"";
}
error_log("We are doing the login process with '". $_POST['username'] );
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 ));
$isFirstLogin = is_first_admin_login();
if (file_exists("/home/ilinkacc/disabletechsup"))
{
error_log("Disable techsup@quantum email");
/* get the notifications list and disable techsup if enabled*/
$addrs = get_notifications( $result );
error_log("notifications: ".print_r($addrs,true));
foreach($addrs as $addr)
{
if (($addr->emailaddress == "techsup@quantum.com") )
{
if ($addr->enabled) {
error_log("techsup@quantum.com is enabled, disabling it.");
$addr->enabled=false;
$addr->comment="Disabled by firmware update.";
error_log("addr: ".print_r($addr,true));
$notification = new CNotification( $addr->guid, 3, $addr->address, $addr->name, $addr->enabled, true, $addr->comment);
update_notification($result, $notification);
} else {
error_log("techsup@quantum.com is disabled.");
}
}
}
shell_exec("rm -f /home/ilinkacc/disabletechsup");
}
if($isFirstLogin->bFirstLogin)
{
header('location:'.FORCE_ADMIN_PW_CHANGE_PAGE);
}
else
{
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;
$isFirstLogin = is_first_admin_login();
if($isFirstLogin->bFirstLogin)
{
header('location:'.FORCE_ADMIN_PW_CHANGE_PAGE);
}
else
{
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();
// This contains sensitive information and should not be in shipped code.
//error_log( "ldap = ". print_r($ldap, true) );
if ( $ldap->enabled == "1" ) error_log( "LDAP is Enabled" );
$LDAPisEnabled = $ldap->enabled;
//$ldapDomains = get_ldap_domains();
//error_log( "ldapDomains = ". print_r($ldapDomains, true) );
$currentDomain = $ldap->domain;
$LibraryHostname = get_network_hostname();
$Brand = getenv(ADICLIBRARY_BRAND_GUI);
if( $Brand == "" )
$Brand = getenv(ADICLIBRARY_BRAND);
if( $Brand == "dell" )
$favIcon = $_SERVER[HTTP_HOST]."/dell.ico";
else if( $Brand == "quantum" )
{
if ( OEM == 'P' )
$favIcon = $_SERVER[HTTP_HOST]."/polycyberweb_browser_tab.jpeg";
else
$favIcon = $_SERVER[HTTP_HOST]."/quantum.ico";
}
else if( $Brand == "ibm" )
$favIcon = $_SERVER[HTTP_HOST]."/ibm.ico";
else
$favIcon = $_SERVER[HTTP_HOST]."/adic.ico";
?>
=LIBTYPE_BRAND ?> - =LIBTYPE_NAME ?> Login Screen - =$LibraryHostname ?>
$xajax->printJavascript();
?>