function SetLanguage() { /*///////////////////////////////////////////////////////////// Author: Plottery Corp. Created: v1.0.0 - 2009-07-07 Revisions: None Purpose: Sets the language specified in the query string in a cookie Returns: Boolean */ ///////////////////////////////////////////////////////////// global $UserID; global $LanguageID; global $Response; if (isset($_POST['LID'])) { if ($LanguageID = CheckLanguage($_POST['LID'])) { if ($UserID > 0) { if (!ExecCommand('UPDATE 1000_Users SET LanguageID = ' . $LanguageID . ' WHERE UserID = ' . $UserID . ';')) { SysLogIt('Error updating language for user with ID of ' . $UserID . '.', StatusError, ActionUpdate); } else { $Response->S = true; $Response->J = 'SF5();'; } } else { //Save cookie setcookie("LID", $LanguageID, time() + 60 * 60 * 24 * 365); $Response->S = true; $Response->J = 'SF5();'; } } } $Response->Send(); }
<?php session_set_cookie_params(0); session_start(); include_once 'utility_lgmis_lib.php'; if (isset($_REQUEST['lang'])) { $lang = $_REQUEST['lang']; if (CheckLanguage($lang) === false) { echo AlertMessage('danger', 'Язык ' . $lang . ' не найден'); exit; } $_SESSION['lang'] = $lang; }