Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include"koneksi.php";
- $userid = $_POST['userid'];
- $psw = md5($_POST['pass']);
- $op = $_GET['op'];
- if($op=="in"){
- $cek = mysqli_query($db,"SELECT * FROM login WHERE userid='$userid' AND pass='$psw'");
- if(mysqli_num_rows($cek)==1){
- $c = mysqli_fetch_array($cek);
- $_SESSION['userid'] = $c['userid'];
- $_SESSION['cabang'] = $c['cabang'];
- if($c['cabang']=="Pusat"){
- header("location:../admin/index.php");
- }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"){
- header("location:../cabang/index.php");
- }
- }else{
- echo "<script type='text/javascript'> alert('Maaf Username dan Password Anda Tidak Cocok!'); window.location=('index.php'); </script>";
- }
- }else if($op=="out"){
- unset($_SESSION['userid']);
- unset($_SESSION['cabang']);
- header("location:../index.php");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement