public static function SetUserLocale($a_locale = NULL)
 {
     if ($a_locale) {
         if (!in_array($a_locale, self::$m_locales)) {
             die("Locale not found");
         }
         self::$m_locale = $a_locale;
         USetCookie('locale', $a_locale, time() + 60 * 60 * 24 * 600);
     } else {
         if ($locale = UGetCookie('locale')) {
             self::$m_locale = $locale;
         } else {
             self::$m_locale = LOCALES_DEFAULT;
         }
     }
 }
 public function StartSession($a_remember)
 {
     if (!isset($this->m_id) || !isset($this->m_password)) {
         return false;
     }
     // Get client IP
     $ip = $_SERVER['REMOTE_ADDR'];
     // Generate session hash
     $session_hash = hash('sha512', $this->m_password . $ip);
     // Add session
     Database::Query("REPLACE INTO `" . DB_TBL_ACCOUNT_SESSIONS . "` (`id`, `hash`, `date`) VALUES ('" . $this->m_id . "', '" . $session_hash . "', FROM_UNIXTIME('" . Date("U") . "'));");
     if ($a_remember) {
         // Long expire time (600days)
         $expire_time = time() + 60 * 60 * 24 * 600;
         // Set Cookies
         USetCookie('userid', $this->m_id, $expire_time);
         USetCookie('session', $session_hash, $expire_time);
     } else {
         // Cookie expires on session end
         USetCookie('userid', $this->m_id);
         USetCookie('session', $session_hash);
     }
     return true;
 }