Hi all,

I have an issue here. I'm making a english/spanish site and want the browser
to remember their preference with a cookie. The first time a visitor comes
into the site, they will be taken to the english part (www.site.com/eng/)
and when someone clicks over the "Spanish" link, I want the cookie that was
setled to be erased and a new one to be placed instead. The thing is that is
being done in two separate files because the problem with headers (one for
deleting the cookie and the other to place the new one). The script I have
(pretty mesy) doesn't erase the cookie OR places the same one over again
instead of placing the new one. Here's what I've got so far:

THE MAIN INDEX PAGE:

<?
if (isset($_COOKIE['Languange']))
{
$relative_url = $_COOKIE['Language'];
header("Location: http://localhost/icaam10/".$relative_url);
}
elseif(!isset($_COOKIE['Languange']) AND !isset($lan))
{
$value = "eng";
setcookie ("Language", $value, time()+31536000);
header("Location: http://localhost/icaam10/eng";);
}
elseif(!isset($_COOKIE['Languange']) AND isset($lan))
{
$value = $lan;
setcookie ("Language", $value, time()+31536000);
header("Location: http://localhost/icaam10/".$value);
}
?>

THE "LANSELECT.PHP" PAGE:

<?

if ($_COOKIE['Language'] == "eng")
{
$value = $_COOKIE['Language'];
setcookie ("Language", $value, time()-31536000);
header("Location: http://localhost/icaam10/index.php?lan=esp";);
}
elseif ($_COOKIE['Language'] == "esp")
{
$value = $_COOKIE['Language'];
setcookie ("Language", $value, time()-31536000);
header("Location: http://localhost/icaam10/index.php?lan=eng";);
}

?>
___________________________
Cesar L. Aracena
Commercial Manager / Developer
ICAAM Web Solutions
2K GROUP
Neuquen, Argentina
Tel: +54.299.4774532
Cel: +54.299.6356688
E-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to