Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require("sessionConfig.php");
- if($_SERVER["REQUEST_METHOD"] == "POST")
- {
- $username=mysqli_real_escape_string($dbconfig,$_POST['username']);
- $password=mysqli_real_escape_string($dbconfig,$_POST['password']);
- $sql_query="SELECT * FROM users WHERE username='$username'";
- $result=mysqli_query($dbconfig,$sql_query);
- $row=mysqli_fetch_array($result,MYSQLI_ASSOC);
- $count=mysqli_num_rows($result);
- if($count==1 && password_verify($password, $row['password']))
- {
- $_SESSION['login_user']=$username;
- header("location: home.php");
- }
- else
- {
- $response="Incorrect Username or Password!";
- }
- }
- if(isset($_SESSION['login_user']))
- {
- header("Location: home.php");
- }
- ?>
Add Comment
Please, Sign In to add comment