What are the potential pitfalls of using an "=" operator instead of "==" in PHP when comparing values for login authentication?
Using the "=" operator instead of "==" in PHP when comparing values for login authentication can lead to unintentional assignment of values instead of comparison, which can result in a successful login regardless of the actual credentials entered. To solve this issue, always use the "==" operator for comparison in PHP.
// Incorrect comparison using "=" operator
$username = "admin";
$password = "password";
if($username = "admin" && $password = "password") {
echo "Login successful";
} else {
echo "Login failed";
}
```
```php
// Correct comparison using "==" operator
$username = "admin";
$password = "password";
if($username == "admin" && $password == "password") {
echo "Login successful";
} else {
echo "Login failed";
}