Advertisement
Guest User

Untitled

a guest
May 31st, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.46 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <?php
  3. error_reporting(0);
  4. session_start();
  5. if($_SESSION['logged'] == true){
  6. header("location:HomePage.php");
  7. }
  8. else{
  9. ?>
  10. <html lang="en">
  11. <head>
  12. <script>
  13. function wrongInput(){
  14. alert("No Accont such that!");
  15. }
  16. </script>
  17. <style>
  18. .form-signin
  19. {
  20. max-width: 330px;
  21. padding: 15px;
  22. margin: 0 auto;
  23. }
  24. .form-signin .form-signin-heading, .form-signin .checkbox
  25. {
  26. margin-bottom: 10px;
  27. }
  28. .form-signin .checkbox
  29. {
  30. font-weight: normal;
  31. }
  32. .form-signin .form-control
  33. {
  34. position: relative;
  35. font-size: 16px;
  36. height: auto;
  37. padding: 10px;
  38. -webkit-box-sizing: border-box;
  39. -moz-box-sizing: border-box;
  40. box-sizing: border-box;
  41. }
  42. .form-signin .form-control:focus
  43. {
  44. z-index: 2;
  45. }
  46. .form-signin input[type="text"]
  47. {
  48. margin-bottom: -1px;
  49. border-bottom-left-radius: 0;
  50. border-bottom-right-radius: 0;
  51. }
  52. .form-signin input[type="password"]
  53. {
  54. margin-bottom: 10px;
  55. border-top-left-radius: 0;
  56. border-top-right-radius: 0;
  57. }
  58. .account-wall
  59. {
  60. margin-top: 20px;
  61. padding: 40px 0px 20px 0px;
  62. background-color: #f7f7f7;
  63. -moz-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
  64. -webkit-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
  65. box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
  66. }
  67. .login-title
  68. {
  69. color: #555;
  70. font-size: 18px;
  71. font-weight: 400;
  72. display: block;
  73. }
  74. .profile-img
  75. {
  76. width: 96px;
  77. height: 96px;
  78. margin: 0 auto 10px;
  79. display: block;
  80. -moz-border-radius: 50%;
  81. -webkit-border-radius: 50%;
  82. border-radius: 50%;
  83. }
  84. .need-help
  85. {
  86. margin-top: 10px;
  87. }
  88. .new-account
  89. {
  90. display: block;
  91. margin-top: 10px;
  92. }
  93. </style>
  94. <meta charset="utf-8">
  95. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  96. <meta name="viewport" content="width=device-width, initial-scale=1">
  97. <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --
  98. >
  99. <title>Bootstrap 101 Template</title>
  100. <!-- Bootstrap -->
  101. <link href="css/bootstrap.min.css" rel="stylesheet">
  102. <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  103. <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  104. <!--[if lt IE 9]>
  105. <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  106. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  107. <![endif]-->
  108. </head>
  109. <body>
  110.  
  111. <div class="container">
  112. <div class="row">
  113. <div class="col-sm-6 col-md-4 col-md-offset-4">
  114. <h1 class="text-center login-title">Sign in to continue</h1>
  115. <div class="account-wall">
  116. <img class="profile-img" src="https://lh5.googleusercontent.com/-b0-k99FZlyE/AAAAAAAAAAI/AAAAAAAAAAA/eu7opA4byxI/photo.jpg?sz=120"
  117. alt="">
  118. <form method = "post" action = '<?php echo $_SERVER['PHP_SELF'];?>' class="form-signin">
  119. <input name = "username" value = '<?php echo $_COOKIE['username'];?>' type="text" class="form-control" placeholder="Email" required autofocus>
  120. <input name = "password" type="password" class="form-control" placeholder="Password" required>
  121. <button name = "login" class="btn btn-lg btn-primary btn-block" type="submit">
  122. Sign in</button>
  123. <label class="checkbox pull-left">
  124. <input name = "checkMe" type="checkbox" value="remember-me">
  125. Remember me
  126. </label>
  127. </form>
  128. </div>
  129. <a href="Registration_Form.php" class="text-center new-account">Create an account </a>
  130. </div>
  131. </div>
  132. </div>
  133. <?php
  134. $myPassword = $_POST['password'];
  135. $myUsername = $_POST['username'];
  136. $SavedUserName = $_POST['username'];
  137.  
  138. if(isset($_POST['login'])){
  139. if(empty($_POST['username']) || empty($_POST['password'])){
  140. echo "All fields must have an input!!";
  141. }else{
  142. $connection = mysqli_connect("localhost","root","","x32_lucillo");
  143. $Statement = "Select * From tbl_accounts";
  144. $Query = mysqli_query($connection,$Statement);
  145. if(mysqli_num_rows($Query) > 0){
  146. while($getData = mysqli_fetch_array($Query)){
  147. $emailHolder = $getData['email'];
  148. $passwordHolder = $getData['password'];
  149. if($emailHolder == $myUsername and $passwordHolder == $myPassword){
  150. break;
  151. }
  152. }
  153. }
  154.  
  155. if($myPassword == $passwordHolder && $myUsername == $emailHolder){
  156. session_start();
  157. $_SESSION['logged'] = true;
  158. $_SESSION['password'] = $myPassword;
  159. $_SESSION['user'] = $myUsername;
  160.  
  161. header("location:HomePage.php");
  162. }else{
  163. echo "<script>";
  164. echo "wrongInput();";
  165. echo "</script>";
  166. }
  167.  
  168. if(isset($_POST['checkMe'])){
  169. setcookie('username', $SavedUserName);
  170. }
  171.  
  172. }
  173.  
  174. }
  175.  
  176.  
  177. } ?>
  178.  
  179.  
  180.  
  181. <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
  182. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  183. <!-- Include all compiled plugins (below), or include individual files as needed -->
  184. <script src="js/bootstrap.min.js"></script>
  185. </body
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement