140 Part II: Developing (Msn web hosting) Intranet Solutions Listing 5-7

140 Part II: Developing Intranet Solutions Listing 5-7 (Continued) } else if (strlen($email) < $MIN_USERNAME_SIZE || strlen($password) < $MIN_PASSWORD_SIZE) { // display the login interface $this->debug( Invalid Email or password. ); $this->display_login(); $_SESSION[ SESSION_ATTEMPTS ] = $this->getSessionField( SESSION_ATTEMPTS ) + 1; } else { // Prepare the email with domain name if (!strpos($email, )) { $hostname = explode( . , $_SERVER[ SERVER_NAME ]); if (sizeof($hostname) > 1) { $email .= . $hostname[1] . . . $hostname[2]; } } // authenticate user $this->debug( Authenticate user: $email with password $password ); if ($this->authenticate($email, $password)) { $this->debug( User is successfully authenticated. ); $_SESSION[ SESSION_USERNAME ] = $email; $_SESSION[ SESSION_PASSWORD ] = $password; $_SESSION[ SESSION_USER_ID ] = $this->getUID(); if (empty($url)) { $url = $APP_MENU; } // Log user activity $thisUser = new User($this->dbi, $this->getUID()); $thisUser->logActivity(LOGIN); $this->debug( Location $url ); header( Location: $url );

Leave a Reply