$logged = false;
session_name('dsid');
session_start();
if ($_SESSION['login']) $_SESSION['logged'] = 1;
elseif ($_COOKIE['delosid']) {
include "Tesserae/db.php";
$db = connetti("delosid");
list($id, $data) = split("-", $_COOKIE['delosid'], 2);
$data = urldecode($data);
if ($db->trova($user, 'delosid.delosid', 'delosid', $id) && crypt(serialize(array($user['username'], $user['password'])), $data) == $data) {
$_SESSION['login'] = $user;
$_SESSION['logged'] = 1;
}
}
header("Content-type; text/javascript");
if ($_SESSION['logged']) {
?>
window.delosid = ;
window.nickname = '';
function loginbox() {
document.write('');
document.write(' | Logout');
document.write(' | Profilo');
}
} else { ?>
function loginbox() {
document.write(' Login');
document.write(' | Registrati');
}
} ?>