-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Your Name
committed
Apr 17, 2024
1 parent
ff2412a
commit 22e88cc
Showing
4 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
<?php | ||
|
||
session_start(); | ||
|
||
if ($_SESSION['status'] == 'login') { | ||
echo "Selamat datang " . $_SESSION['username']; | ||
?> | ||
<br><a href="sessionLogout.php">Log out</a> | ||
<?php | ||
} else { | ||
echo "Anda belum login silakan " ?> | ||
<a href="sessionLoginForm.html">Log in</a> | ||
<?php | ||
} | ||
|
||
|
||
?> | ||
</body> | ||
</html> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
|
||
<form action="sessionLoginProses.php" method="post"> | ||
<table> | ||
<tr> | ||
<td>Username</td> | ||
<td><input type="text" name="username" size="20"></td> | ||
</tr> | ||
<tr> | ||
<td>Password</td> | ||
<td><input type="password" name="password" size="20"></td> | ||
</tr> | ||
<tr> | ||
<td> </td> | ||
<td><input type="submit" name="Login" value="Log in"></td> | ||
</tr> | ||
</table> | ||
</form> | ||
|
||
</body> | ||
</html> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
include "koneksi.php"; | ||
|
||
$username = $_POST['username']; | ||
$password = md5($_POST['password']); | ||
|
||
|
||
$query = "SELECT * FROM user WHERE username = '$username' and password = '$password'"; | ||
$result = mysqli_query($connect, $query); | ||
$cek = mysqli_num_rows($result); | ||
|
||
if ($cek > 0) { | ||
session_start(); | ||
$_SESSION['username'] = $username; | ||
$_SESSION['status'] = 'login'; | ||
?> | ||
Anda berhasil login, silakan menuju | ||
<a href="homeSession.php">Halaman Home</a> | ||
|
||
<?php | ||
} else { | ||
?> | ||
Gagal login, silakan login lagi | ||
<a href="sessionLoginForm.html">Halaman Login</a> | ||
<?php | ||
} | ||
|
||
|
||
?> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
session_start(); | ||
session_destroy(); | ||
|
||
echo "Anda berhasil logout"; | ||
|
||
|
||
?> |