Created
December 2, 2017 09:13
-
-
Save ridoansaleh/29e8a83fcb8a4d387d3aec189f0957b7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php session_start(); ?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Session 2</title> | |
</head> | |
<body> | |
<?php | |
if(isset($_SESSION['login'])){ | |
echo "Selamat datang, <b>".$_SESSION['login']."</b>."; | |
echo "<h2>Halaman Session 2</h2>"; | |
echo "<a href='index.php' onclick='Logout()'>Logout</a>"; | |
}else{ | |
echo "Kamu belum login"; | |
echo "<br> Silahkan <a href='index.php'>login</a> dahulu."; | |
} | |
?> | |
<script type="text/javascript"> | |
function Logout(){ | |
<?php | |
session_destroy(); | |
?> | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment