From b6833c099cc20d73e3e74e811db64122ac3e1ffc Mon Sep 17 00:00:00 2001 From: LinuxMint4Ever <> Date: Thu, 20 Feb 2020 01:02:31 +0100 Subject: [PATCH] trying proper code now --- threadr/login/redirect.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/threadr/login/redirect.php b/threadr/login/redirect.php index a5d6838..c59d58b 100644 --- a/threadr/login/redirect.php +++ b/threadr/login/redirect.php @@ -5,7 +5,12 @@ $password = $_POST['password']; $pdo = new PDO('mysql:host=localhost;dbname=web', 'webstuff', 'Schei// auf Pa$$w0rter!'); -$statement = $pdo->prepare('SELECT id, name, authentication_algorithm, authentication_string FROM users;'); +$statement = $pdo->prepare('SELECT id, name, authentication_algorithm, authentication_string FROM users WHERE name = :username;'); $result = $statement->execute(array('username' => $username)); -echo $result[0]['name']; +if ($result) { + //existing user name + print_r($statement->fetch()); +} else { + //wrong user name +} ?>