

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>3WEB-Pictionarry</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link rel="stylesheet" href="/css/style1.css" />
    </head>

    <body>  
		<nav>
			<%- include nav.ejs %>
		</nav>
					
		<div class="corp">

		  <h2> Vous etes déconecté</2>
		  
	  

	  </div>
   
    </body>
	<script>

	function del_cookie(name)
	{
		document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
		
		alert("You have been disconected "+sName+". You'll be redirected to the Index");
		// redirection, simule un clique sur un lien
		window.location.href = "/index";
	}

	function readCookie(name) 
	{
		var i, c, ca, nameEQ = name + "=";
		ca = document.cookie.split(';');
		for(i=0;i < ca.length;i++) 
		{
			c = ca[i];
			while (c.charAt(0)==' ') 
			{
				c = c.substring(1,c.length);
			}
			if (c.indexOf(nameEQ) == 0) 
			{
				return c.substring(nameEQ.length,c.length);
			}
		}
		return '';
	
	}
	
		var sName = readCookie('sessionName');
		
		//si il est sur la page sans etre conecté
		if(sName==""){alert('You must be loged to acces this page');	window.location.href = "/index";}
		else
		{
			//on supprime le cookie
			del_cookie('sessionName');
		}
</script>
</html>