memperbaiki login
This commit is contained in:
parent
f3ac99887d
commit
cb96761ae8
@ -7,7 +7,7 @@ include 'db.php';
|
||||
session_start();
|
||||
|
||||
$err = '';
|
||||
$username_input = ''; // Untuk menyimpan username agar tidak hilang jika salah password
|
||||
$username_input = '';
|
||||
|
||||
if (isset($_POST['login'])) {
|
||||
$username_input = trim($_POST['username'] ?? '');
|
||||
@ -27,8 +27,6 @@ if (isset($_POST['login'])) {
|
||||
// password_verify akan mencocokkan input user dengan HASH di database
|
||||
if ($user_data && password_verify($pass, $user_data['password'])) {
|
||||
|
||||
// Login Berhasil!
|
||||
|
||||
// Regenerasi ID Session
|
||||
session_regenerate_id(true);
|
||||
|
||||
@ -55,6 +53,7 @@ if (isset($_POST['login'])) {
|
||||
<head>
|
||||
<title>Login</title>
|
||||
<style>
|
||||
/* Style disamakan persis dengan register.php Anda */
|
||||
body { font-family: Arial; background:#eef2f7; display:flex; height:100vh; justify-content:center; align-items:center; margin:0; }
|
||||
.card { width:350px; background:white; padding:20px; border-radius:10px; box-shadow:0 6px 20px rgba(0,0,0,0.1); }
|
||||
.input { width:100%; padding:10px; margin:8px 0; border:1px solid #ccc; border-radius:8px; box-sizing: border-box; }
|
||||
@ -68,7 +67,7 @@ a { text-decoration: none; color: #007bff; }
|
||||
<body>
|
||||
|
||||
<div class="card">
|
||||
<h2>Login</h2>
|
||||
<h2 style="text-align: center">Login</h2>
|
||||
|
||||
<?php if ($err): ?>
|
||||
<div class="err"><?= htmlspecialchars($err) ?></div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user