Пример #1
0
         // Get user
         $tempUser = new User_API();
         $tempUser->Load(intval($tempCookie['user']));
         // Check if the user is a valid user
         if (!isset($tempUser->settings['LoginCheck']) || !$tempUser->userid || !$tempUser->Status()) {
             break;
         }
         // Check whether or not the random number matches
         if (!$tempUser->settings['LoginCheck'] == $tempCookie['rand']) {
             break;
         }
         // The cookie is valid! Update session accordingly
         IEM::userLogin($tempUser->userid);
         $tempValid = true;
         // Check if we have login preferences
         $tempLoginPref = IEM::requestGetCookie('IEM_LoginPreference', array());
         if (is_array($tempLoginPref) && isset($tempLoginPref['takemeto'])) {
             header('Location: ' . SENDSTUDIO_APPLICATION_URL . '/admin/' . $tempLoginPref['takemeto']);
         }
         break;
     }
     if (!$tempValid) {
         $page = 'login';
     }
     unset($tempValid);
     unset($tempCookie);
     unset($tempUser);
 } else {
     $tempUser = GetUser();
     if (!$tempUser->Find($tempUser->username)) {
         $page = 'login';
Пример #2
0
	/**
	* ShowLoginForm
	* This shows the login form.
	* If there is a template to use in the data/templates folder it will use that as the login form.
	* Otherwise it uses the default one below. If you pass in a message it will show that message above the login form.
	*
	* @param String $template Uses the template passed in for the message (eg success / error).
	* @param String $msg Prints the message passed in above the login form (eg unsuccessful attempt).
	*
	* @see FetchTemplate
	* @see PrintHeader
	* @see PrintFooter
	*
	* @return Void Doesn't return anything, just prints the login form.
	*/
	function ShowLoginForm($template=false, $msg=false)
	{
		if (!IEM::getCurrentUser()) {
			$this->GlobalAreas['InfoTips'] = '';
		}

		$this->PrintHeader(true);

		$GLOBALS['Message'] = GetLang('Help_Login');

		if ($template && $msg) {
			switch ($template) {
				case 'login_error':
					$GLOBALS['Error'] = $msg;
				break;
				case 'login_success':
					$this->GlobalAreas['Success'] = $msg;
				break;
			}
			$GLOBALS['Message'] = $this->ParseTemplate($template,true);
		}

		$username = IEM::requestGetPOST('ss_username', false);
		if ($username) {
			$GLOBALS['ss_username'] = htmlspecialchars($username, ENT_QUOTES, SENDSTUDIO_CHARSET);
 		}

		$GLOBALS['ss_takemeto'] = 'index.php';
		$loginPreference = IEM::requestGetCookie('IEM_LoginPreference', array());
		if (is_array($loginPreference) && isset($loginPreference['takemeto'])) {
			$GLOBALS['ss_takemeto'] = $loginPreference['takemeto'];
		}

		$this->GlobalAreas['SubmitAction'] = 'Login';

		$this->ParseTemplate('login');

		$this->PrintFooter(true);
	}