require_once 'path/to/autoload.php'; use Delight\Auth\Auth; $auth = new Auth($db); // $db is a database connection object $user_id = $auth->getUserId(); echo "Hello user with ID {$user_id}!";
require_once 'path/to/autoload.php'; use Delight\Auth\Auth; $auth = new Auth($db); // $db is a database connection object $user_id = $auth->getUserId(); $stmt = $db->prepare('SELECT * FROM users WHERE id = :user_id'); $stmt->bindParam(':user_id', $user_id); $stmt->execute(); $user_data = $stmt->fetch(); echo "Welcome back, {$user_data['name']}!";The get_id function is part of the Delight/Auth package library, which provides a simple and secure way to implement user authentication and authorization in PHP applications.