<?php

include "include/lang.inc.php";
if ($lang == "fr")
{
	$string1 = "Le thème par défaut a bien été changé, il s'agit maintenant de ";
	$string2 = "Ce thème a été placé dans un cookie sur votre machine, vous retrouverez donc ce thème lors de votre prochaine visite !";
	$string3 = "<p><b>PROBLÈME</b>: Il semblerait que votre navigateur n'accepte pas les cookies. Un cookie est utilisé pour sauvegarder le nom du thème pendant et entre vos visites sur ce site.</p>
	<p>...et franchement, ce serait bien dommage de passer à côté d'un système de thèmes <i>quasi-divin</i>, avouez... alors authorisez les cookies SVP.</p>";
	$back = "Retour";
}
else
{
	$string1 = "Default skin has been changed, it is now ";
	$string2 = "This skin has been saved into a cookie on your machine, so it will be automaticaly selected during your next visit!";
	$string3 = "<p><b>PROBLEM</b>: It seems that your browser doesn't accept cookies. A Cookie is used to save your skin during and between your visits.</p>
	<p>...and you really don't want to miss that <i>wonderfull</i> skin system, do you? so make your browser accept cookies, please.</p>";
	$back = "Back";
}
$theme=$_GET["theme"];

$time = time();

echo "
<html>
	<head>
	<title>Switching theme to $theme</title>
	<META HTTP-EQUIV='Refresh' CONTENT='0; URL=".$_SERVER['HTTP_REFERER']."'>
	<meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1' />
	</head>
	<body>";

// 60*60*24*30*12*5 = 155520000 (5 ans)
if (setcookie ("TourmentineThemeCookie",$theme, $time+155520000, "/", ".tourmentine.com")==TRUE)
{
	echo "<p>$string1<b>$theme</b>.</p>
	<p>$string2</p>";
}
else
{	echo $string3;
}
if ($_SERVER['HTTP_REFERER'] !="")
	echo "<br /><a href='".$_SERVER['HTTP_REFERER']."'>$back</a>";
else
	echo "<br /><a href=\"/\">$back</a>";
?>
	</body>
</html>