Skip to content

Instantly share code, notes, and snippets.

@inuvalogic
Created February 17, 2017 02:39
Show Gist options
  • Save inuvalogic/c98dcf91c0c17a516a48ce61ad6d693a to your computer and use it in GitHub Desktop.
Save inuvalogic/c98dcf91c0c17a516a48ce61ad6d693a to your computer and use it in GitHub Desktop.
<?php
session_start();
if (isset($_SESSION['login'])){
session_destroy();
header("Location: login.php");
}
if (isset($_POST['submit'])){
$_SESSION['login'] = true;
header("Location: masuk.php");
exit;
}
?>
<form method="post">
<button type="submit" name="submit">Login</button>
</form>
<?php
session_start();
if (isset($_SESSION['login'])){
echo 'udah login';
} else {
header("Location: login.php");
exit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment