php lang _GET lang public function setLanguage lang if lang ru or lang

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
$lang = $_GET['lang'];
public function setLanguage($lang) {
if($lang !== 'ru' or $lang !== 'eng'){
header('Location:/');
exit;
}
if(empty($_COOKIE['lang']) || $_COOKIE['lang'] !== $lang){
if($_COOKIE['lang']) setcookie('lang', '', '1');
setcookie('lang', $lang, time()+3600);
header('Location:/');
exit;
}
}
?>