add semakin imut
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
ob_start();
|
||||
session_start();
|
||||
|
||||
include "koneksi.php";
|
||||
$username = $_POST['username'];
|
||||
$password = $_POST['password'];
|
||||
$op = $_GET['login'];
|
||||
|
||||
if ($op == "true") {
|
||||
$sql = mysqli_query($open, "SELECT * FROM login WHERE `username` ='$username' AND `password`='$password'");
|
||||
if (mysqli_num_rows($sql) == 1) { //jika berhasil akan bernilai 1
|
||||
echo json_encode(array("statusCode" => 200));
|
||||
|
||||
$qry = mysqli_fetch_array($sql);
|
||||
$_SESSION['username'] = $qry['username'];
|
||||
$_SESSION['nama'] = $qry['nama'];
|
||||
$_SESSION['hak_akses'] = $qry['hak_akses'];
|
||||
if ($qry['hak_akses'] == "Admin") {
|
||||
header('location: ' . $uri . '/perawat/index.php?link=admin');
|
||||
}
|
||||
if ($qry['hak_akses'] == "OK") {
|
||||
header('location: ' . $uri . '/perawat/index.php?link=ok');
|
||||
}
|
||||
if ($qry['hak_akses'] == "Manajer") {
|
||||
header('location: ' . $uri . '/perawat/index.php?link=manajer');
|
||||
}
|
||||
if ($qry['hak_akses'] == "User") {
|
||||
header('location: ' . $uri . '/perawat/model/logout.php');
|
||||
}
|
||||
} else {
|
||||
echo json_encode(array("statusCode" => 201));
|
||||
?>
|
||||
|
||||
<?php
|
||||
}
|
||||
} else if ($op == "false") {
|
||||
unset($_SESSION['username']);
|
||||
unset($_SESSION['hak_akses']);
|
||||
header("location:/perawat/login.php");
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user