Skip to content

Commit 9ad30fe

Browse files
committed
update index page
1 parent 84f4efa commit 9ad30fe

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

backend/index.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030
if(empty(trim($_POST["password"]))){
3131
$password_err = "Please enter your password.";
3232
} else{
33-
$password = trim($_POST["password"]);
33+
$password = $_POST["password"];
3434
}
3535

3636
// Validate credentials
3737
if(empty($username_err) && empty($password_err)){
3838
// Prepare a select statement
39-
$sql = "SELECT id, username, password FROM users WHERE username = ?";
39+
$sql = "SELECT id, username, password FROM users1 WHERE username = ?";
4040

4141
if($stmt = mysqli_prepare($link, $sql)){
4242
// Bind variables to the prepared statement as parameters
@@ -54,6 +54,7 @@
5454
if(mysqli_stmt_num_rows($stmt) == 1){
5555
// Bind result variables
5656
mysqli_stmt_bind_result($stmt, $id, $username, $hashed_password);
57+
5758
if(mysqli_stmt_fetch($stmt)){
5859
if(password_verify($password, $hashed_password)){
5960
// Password is correct, so start a new session
@@ -68,7 +69,7 @@
6869
header("location: Welcomepage.php");
6970
} else{
7071
// Password is not valid, display a generic error message
71-
$login_err = "Invalid username or password.";
72+
$login_err = "Invalid username or password1.";
7273
}
7374
}
7475
} else{

0 commit comments

Comments
 (0)