Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include "../koneksi/koneksi.php";
- if(isset($_POST['username']) && isset($_POST['password'])) {
- $username = $_POST["username"];
- $password = $_POST["password"];
- $query = mysqli_query($koneksi,"SELECT * FROM tbl_user WHERE username='$username' and password='$password'");
- $result = mysqli_num_rows($query);
- //var_dump($result);
- // Validasi Login
- if ($result > 0){
- $_SESSION['username'] = $username;
- $_SESSION['password'] = $password;
- $_SESSION['status'] = "login";
- header("Location: dasboard.php");
- }else{
- header("Location: index.php?error = gagal");
- }
- if (empty ($username) && empty ($password)){
- header ("Location: index.php?error = notusername&password");
- exit();
- }
- else if(empty ($username)){
- header ("Location: index.php?error = notusername");
- exit();
- }
- else if(empty ($password)){
- header ("Location: index.php?error = notpassword");
- exit();
- }
- } else {
- header ("Location: index.php?error=notlogin");
- exit();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement