Minggu, 10 Januari 2010

PHP : TESTKU

ob_start();

if (isset($_GET["logout"])) {
setcookie("cookieku", "");
header("location: cookie.php?isloggedout");
}

if ($_GET["passed"] == 1) {
$status = 1;
} else {
if (isset($_COOKIE["cookieku"]) && $_COOKIE["cookieku"] == 'cooki') {
$status = 1;
} else {
$status = 0;
}
}

// if cookieku belum diset
if (!isset($_GET["isloggedout"])) {
if (!isset($_COOKIE["cookieku"])) {

setcookie("cookieku", "cooki");
header("location: cookie.php?passed=1");
}
}

echo $status == 1 ? "Browser Anda mendukung cookie
Nilai cookie : ". $_COOKIE["cookieku"] ."
hapus cookie" : "Browser anda tidak support cookie";

?>

Tidak ada komentar: