<?php
session_start(); 
include("bazadb.php");
include("login.php");

/**
 * Sterge cookie-ul - timpul trebue setat in trecut
 * astfel se anuleaza ceea ce a fost adaugat in cookie
 */
if(isset($_COOKIE['cookname']) && isset($_COOKIE['cookpass'])){
   setcookie("cookname", "", time()-60*60*24*100, "/");
   setcookie("cookpass", "", time()-60*60*24*100, "/");
}
?>

<html>
<title>Iesire</title>
<body>
<center>

<?php
if(isset($_SESSION['nume'])){
   /* Sterge sesiunea */
   unset($_SESSION['nume']);
   unset($_SESSION['parola']);
   $_SESSION = array(); // reseteaza matricea sesiunii
   session_destroy();   // sterge toate sesiunile.

   /* Auto redirect pentru a evita retrimiterea datelor la refresh */
   echo '<meta http-equiv="Refresh" content="1;url='.$_SERVER['PHP_SELF'].'">';
   exit;
} else {
echo '<meta http-equiv="Refresh" content="1;url=\'http://extremshare.net\'">';
}
?>
</body>
</html>