Hello i have a problem with following code on my website:
<?php
session_start();
include '../databaseConnector.php';
$uid = mysqli_real_escape_string($connector, $_POST['uid']);
$pwd = mysqli_real_escape_string($connector, $_POST['pwd']);
$stmt = $connector->prepare("SELECT * FROM nutzer WHERE uid=?");
$stmt->bind_param("s", $username);
$username = $uid;
$stmt->execute();
$result = $stmt->get_result();
$row = mysqli_fetch_assoc($result);
$hash_pw = $row['pwd'];
$dehash = password_verify($pwd, $hash_pw);
if($dehash == 0)
{
header("Location: ../loginscreen.php?error=pwwrong");
exit();
}else{
$stmt2 = $connector->prepare("SELECT * FROM nutzer WHERE uid=? AND pwd=?");
$stmt2->bind_param("ss", $username2, $password2);
$username2 = $uid;
$password2 = $hash_pw;
$stmt2->execute();
$result = $stmt2->get_result();
$stmt->close();
if(!$row =$result->fetch_assoc())
{
echo "Your username or password is incorrect!";
} else{
$_SESSION['id'] = $row['id'];
$_SESSION['uid'] = $row['uid'];
$_SESSION['email'] = $row['email'];
$_SESSION['first'] = $row['first'];
$_SESSION['last'] = $row['last'];
}
header("Location: ../loginscreen.php"); // go to page after signing in
}
The prepared statements work perfectly on XAMPP on my localhost but when i upload them on my webserver there is nothing happening after logging in. It is just a blank screen. My webserver is running on PHP 5.6 if that is important.