示例#1
0
 public function login($login = "", $password = "")
 {
     if (empty($login)) {
         $login = $this->login;
         $password = $this->get_password();
     } else {
         if (empty($password)) {
             throw new Exception("Password not given ({$login}).", E_USER_LOGIN);
         }
         $this->login = $login;
         $this->set_password($password);
     }
     if (lms_steam::is_connected()) {
         lms_steam::disconnect();
     }
     lms_steam::connect(STEAM_SERVER, STEAM_PORT, $login, $password);
     if (!lms_steam::is_logged_in()) {
         return FALSE;
     }
     // ASSIGN COMMON ATTRIBUTES
     $this->logged_in = TRUE;
     // INITIALIZE ATTRIBUTES
     $this->init_attributes();
     // INITIALIZE NETWORKING_PROFILE
     $steam_user = lms_steam::get_current_user();
     if (!$steam_user->get_attribute("LLMS_NETWORKING_PROFILE") instanceof steam_object) {
         $profile = new lms_networking_profile($steam_user);
         $profile->initialize();
         logging::write_log(LOG_MESSAGES, "REGISTRATION\t" . $login);
     }
     // NEW ENTRY IN LOGFILE
     logging::write_log(LOG_MESSAGES, "LOGIN\t\t" . $login);
     $_SESSION["last_login"] = $steam_user->get_attribute("LMS_LAST_LOGIN");
     $steam_user->set_attribute("LMS_LAST_LOGIN", time());
     return TRUE;
 }