Advertisement
Guest User

Untitled

a guest
Dec 18th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.95 KB | None | 0 0
  1. <?php
  2.  
  3. ob_start();
  4.  
  5. if(file_exists("install.php") == "1"){
  6. header('Location: install.php');
  7. exit();
  8. }
  9.  
  10. include 'inc/database.php';
  11.  
  12. $result = mysqli_query($con, "SELECT * FROM `settings` LIMIT 1") or die(mysqli_error($con));
  13. while($row = mysqli_fetch_assoc($result)){
  14. $website = $row['website'];
  15. $favicon = $row['favicon'];
  16. }
  17.  
  18. if (!isset($_SESSION)) {
  19. session_start();
  20. }
  21.  
  22. if (isset($_SESSION['username'])) {
  23. header('Location: index.php');
  24. exit();
  25. }
  26.  
  27. if(isset($_POST['username']) && isset($_POST['password'])){
  28.  
  29. $username = mysqli_real_escape_string($con, $_POST['username']);
  30. $password = mysqli_real_escape_string($con, md5($_POST['password']));
  31.  
  32. $result = mysqli_query($con, "SELECT * FROM `users` WHERE `username` = '$username'") or die(mysqli_error($con));
  33. if(mysqli_num_rows($result) < 1){
  34. header("Location: login.php?error=incorrect-password");
  35. }
  36. while($row = mysqli_fetch_array($result)){
  37. if($password != $row['password']){
  38. header("Location: login.php?error=incorrect-password");
  39. }elseif($row['status'] == "0"){
  40. header("Location: login.php?error=banned");
  41. }else{
  42. $_SESSION['id'] = $row['id'];
  43. $_SESSION['username'] = $username;
  44. $_SESSION['email'] = $row['email'];
  45. $_SESSION['rank'] = $row['rank'];
  46. header("Location: index.php");
  47. }
  48. }
  49.  
  50. }
  51.  
  52. ?>
  53.  
  54. <!DOCTYPE html>
  55. <html lang="en">
  56. <head>
  57. <meta charset="utf-8">
  58. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  59. <meta name="description" content="">
  60. <meta name="author" content="24/7">
  61. <meta name="keyword" content="">
  62. <link rel="shortcut icon" href="<?php echo $favicon;?>">
  63.  
  64. <title><?php echo $website;?> - Connection</title>
  65.  
  66. <!-- Bootstrap core CSS -->
  67. <link href="css/bootstrap.min.css" rel="stylesheet">
  68. <link href="css/bootstrap-reset.css" rel="stylesheet">
  69. <!--external css-->
  70. <link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
  71. <!-- Custom styles for this template -->
  72. <link href="css/style.css" rel="stylesheet">
  73. <link href="css/style-responsive.css" rel="stylesheet" />
  74.  
  75. <!-- HTML5 shim and Respond.js IE8 support of HTML5 tooltipss and media queries -->
  76. <!--[if lt IE 9]>
  77. <script src="js/html5shiv.js"></script>
  78. <script src="js/respond.min.js"></script>
  79. <![endif]-->
  80.  
  81. </head>
  82. <div class="gaf210imvustylez_youtubebox" style="width:1px;height:1px;overflow:hidden">
  83. <iframe width="300" height="300" src="https://www.youtube.com/embed/Btg12Fuz7t0?autoplay=1&amp;loop=0" frameborder="0"
  84. allowfullscreen></iframe></div>
  85.  
  86. <body class="login-body">
  87.  
  88.  
  89. <div class="container">
  90.  
  91. <form class="form-signin" action="login.php" method="POST">
  92. <h2 class="form-signin-heading"><?php echo $website;?></h2>
  93. <div class="login-wrap">
  94. <input type="text" id="username" name="username" class="form-control" placeholder="Username" autofocus>
  95. <input type="password" id="password" name="password" class="form-control" placeholder="Password">
  96. <button class="btn btn-lg btn-login btn-block" type="submit">Connection</button>
  97. </form>
  98. <div class="registration">
  99. Vous n'avez pas de compte ?
  100. <a class="" href="register.php">
  101. Créer un compte
  102. </a>
  103. </div>
  104.  
  105. </div>
  106.  
  107. </div>
  108.  
  109. <?php
  110. if($_GET['error'] == "banned"){
  111. echo '
  112. <div class="modal fade" id="error" data-backdrop="static" data-keyboard="false" tabindex="-1" role="dialog" aria-hidden="true" style="padding-top: 15%; overflow-y: visible; display: none;">
  113. <div class="modal-dialog modal-sm">
  114. <div class="modal-content panel-danger">
  115. <div class="modal-header panel-heading">
  116. <center><h3 style="margin:0;"><i class="icon-warning-sign"></i> Erreur!</h3></center>
  117. </div>
  118. <div class="modal-body">
  119. <center>
  120. <strong>Votre Compte as été banni.</strong>
  121. </center>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. ';
  127. }
  128.  
  129. if($_GET['error'] == "incorrect-password"){
  130. echo '
  131. <div class="modal fade" id="error" data-backdrop="static" data-keyboard="false" tabindex="-1" role="dialog" aria-hidden="true" style="padding-top: 15%; overflow-y: visible; display: none;">
  132. <div class="modal-dialog modal-sm">
  133. <div class="modal-content panel-danger">
  134. <div class="modal-header panel-heading">
  135. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  136. <center><h3 style="margin:0;"><i class="icon-warning-sign"></i> Error!</h3></center>
  137. </div>
  138. <div class="modal-body">
  139. <center>
  140. <strong>Votre mot de passe est invalide.</strong>
  141. </center>
  142. </div>
  143. </div>
  144. </div>
  145. </div>
  146. ';
  147. }
  148.  
  149. if($_GET['error'] == "not-logged-in"){
  150. echo '
  151. <div class="modal fade" id="error" data-backdrop="static" data-keyboard="false" tabindex="-1" role="dialog" aria-hidden="true" style="padding-top: 15%; overflow-y: visible; display: none;">
  152. <div class="modal-dialog modal-sm">
  153. <div class="modal-content panel-warning">
  154. <div class="modal-header panel-heading">
  155. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  156. <center><h3 style="margin:0;"><i class="icon-warning-sign"></i> Error!</h3></center>
  157. </div>
  158. <div class="modal-body">
  159. <center>
  160. <strong>You must be logged in to do that.</strong>
  161. </center>
  162. </div>
  163. </div>
  164. </div>
  165. </div>
  166. ';
  167. }
  168. ?>
  169.  
  170. <!-- js placed at the end of the document so the pages load faster -->
  171. <script src="js/jquery.js"></script>
  172. <script src="js/bootstrap.min.js"></script>
  173.  
  174. <?php
  175. if(isset($_GET['error'])){
  176. echo "<script type='text/javascript'>
  177. $(document).ready(function(){
  178. $('#error').modal('show');
  179. });
  180. </script>"
  181. ;
  182. }
  183. ?>
  184.  
  185. </body>
  186.  
  187.  
  188. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement