Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- require_once("../koneksi/koneksi.php");
- if(isset($_POST['login'])){
- $id = $_POST['id'];
- $pass = $_POST['pass'];
- $level= $_POST['level'];
- if($level == 0){
- $query = mysql_query("SELECT id_petugas, password FROM petugas WHERE id_petugas='$id' AND password='$pass' AND validasi='0'");
- $r = mysql_fetch_array($query);
- if($r){
- $_SESSION['id'] = $id;
- header("Location:../pages/krm/index.php");
- } else {
- ?>
- <script type="text/javascript">
- alert("Login Gagal");
- document.location="../index.php";
- </script>
- <?php
- }
- } else if($level == 1){
- $query = mysql_query("SELECT id_petugas, password FROM petugas WHERE id_petugas='$id' AND password='$pass' AND validasi='1'");
- $r = mysql_fetch_array($query);
- if($r){
- $_SESSION['id']=$id;
- header("Location:../pages/kabag/index.php");
- } else {
- ?>
- <script type="text/javascript">
- alert("Login Gagal");
- document.location="../index.php";
- </script>
- <?php
- }
- }else if($level == 2){
- $query = mysql_query("SELECT id_petugas, password FROM petugas WHERE id_petugas='$id' AND password='$pass' AND validasi='2'");
- $r = mysql_fetch_array($query);
- if($r){
- $_SESSION['id']=$id;
- header("Location:../pages/kpendaftaran/index.php");
- } else {
- ?>
- <script type="text/javascript">
- alert("Login Gagal");
- document.location="../index.php";
- </script>
- <?php
- }
- }else if($level == 3){
- $query = mysql_query("SELECT id_petugas, password FROM petugas WHERE id_petugas='$id' AND password='$pass' AND validasi='3'");
- $r = mysql_fetch_array($query);
- if($r){
- $_SESSION['id']=$id;
- header("Location:../pages/pokja/index.php");
- } else {
- ?>
- <script type="text/javascript">
- alert("Login Gagal");
- document.location="../index.php";
- </script>
- <?php
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement