Advertisement
Guest User

proses.php

a guest
Jan 13th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.01 KB | None | 0 0
  1. <?php
  2. session_start();
  3. require_once("../koneksi/koneksi.php");
  4.  
  5. if(isset($_POST['login'])){
  6.   $id   = $_POST['id'];
  7.   $pass = $_POST['pass'];
  8.   $level= $_POST['level'];
  9.  
  10.   if($level == 0){
  11.     $query = mysql_query("SELECT id_petugas, password FROM petugas WHERE id_petugas='$id' AND password='$pass' AND validasi='0'");
  12.     $r     = mysql_fetch_array($query);
  13.     if($r){
  14.       $_SESSION['id'] = $id;
  15.       header("Location:../pages/krm/index.php");
  16.     } else {
  17.       ?>
  18.       <script type="text/javascript">
  19.         alert("Login Gagal");
  20.         document.location="../index.php";
  21.       </script>
  22.       <?php
  23.     }
  24.   } else if($level == 1){
  25.     $query = mysql_query("SELECT id_petugas, password FROM petugas WHERE id_petugas='$id' AND password='$pass' AND validasi='1'");
  26.     $r     = mysql_fetch_array($query);
  27.     if($r){
  28.       $_SESSION['id']=$id;
  29.       header("Location:../pages/kabag/index.php");
  30.     } else {
  31.       ?>
  32.       <script type="text/javascript">
  33.         alert("Login Gagal");
  34.         document.location="../index.php";
  35.       </script>
  36.       <?php
  37.     }
  38.   }else if($level == 2){
  39.     $query = mysql_query("SELECT id_petugas, password FROM petugas WHERE id_petugas='$id' AND password='$pass' AND validasi='2'");
  40.     $r     = mysql_fetch_array($query);
  41.     if($r){
  42.       $_SESSION['id']=$id;
  43.       header("Location:../pages/kpendaftaran/index.php");
  44.     } else {
  45.       ?>
  46.       <script type="text/javascript">
  47.         alert("Login Gagal");
  48.         document.location="../index.php";
  49.       </script>
  50.       <?php
  51.     }
  52.   }else if($level == 3){
  53.     $query = mysql_query("SELECT id_petugas, password FROM petugas WHERE id_petugas='$id' AND password='$pass' AND validasi='3'");
  54.     $r     = mysql_fetch_array($query);
  55.     if($r){
  56.       $_SESSION['id']=$id;
  57.       header("Location:../pages/pokja/index.php");
  58.     } else {
  59.       ?>
  60.       <script type="text/javascript">
  61.         alert("Login Gagal");
  62.         document.location="../index.php";
  63.       </script>
  64.       <?php
  65.     }
  66.   }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement