What are some potential security vulnerabilities in the provided login script?

One potential security vulnerability in the provided login script is the lack of input validation, which can lead to SQL injection attacks. To mitigate this risk, you should use prepared statements or parameterized queries to sanitize user input before executing SQL queries.

// Implementing prepared statements to prevent SQL injection
$stmt = $pdo->prepare("SELECT * FROM users WHERE username = :username AND password = :password");
$stmt->bindParam(':username', $username);
$stmt->bindParam(':password', $password);
$stmt->execute();