• Sign in to Neowin Faster!

    Create an account on Neowin to contribute and support the site.

  • 0
Sign in to follow this  

Redirect after form

Question

ImDifferent    0

<?php

session_start();

$username=$_POST['username'];
$password=$_POST['password'];

if($username&&$password)
{

    $connect = mysqli_connect("localhost", "root", "", "login") or die("Couldnt connect to Database");
 $query = mysqli_query($connect, "SELECT * FROM users WHERE username='$username'");
 
 $numrows = mysqli_num_rows($query);
 
 if($numrows!==0)
 {
  while($row = mysqli_fetch_assoc($query))
  {
   $dbusername = $row['username'];
   $dbpassword = $row['password'];
  }
  if($username==$dbusername&&$password==$dbpassword)
  {
   echo "You are logged in!";
   $_SESSION['username'] = $username;
  }
  else
  echo "Your password is incorrect!";

    }
 else
   die("That user dosnt exist!");
}
else 
   die("Please enter a username and password");
?>

 

How DO i get this to redirect after checking the database ?

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0
Steven P.    13,596

Moved to correct forum, welcome to Neowin :)

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.