3v4l.org

run code in 300+ PHP versions simultaneously
<?php require 'path/to/login_utils.php'; $username = $_POST['username']; // NO "custom cleaning function from login_utils" should be ever used here $userpass = $_POST['userpass']; $pdo = connect_to_database(); // custom connection function from login_utils $select = "SELECT `password` FROM `tbl_login` WHERE `username`=:username;"; $prepared = $conn->prepare($select); $prepared->execute([$username]); $result = $prepared->fetch(PDO::FETCH_ASSOC); if ($result && password_verify($userpass, $password)) { start_authenticated_session(); // custom session starting function from login_utils echo 'You have been logged in'; } die ('Invalid username and password combo');

preferences:
165.37 ms | 404 KiB | 5 Q