Advertisement
Guest User

Untitled

a guest
Jan 6th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.69 KB | None | 0 0
  1. <?php
  2. // Connection
  3. require_once('config/connection.php');
  4. // Helper
  5. require_once('config/helper.php');
  6.  
  7. // Authentication user
  8. if (authentication()){
  9. // Redirect to dashboard
  10. header('Location: '.BASE_URL.'home/');
  11. exit;
  12. }
  13. ?>
  14. <!DOCTYPE html>
  15. <html lang="en" dir="ltr">
  16. <head>
  17. <?php include_once('templates/header.php'); ?>
  18. <style>
  19. .col-login{
  20. max-width: 24rem;
  21. }
  22. .form-label {
  23. display: block;
  24. margin-bottom: .375rem;
  25. font-weight: 600;
  26. font-size: 0.875rem;
  27. }
  28. .form-footer {
  29. margin-top: 2rem;
  30. }
  31. </style>
  32. </head>
  33. <body class="">
  34. <div class="app">
  35. <div class="app-body">
  36. <div class="container">
  37. <br>
  38. <br>
  39. <br>
  40. <div class="row">
  41. <div class="col col-login mx-auto">
  42. <div class="mb-3">
  43. <div class="row">
  44. <div class="col-3 text-right">
  45. <img src="<?= BASE_URL; ?>assets/img/logo.png" class="img-thumbnail" width="70">
  46. </div>
  47. <div class="col-8">
  48. <h4 class="pt-2 mb-2"><?= TITLE; ?></h4>
  49. <h6><?= SLOGANS; ?></h6>
  50. </div>
  51. </div>
  52. </div>
  53. <!-- Login page -->
  54. <div class="login-page">
  55. <form class="card" id="formLogin">
  56. <div class="card-body p-6">
  57. <div class="card-title mb-3">Masuk untuk ke dashboard</div>
  58. <?php
  59. if (isset($_SESSION['msg-error'])) {
  60. echo '<div class="alert alert-danger" style="font-size: 12px;" role="alert">'.$_SESSION['msg-error'].'</div>';
  61. unset($_SESSION['msg-error']);
  62. }
  63. ?>
  64. <div class="form-group">
  65. <label class="form-label" for="username">Username</label>
  66. <input type="text" name="username" id="username" class="form-control" placeholder="Enter Username" tabindex="1" maxlength="15" required>
  67. </div>
  68. <div class="form-group">
  69. <label class="form-label" for="password">Password</label>
  70. <input type="password" name="password" id="password" class="form-control" placeholder="Password" tabindex="2" required>
  71. </div>
  72. <div class="form-footer">
  73. <button type="button" class="btn btn-warning btn-block mb-3" id="login">Masuk</button>
  74. </div>
  75. </div>
  76. </form>
  77. <br>
  78. <div class="text-center text-muted mb-3">
  79. Kesulitan masuk? <span id="admin-help" data-toggle="modal" data-target="#exampleModal" style="cursor: pointer; color: rgb(41, 90, 159);">Beritahu kami</span>
  80. </div>
  81.  
  82. <!-- Modal admin-help -->
  83. <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  84. <div class="modal-dialog" role="document">
  85. <div class="modal-content">
  86. <div class="modal-header">
  87. <h5 class="modal-title" id="exampleModalLabel">Administrator Contact</h5>
  88. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
  89. </button>
  90. </div>
  91. <div class="modal-body">
  92. <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>
  93. <table>
  94. <tr>
  95. <td width="15%"><i class="fa fa-phone"></i></td>
  96. <td width="85%"><span><?= H_PHONE; ?></span></td>
  97. </tr>
  98. <tr>
  99. <td width="15%"><i class="fa fa-envelope"></i></td>
  100. <td width="85%"><span><?= H_EMAIL; ?></span></td>
  101. </tr>
  102. </table>
  103. </div>
  104. <div class="modal-footer">
  105. <button type="button" class="btn btn-sm btn-outline-secondary" data-dismiss="modal">Close</button>
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. </div>
  113. </div>
  114. </div>
  115. </div>
  116. <?php include_once('templates/footer.php'); ?>
  117. <script>
  118. $(document).ready(function(){
  119. // Keyup Enter submit
  120. $('#username').keypress(function (e) {
  121. if (e.which == 13) {
  122. $('#login').click();
  123. return false;
  124. }
  125. });
  126. $('#password').keypress(function (e) {
  127. if (e.which == 13) {
  128. $('#login').click();
  129. return false;
  130. }
  131. });
  132.  
  133. // Help login
  134. $('#admin-help').click(function(){
  135. $('#admin-help-box').toggle();
  136. });
  137.  
  138. // Login action
  139. $('#username').focus(function(){ $(this).css('borderColor', '#D2D2D2'); });
  140. $('#password').focus(function(){ $(this).css('borderColor', '#D2D2D2'); });
  141. $('#login').click(function(){
  142. var isValid = true;
  143. // Validation login
  144. if ($('#username').val() == ''){
  145. $('#username').css('borderColor', 'red'); isValid = false;
  146. }
  147. if ($('#password').val() == ''){
  148. $('#password').css('borderColor', 'red'); isValid = false;
  149. }
  150.  
  151. if (isValid){
  152. $.post('config/functions/login.php',
  153. {
  154. username: $('#username').val(),
  155. password: $('#password').val()
  156. }, function(response, result){
  157. // alert(response);
  158. if (response == "1"){
  159. window.location.href = "<?= BASE_URL ?>";
  160. } else if (response == "0"){
  161. swal('Terjadi kesalahan', 'Maaf, Username dan password tidak sesuai', 'error');
  162. $('#iLPassword').val('').focus();
  163. }
  164. }
  165. );
  166. }
  167. });
  168.  
  169. });
  170. </script>
  171. </body>
  172. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement