Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <?php
- error_reporting(0);
- session_start();
- if($_SESSION['logged'] == true){
- header("location:HomePage.php");
- }
- else{
- ?>
- <html lang="en">
- <head>
- <script>
- function wrongInput(){
- alert("No Accont such that!");
- }
- </script>
- <style>
- .form-signin
- {
- max-width: 330px;
- padding: 15px;
- margin: 0 auto;
- }
- .form-signin .form-signin-heading, .form-signin .checkbox
- {
- margin-bottom: 10px;
- }
- .form-signin .checkbox
- {
- font-weight: normal;
- }
- .form-signin .form-control
- {
- position: relative;
- font-size: 16px;
- height: auto;
- padding: 10px;
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
- }
- .form-signin .form-control:focus
- {
- z-index: 2;
- }
- .form-signin input[type="text"]
- {
- margin-bottom: -1px;
- border-bottom-left-radius: 0;
- border-bottom-right-radius: 0;
- }
- .form-signin input[type="password"]
- {
- margin-bottom: 10px;
- border-top-left-radius: 0;
- border-top-right-radius: 0;
- }
- .account-wall
- {
- margin-top: 20px;
- padding: 40px 0px 20px 0px;
- background-color: #f7f7f7;
- -moz-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
- -webkit-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
- box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
- }
- .login-title
- {
- color: #555;
- font-size: 18px;
- font-weight: 400;
- display: block;
- }
- .profile-img
- {
- width: 96px;
- height: 96px;
- margin: 0 auto 10px;
- display: block;
- -moz-border-radius: 50%;
- -webkit-border-radius: 50%;
- border-radius: 50%;
- }
- .need-help
- {
- margin-top: 10px;
- }
- .new-account
- {
- display: block;
- margin-top: 10px;
- }
- </style>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --
- >
- <title>Bootstrap 101 Template</title>
- <!-- Bootstrap -->
- <link href="css/bootstrap.min.css" rel="stylesheet">
- <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
- <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
- <!--[if lt IE 9]>
- <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
- <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
- <![endif]-->
- </head>
- <body>
- <div class="container">
- <div class="row">
- <div class="col-sm-6 col-md-4 col-md-offset-4">
- <h1 class="text-center login-title">Sign in to continue</h1>
- <div class="account-wall">
- <img class="profile-img" src="https://lh5.googleusercontent.com/-b0-k99FZlyE/AAAAAAAAAAI/AAAAAAAAAAA/eu7opA4byxI/photo.jpg?sz=120"
- alt="">
- <form method = "post" action = '<?php echo $_SERVER['PHP_SELF'];?>' class="form-signin">
- <input name = "username" value = '<?php echo $_COOKIE['username'];?>' type="text" class="form-control" placeholder="Email" required autofocus>
- <input name = "password" type="password" class="form-control" placeholder="Password" required>
- <button name = "login" class="btn btn-lg btn-primary btn-block" type="submit">
- Sign in</button>
- <label class="checkbox pull-left">
- <input name = "checkMe" type="checkbox" value="remember-me">
- Remember me
- </label>
- </form>
- </div>
- <a href="Registration_Form.php" class="text-center new-account">Create an account </a>
- </div>
- </div>
- </div>
- <?php
- $myPassword = $_POST['password'];
- $myUsername = $_POST['username'];
- $SavedUserName = $_POST['username'];
- if(isset($_POST['login'])){
- if(empty($_POST['username']) || empty($_POST['password'])){
- echo "All fields must have an input!!";
- }else{
- $connection = mysqli_connect("localhost","root","","x32_lucillo");
- $Statement = "Select * From tbl_accounts";
- $Query = mysqli_query($connection,$Statement);
- if(mysqli_num_rows($Query) > 0){
- while($getData = mysqli_fetch_array($Query)){
- $emailHolder = $getData['email'];
- $passwordHolder = $getData['password'];
- if($emailHolder == $myUsername and $passwordHolder == $myPassword){
- break;
- }
- }
- }
- if($myPassword == $passwordHolder && $myUsername == $emailHolder){
- session_start();
- $_SESSION['logged'] = true;
- $_SESSION['password'] = $myPassword;
- $_SESSION['user'] = $myUsername;
- header("location:HomePage.php");
- }else{
- echo "<script>";
- echo "wrongInput();";
- echo "</script>";
- }
- if(isset($_POST['checkMe'])){
- setcookie('username', $SavedUserName);
- }
- }
- }
- } ?>
- <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
- <!-- Include all compiled plugins (below), or include individual files as needed -->
- <script src="js/bootstrap.min.js"></script>
- </body
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement