Advertisement
Mista

Untitled

Aug 15th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include"koneksi.php";
  4. $userid = $_POST['userid'];
  5. $psw = md5($_POST['pass']);
  6. $op = $_GET['op'];
  7. if($op=="in"){
  8. $cek = mysqli_query($db,"SELECT * FROM login WHERE userid='$userid' AND pass='$psw'");
  9. if(mysqli_num_rows($cek)==1){
  10. $c = mysqli_fetch_array($cek);
  11. $_SESSION['userid'] = $c['userid'];
  12. $_SESSION['cabang'] = $c['cabang'];
  13. if($c['cabang']=="Pusat"){
  14. header("location:../admin/index.php");
  15. }else if($c['cabang']=="Selong" or $c['cabang']=="Praya" or $c['cabang']=="Mataram" or $c['cabang']=="Tanjung" or $c['cabang']=="Sumbawa" or $c['cabang']=="Taliwang" or $c['cabang']=="Dombpu" or $c['cabang']=="Bima"){
  16. header("location:../cabang/index.php");
  17. }
  18. }else{
  19. echo "<script type='text/javascript'> alert('Maaf Username dan Password Anda Tidak Cocok!'); window.location=('index.php'); </script>";
  20. }
  21. }else if($op=="out"){
  22. unset($_SESSION['userid']);
  23. unset($_SESSION['cabang']);
  24. header("location:../index.php");
  25. }
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement