Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php session_start();
- include 'koneksi.php';
- if (isset($_POST['username']) && isset($_POST['password']))
- {
- $username = mysqli_real_escape_string($conn, $_POST['username']);
- $password = md5(mysqli_real_escape_string($conn, $_POST['password']));
- $result = mysqli_query($conn, "SELECT * FROM tb_user WHERE u_username='$username' and u_password='$password'");
- $count = mysqli_num_rows($result);
- $row = mysqli_fetch_array($result, MYSQLI_ASSOC);
- if($row['level'] == 1){
- $_SESSION['login_user']=$username;
- echo '<script language="javascript">alert("Anda berhasil Login Admin!"); document.location="inventory/index.php";</script>';
- }else if($row['level'] == 2){
- $_SESSION['login_user']=$username;
- echo '<script language="javascript">alert("Anda berhasil Login Admin!"); document.location="pengiriman/index.php";</script>';
- }else if($row['level'] == 3){
- $_SESSION['login_user']=$username;
- echo '<script language="javascript">alert("Anda berhasil Login Admin!"); document.location="general/index.php";</script>';
- }else
- {
- echo '<script language="javascript">alert("Maaf Username Password anda salah!"); document.location="index.php";</script>';
- }
- } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement