Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include "koneksi.php";
- include "include/session_check.php";
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title>Login</title>
- </head>
- <body>
- <center>
- <form action="" method="post">
- <h1>Login</h1>
- <input type="text" name="username"><br>
- <input type="password" name="password"><br>
- <input type="submit" name="login" value="LOGIN">
- </form>
- </center>
- </body>
- </html>
- <?php
- if(isset($_POST['login'])){
- $username = $_POST['username'];
- $password = $_POST['password'];
- $test = mysql_query("SELECT * FROM pegawai WHERE username ='$username' and password = '$password'");
- if(mysql_num_rows($test) == TRUE){
- $fetch = mysql_fetch_array($test);
- $_SESSION['username'] = $fetch['username'];
- $_SESSION['id_jabatan'] = $fetch['id_jabatan'];
- if ($_SESSION['id_jabatan']==1) {
- $_SESSION['nama_p']=$fetch['nama_p'];
- header("location:admin/index.php");
- } else {
- $_SESSION['nama_p']=$fetch['nama_p'];
- header("location:entry/index.php");
- }
- }else{
- echo ("<script language='JavaScript'>
- window.alert('Gagal Login , Ulangi!!')
- window.location.href='index.php'
- </script>");
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement