BlackHalt writeln (by me or from manual) PHP source Codes ...
Cookie:
<?php
if(isset($_GET['lang'])){
header("Set-Cookie: yo=".$_GET['lang']."; path=/; expires=".gmstrftime("%A, %d-%b-%Y %H:%M:%S GMT",time()+(3600*24*365)));
}
elseif(!isset($_COOKIE['yo'])&&!isset($_GET['lang'])){
header("Set-Cookie: yo=2; path=/; expires=".gmstrftime("%A, %d-%b-%Y %H:%M:%S GMT",time()+(3600*24*365)));
}
else{
$yo=false;
$val='en';
}
switch(@$_COOKIE['yo']){
case'0':$val='lv';break;
case'1':$val='ru';break;
case'2':$val='en';break;
default:$val='en';break;
}
?>
<a href="?lang=0">lv</a>
<a href="?lang=1">ru</a>
<a href="?lang=2">en</a>
<?php
echo $val;
?>