What are some potential security risks associated with the PHP script provided in the forum thread?

The PHP script provided in the forum thread is vulnerable to SQL injection attacks because it directly inserts user input into the SQL query without sanitizing it. To mitigate this risk, the user input should be properly sanitized or parameterized before being used in the query.

// Sanitize user input to prevent SQL injection
$username = mysqli_real_escape_string($conn, $_POST['username']);
$password = mysqli_real_escape_string($conn, $_POST['password']);

// Prepare and bind parameterized query
$stmt = $conn->prepare("SELECT * FROM users WHERE username = ? AND password = ?");
$stmt->bind_param("ss", $username, $password);
$stmt->execute();