Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if (isset($_POST['button'])){
- include_once 'dbh.inc.php';
- $name = mysqli_real_escape_string($con, $_POST['Benutzername']);
- $pass = mysqli_real_escape_string($con, $_POST['Passwort']);
- $sql = "SELECT * FROM users WHERE user_name='$name'";
- $result = mysqli_query($con, $sql);
- $resultCheck = mysqli_num_rows($result);
- if($resultCheck == 0){
- header("Location: ../index.php?login=userdontexists");
- exit();
- } else{
- $user = $result->fetch_assoc();
- if(password_verify($_POST['Passwort'], $user['user_password'])){
- $_SESSION['u_id'] = $user['user_id'];
- $_SESSION['u_name'] = $user['user_name'];
- header("Location: ../index.php?login=success");
- exit();
- }else{
- header("Location: ../index.php?login=passwordfalse");
- exit();
- }
- }
- } else {
- header("Location: ../login.php");
- exit();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement