-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathredirect.php
More file actions
28 lines (26 loc) · 731 Bytes
/
redirect.php
File metadata and controls
28 lines (26 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
//VAR ZONE
$KEY="pagelanguage";
$ENGLISH="en";
$SPANISH="es";
$URI_EN="http://www.guillermocebollero.es/cv/en";
$URI_ES="http://www.guillermocebollero.es/cv/es";
if(!isset($_COOKIE[$KEY])) {
//Error, debería estar puesta, redirigimos a default es
setcookie($KEY, $SPANISH, time() + (10 * 365 * 24 * 60 * 60),"/");
header("Location: ".$URI_ES);
}else{
//Obtenemos el idioma, invertims y redirigimos
switch ($_COOKIE[$KEY]) {
case $ENGLISH:
setcookie($KEY, $SPANISH, time() + (10 * 365 * 24 * 60 * 60),"/");
header("Location: ".$URI_ES);
break;
default:
setcookie($KEY, $ENGLISH, time() + (10 * 365 * 24 * 60 * 60),"/");
header("Location: ".$URI_EN);
break;
}
}
die();
?>