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;
- header('Location: loggedin.php');
- echo "ok";
- }else{
- //NIET OK
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement