im having problems with my login feature of a website i am making and is wondering if anyone can help me with it ,
the code i done so far lets the user log in no matter what they enter- however it is supposed to match what they type to the details stored on the database , even if there is no data in the database to retrieve from it still lets the user log in.
PHP:
<?php
session_start();
//print_r($_POST);
$Username=$_GET['uname'];
$Password=$_GET['pw'];
$conn = new PDO("mysql:host=localhost;dbname:databasename", 'username' ,'password');
if ($Username == $sql= "SELECT Username FROM Customer"& $Password == $sql= "SELECT Password FROM Customer")
{
$_SESSION['input']= true;
//echo '<p>Login Succesfull</p>';
header('location:Members.php');
} else {
unset($_SESSION['input']);
//echo '<p>Login Not Succesfull</p>';
header('location:Sign-Registration.html');
}
?>
html:
<form name= "input" action="login.php" method="get">
<label for="username">Username:</label>
<input id="username" type="text" name="uname" /><br/>
<label for="password">Password:</label>
<input id="password" type="password" name="pw" /><br/>
<input type="submit" value = "submit"/>
</form>