this is the login
<?php
class Login extends db
{
protected function getUser($uid, $pwd)
{
$stmt = $this->connect()->prepare('SELECT pwd FROM users WHERE uid = ?;');
if (!$stmt->execute(array($uid, $pwd))) {
$stmt = null;
header("location: ../index.php?error=stmtfucked");
exit();
}
if ($stmt->rowCount() == 0) {
$stmt = null;
header("location: ../index.php?error=usernotfound");
exit();
}
$hashedpwd = $stmt->fetchAll(PDO::FETCH_ASSOC);
$checkpwd = password_verify($pwd, $hashedpwd[0]["pwd"]);
if ($checkpwd == false) {
$stmt = null;
header("location: ../index.php?error=wrongpassword");
exit();
} elseif ($checkpwd == true) {
$stmt = $this->connect()->prepare('SELECT * FROM users WHERE uid = ? AND pwd = ?;');
if (!$stmt->execute(array($uid, $pwd))) {
$stmt = null;
header("location: ../index.php?error=stmtfailedddd");
exit();
}
if ($stmt->rowCount() == 0) {
$stmt = null;
header("location: ../index.php?error=usernotfound");
exit();
}
$user = $stmt->fetchAll(PDO::FETCH_ASSOC);
session_start();
$_SESSION["userid"] = $user[0]["id"];
$_SESSION["useruid"] = $user[0]["uid"];
$stmt = null;
}
}
}
the signup does work but the login does not, why? what is wrong with the code? as it is should log me in so I do not understand what is wrong with it. also I'm new to php so maybe that is why I do not understand, hope you could help me!