Advertisement
Guest User

Untitled

a guest
Nov 28th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.66 KB | None | 0 0
  1. <?php
  2. error_reporting(0);
  3. session_start();
  4. include "config/config.php";
  5. include "cipher-function.php";
  6. $login = $_GET['a'];
  7.  
  8. if($login=="login"){
  9. $username = $_POST['username'];
  10. $password = md5($_POST['password']);
  11. $sql = mysqli_query($dbconf,"SELECT * FROM admin where username='$username'");
  12. $result = mysqli_fetch_array($sql);
  13. if(!empty($_POST["username"])) {
  14. if(mysqli_num_rows($sql) == 0) {
  15. echo '<meta http-equiv="refresh" content="0; url=?a='.$cipher->encrypt("login", $key).'&&notif='.$cipher->encrypt("username_not_exist", $key).'" />';
  16. } else {
  17. if($password <> $result['password']) {
  18. echo '<meta http-equiv="refresh" content="0; url=?a='.$cipher->encrypt("login", $key).'&&notif='.$cipher->encrypt("password_wrong", $key).'" />';
  19. } else {
  20. $_SESSION['username'] = $result['username'];
  21. header('location:index/?page=');
  22.  
  23. $data_pasien = $cipher->encrypt("data_pasien",$key);
  24. }
  25. }
  26. } else {
  27. echo '<meta http-equiv="refresh" content="0; url=?a='.$cipher->encrypt("login", $key).'&&notif='.$cipher->encrypt("isi_kolom", $key).'" />';
  28. }
  29. }
  30.  
  31. $href_data_pasien = $cipher->encrypt("data_pasien",$key);
  32.  
  33. if(isset($_GET['notif'])) {
  34. $notif=$_GET['notif'];
  35. }else {
  36. $notif="";
  37. }
  38.  
  39. $notif2="";
  40. if($notif==$cipher->encrypt('isi_kolom',$key)){
  41. $notif2="<div class='alert alert-warning fade in'>
  42. <a href='#' class='close' data-dismiss='alert' aria-label='close'>&times;</a>Masukan Username dan Password
  43. </div>";
  44. }
  45. if($notif==$cipher->encrypt('username_not_exist',$key)){
  46. $notif2="<div class='alert alert-danger fade in'>
  47. <a href='#' class='close' data-dismiss='alert' aria-label='close'>&times;</a> Username tidak ditemukan
  48. </div>";
  49. }
  50. if($notif==$cipher->encrypt('password_wrong',$key)){
  51. $notif2="<div class='alert alert-danger fade in'>
  52. <a href='#' class='close' data-dismiss='alert' aria-label='close'>&times;</a> Username atau password salah
  53. </div>";
  54. }
  55. ?>
  56. <!DOCTYPE html>
  57. <html lang="en">
  58. <head>
  59. <meta charset="utf-8">
  60. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  61. <meta name="viewport" content="width=device-width, initial-scale=1">
  62. <title>Klinik</title>
  63. <link href="css/bootstrap.min.css" rel="stylesheet">
  64. <link href="css/style.css" rel="stylesheet">
  65. <link href="https://fonts.googleapis.com/css?family=Satisfy" rel="stylesheet">
  66. <script type="text/javascript">
  67. $(document).ready(function(){
  68. $('#page_effect').fadeIn(2000);
  69. });
  70. </script>
  71. <script type="text/javascript" src="js/bootstrap.js"></script>
  72. <script type="text/javascript" src="js/jquery.js"></script>
  73. </head>
  74. <body>
  75. <nav class="nav navbar-default">
  76. <div class="container-fluid">
  77. <div class="navbar-header">
  78. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
  79. <span class="sr-only">Toggle navigation</span>
  80. <span class="icon-bar"></span>
  81. <span class="icon-bar"></span>
  82. <span class="icon-bar"></span>
  83. </button>
  84. <a class="navbar-brand a-link" href="#">KLINIK MUTIARA</a>
  85. </div>
  86. <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
  87. <ul class="nav navbar-nav navbar-right">
  88. <!-- <li><a href="../index/?page=<?php echo $data_pasien;?>" class="a-link">Home</a></li>
  89. <li><a href="../index?page=<?php echo $input_data;?>" class="a-link">Input Data</a></li>
  90. <li><a href="my_project.php" class="a-link">My Project</a></li> -->
  91. </ul>
  92. </div>
  93. </div>
  94. </nav>
  95. <div class="container">
  96.  
  97. <div class="row">
  98. <div class="margin-top"></div>
  99. <div class="col-md-4 col-md-offset-4">
  100. <div class="panel panel-default">
  101. <div class="panel-body">
  102. <form class="form-login" method="POST" action="?a=login">
  103. <br><br>
  104. <div class="form-group">
  105. <input type="text" class="form-control form-control-lg" placeholder="Username" name="username">
  106. </div>
  107. <br>
  108. <div class="form-group">
  109. <input type="password" class="form-control form-control-lg" placeholder="Password" name="password">
  110. </div>
  111. <!-- <div class="form-group">
  112. <input type="password" class="form-control form-control-lg" placeholder="Confirm Password">
  113. </div> -->
  114. <br>
  115. <div class="form-group">
  116. <button class="btn btn-primary btn-lg btn-block">Sign In</button>
  117. <!-- <span><a href="#">Need help?</a></span>
  118. <span class="float-xs-right"><a href="#">New Registration</a></span> -->
  119. </div>
  120. <br><br>
  121. </form>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. <div class="col-md-4">
  127. <div style="position:fixed;right:4%;bottom:2%; width: 300px;">
  128. <?php echo $notif2;?>
  129. </div>
  130. </div>
  131. </body>
  132. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement