<?php
session_start();
if (isset($_SESSION['file'])) {
	$file = htmlspecialchars(strip_tags(trim($_SESSION['file'])), ENT_QUOTES, 'UTF-8');
}

$cookie_name = "lang";
$cookie_value = "2";
setcookie($cookie_name, $cookie_value, time() + (86400), "/");

if (!isset($_COOKIE['lang'])) {
	$redirectUrl = "../?val=$cookie_value";
	echo "<script type=\"text/javascript\">";
	echo "window.location.href = '$redirectUrl'";
	echo "</script>";

}else{
	$redirectUrl = "../".$file;
	echo "<script type=\"text/javascript\">";
	echo "window.location.href = '$redirectUrl'";
	echo "</script>";
}
?>