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 LoadSession()
 {
     // Check Cookies
     if (!UGetCookie('userid')) {
         return false;
     }
     if (!UGetCookie('session')) {
         return false;
     }
     // Escape string
     $userid = Database::Escape(UGetCookie('userid'));
     // Query for user
     $account_data = Database::Query("SELECT * FROM `" . DB_TBL_ACCOUNT . "` WHERE `id` = '" . $userid . "';");
     if (!$account_data->HasData()) {
         return false;
     }
     // Query session data
     $session_data = Database::Query("SELECT * FROM `" . DB_TBL_ACCOUNT_SESSIONS . "` WHERE `id` = '" . $userid . "';");
     if (!$session_data->HasData()) {
         return false;
     }
     if (UGetCookie('session') != $session_data->GetValue('hash')) {
         return false;
     }
     // Set User Data
     $user = $account_data->GetRow();
     foreach ($user as $key => $value) {
         $this->{"m_" . $key} = $value;
     }
     return true;
 }