"$postjson[$i]", ]; $wrkarr = array_merge($wrkarr, $newarr); endif; endforeach; if (!isset($wrkarr["name"]) || trim($wrkarr["name"]) == ""): die('{ "status": "login (name) was not provided.\ncould not attempt to log in." }'); elseif (!isset($wrkarr["password"]) || trim($wrkarr["password"]) == ""): die('{ "status": "password was not provided.\ncould not attempt to log in." }'); else: $query = $pdo->prepare("SELECT name, password FROM users WHERE name LIKE ?"); $query -> execute([$wrkarr["name"]]); $found = $query->fetch(PDO::FETCH_ASSOC); if ($found): if (!password_verify($wrkarr["password"], $found["password"])): die('{ "status": "wrong password." }'); else: die('{ "status": "success" }'); endif; else: die('{ "status": "name does not exist in the database." }'); endif; endif; echo '{ "status": "online" }'; ?>