Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Connection
- require_once('config/connection.php');
- // Helper
- require_once('config/helper.php');
- // Authentication user
- if (authentication()){
- // Redirect to dashboard
- header('Location: '.BASE_URL.'home/');
- exit;
- }
- ?>
- <!DOCTYPE html>
- <html lang="en" dir="ltr">
- <head>
- <?php include_once('templates/header.php'); ?>
- <style>
- .col-login{
- max-width: 24rem;
- }
- .form-label {
- display: block;
- margin-bottom: .375rem;
- font-weight: 600;
- font-size: 0.875rem;
- }
- .form-footer {
- margin-top: 2rem;
- }
- </style>
- </head>
- <body class="">
- <div class="app">
- <div class="app-body">
- <div class="container">
- <br>
- <br>
- <br>
- <div class="row">
- <div class="col col-login mx-auto">
- <div class="mb-3">
- <div class="row">
- <div class="col-3 text-right">
- <img src="<?= BASE_URL; ?>assets/img/logo.png" class="img-thumbnail" width="70">
- </div>
- <div class="col-8">
- <h4 class="pt-2 mb-2"><?= TITLE; ?></h4>
- <h6><?= SLOGANS; ?></h6>
- </div>
- </div>
- </div>
- <!-- Login page -->
- <div class="login-page">
- <form class="card" id="formLogin">
- <div class="card-body p-6">
- <div class="card-title mb-3">Masuk untuk ke dashboard</div>
- <?php
- if (isset($_SESSION['msg-error'])) {
- echo '<div class="alert alert-danger" style="font-size: 12px;" role="alert">'.$_SESSION['msg-error'].'</div>';
- unset($_SESSION['msg-error']);
- }
- ?>
- <div class="form-group">
- <label class="form-label" for="username">Username</label>
- <input type="text" name="username" id="username" class="form-control" placeholder="Enter Username" tabindex="1" maxlength="15" required>
- </div>
- <div class="form-group">
- <label class="form-label" for="password">Password</label>
- <input type="password" name="password" id="password" class="form-control" placeholder="Password" tabindex="2" required>
- </div>
- <div class="form-footer">
- <button type="button" class="btn btn-warning btn-block mb-3" id="login">Masuk</button>
- </div>
- </div>
- </form>
- <br>
- <div class="text-center text-muted mb-3">
- Kesulitan masuk? <span id="admin-help" data-toggle="modal" data-target="#exampleModal" style="cursor: pointer; color: rgb(41, 90, 159);">Beritahu kami</span>
- </div>
- <!-- Modal admin-help -->
- <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
- <div class="modal-dialog" role="document">
- <div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title" id="exampleModalLabel">Administrator Contact</h5>
- <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span>
- </button>
- </div>
- <div class="modal-body">
- <p>Hi <b>Pengguna</b>, silahkan hubungi kontak dibawah untuk bantuan dalam proses penggunaan sistem ini, jika ada yang perlu di kirim berupa gambar/file, silahkan attach melalui E-mail:</p>
- <table>
- <tr>
- <td width="15%"><i class="fa fa-phone"></i></td>
- <td width="85%"><span><?= H_PHONE; ?></span></td>
- </tr>
- <tr>
- <td width="15%"><i class="fa fa-envelope"></i></td>
- <td width="85%"><span><?= H_EMAIL; ?></span></td>
- </tr>
- </table>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-sm btn-outline-secondary" data-dismiss="modal">Close</button>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <?php include_once('templates/footer.php'); ?>
- <script>
- $(document).ready(function(){
- // Keyup Enter submit
- $('#username').keypress(function (e) {
- if (e.which == 13) {
- $('#login').click();
- return false;
- }
- });
- $('#password').keypress(function (e) {
- if (e.which == 13) {
- $('#login').click();
- return false;
- }
- });
- // Help login
- $('#admin-help').click(function(){
- $('#admin-help-box').toggle();
- });
- // Login action
- $('#username').focus(function(){ $(this).css('borderColor', '#D2D2D2'); });
- $('#password').focus(function(){ $(this).css('borderColor', '#D2D2D2'); });
- $('#login').click(function(){
- var isValid = true;
- // Validation login
- if ($('#username').val() == ''){
- $('#username').css('borderColor', 'red'); isValid = false;
- }
- if ($('#password').val() == ''){
- $('#password').css('borderColor', 'red'); isValid = false;
- }
- if (isValid){
- $.post('config/functions/login.php',
- {
- username: $('#username').val(),
- password: $('#password').val()
- }, function(response, result){
- // alert(response);
- if (response == "1"){
- window.location.href = "<?= BASE_URL ?>";
- } else if (response == "0"){
- swal('Terjadi kesalahan', 'Maaf, Username dan password tidak sesuai', 'error');
- $('#iLPassword').val('').focus();
- }
- }
- );
- }
- });
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement