Postingan lainnya
Mohon koreksi kesalahan syntax di code berikut
<?php
require 'connection.php';
checkLoginAtLogin();
if (isset($_POST['btnLogin'])) {
$username = htmlspecialchars($_POST['username']);
$password = htmlspecialchars($_POST['password']);
$checkUsername = mysqli_query($conn, "SELECT * FROM user WHERE username = '$username'");
if ($data = mysqli_fetch_assoc($checkUsername)) {
if (password_verify($password, $data['password'])) {
$_SESSION = [
'id_user' => $data['id_user'],
'username' => $data['username'],
'id_jabatan' => $data['id_jabatan']
];
header("Location: index.php");
} else {
setAlert("Password your insert is false!", "Check your Password BACK!", "error");
header("Location: login.php");
}
} else {
setAlert("Username is not registered!", "Check your Username BACK!", "error");
header("Location: login.php");
}
}
?>
0
1 Jawaban:
<pre>// mungkin kurang function session_start();</pre><div><br>penempatan function session start bisa dibawah </div><pre>require require 'connection.php'; session_start();</pre>
0