Kamis, 18 Juli 2019
cek coding
[code hl="1, 4, 7"]
<!-- Koneksi config -->
<?php
require_once "../_config/config.php";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Login - SEApp</title>
<!-- Bootstrap inti dari CSS -->
<link href="../_assets/css/bootstrap.css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div id="wrapper">
<div class="container">
<div class="form-login" style="text-align:center; margin-top:250px;">
<?php
if(isset($_POST['login'])) {
$user = trim(mysqli_real_escape_string($koneksi, $_POST['user']));
$pass = md5(trim(mysqli_real_escape_string($koneksi, $_POST['pass'])));
$sql_login = mysqli_query($koneksi, "SELECT * FROM seapptb_akses WHERE username = '$user' AND password = '$pass'") or die (mysqli_error($koneksi));
if(mysqli_num_rows($sql_login) > 0) {
$row_akun = mysqli_fetch_array($sql_login);
$_SESSION["akun_nik"] = $row_akun["nik"];
$_SESSION["akun_username"] = $row_akun["username"];
$_SESSION["akun_level"] = $row_akun["level"];
if($_SESSION["akun_level"] == "admin") {
echo "<script>window.location='".base_url('dashboard/index.php')."';</script>";
} else if($_SESSION["akun_level"] == "user") {
echo "<script>window.location='".base_url('index-user.php')."';</script>";
}
} else { ?>
<div class="row">
<div class="col-lg-6 col-lg-offset-3">
<div class="alert alert-danger alert-dismissable" role="alert">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
<strong>Login Gagal</strong> Username / Password salah
</div>
</div>
</div>
<?php
}
}
?>
<form action="" method="post" class="navbar-form">
<div class="input-group" style="margin-bottom: 4px">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input type="text" name="user" class="form-control" placeholder="Username" required="" autofocus="">
</div>
<div class="input-group" style="margin-bottom: 4px">
<span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
<input type="password" name="pass" class="form-control" placeholder="Password" required="">
</div>
<div class="input-group" style="margin-bottom: 4px">
<input type="submit" name="login" class="btn btn-primary" value="Login">
</div>
</form>
</div>
</div>
</div>
<script src="<?=base_url('_assets/js/jquery.js')?>"></script>
<script src="<?=base_url('_assets/js/bootstrap.min.js')?>"></script>
</body>
</html>
[/code]
Share this
Recommended
Disqus Comments