Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //is er gepost
- if(!empty($_POST)){
- //is alles ingevuld
- if(!empty($_POST['email']) && !empty($_POST['password'])){
- //email + sh1(wachtwoord + salt) gevonden wordt in database
- $email = $_POST['email'];
- $password = $_POST['password'];
- $conn = new mysqli("localhost", "root", "", "phples");
- $query = "SELECT * FROM users
- WHERE (email = '".$conn->real_escape_string($email)."');";
- $result = $conn->query($query);
- $user = $result->fetch_assoc();
- if(password_verify($password, $user['password'])){
- //OK
- session_start();
- $_SESSION['user'] = $email;
- echo "OK, WE ZIJN BINNEN!";
- }else{
- //NIET OK
- echo "UGH HOUSTIN WE GOT A PROBLEM";
- }
- }
- }
- ?><!doctype html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport"
- content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <title>loggedin</title>
- <style>
- *
- {
- box-sizing: border-box;
- }
- body
- {
- font-family: Helvetica;
- background-image: url('http://wallpapercave.com/wp/Wg54vSe.jpg');
- background-size: 120%;
- background-position: 0% 0%;
- color: #565656;
- }
- form
- {
- position: absolute;
- left: 0; right: 0; top: 0; bottom: 0;
- margin: auto;
- width: 530px;
- height: 230px;
- background-color: rgba(255, 255, 255, 0.75);
- border-radius: 8px;
- border: 3px solid rgba(26, 188, 156, 0.5);
- box-sizing: content-box;
- }
- fieldset
- {
- border: none;
- margin-top: 1em;
- }
- legend
- {
- font-size: 1.1em;
- margin-bottom: 0.5em;/*
- color: #1abc9c;*/
- color: #626262;
- font-weight: bold;
- }
- div
- {
- float: left;
- width: 50%;
- }
- .email
- {
- width: 100%;
- margin-top: 1em;
- }
- label
- {
- width: 100%;
- margin-top: 0.5em;
- padding-top: 0.5em;
- padding-left: 7.5%;
- }
- .email label
- {
- padding-left: 3.75%;
- }
- input[type=text], input[type=email], input[type=password]
- {
- width: 90%;
- background-color: transparent;
- color: #626262;
- padding: 0.5em 0 1em 0.5em;
- margin-top: 0.5em;
- margin-bottom: 0.25em;
- margin: 0.5em 5% 0.25em 5%;
- border: 0;
- border-bottom: 2px solid #626262;
- border-top: 2px solid #626262;
- font-size: 1em;
- padding: 0.5em;
- }
- input[type=email]
- {
- width: 95%;
- margin: 0.5em 2.5% 0.25em 2.5%;
- }
- button
- {
- display: block;
- margin-left: auto;
- margin-right: auto;
- margin-top: 1em;
- margin-bottom: 1em;
- background-color: #1abc9c;
- color: white;
- padding: 0.5em 1.5em;
- border: 2px solid #1abc9c;
- font-size: 1em;
- width: 50%;
- }
- button:hover
- {
- cursor: pointer;
- }
- .feedback
- {
- width: 100%;
- text-align: center;
- color: #D6391D;
- font-weight: bold;
- }
- </style>
- </head>
- <body>
- <form action="" method="post">
- <fieldset class="fieldset_one">
- <legend>Log in</legend>
- <div>
- <label for="email">Email</label>
- <input type="text" name="email" id="email">
- </div>
- <div>
- <label for="password">Password</label>
- <input type="password" name="password" id="password">
- </div>
- </fieldset>
- <button type="submit" >Login</button>
- <div class="feedback"></div>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement