PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Well, I creted a simple login script, but I Get error: Cannot modify header information - headers already sent by (output started at c:\inetpub\wwwroot\login.php: 18) in c:\inetpub\wwwroot\login.php on line 21 The code:
<?php
if ($results['username'] == $username && base64_decode($results['password']) == $password)
{
echo "You are loged in successfully<br>";
}
else
{
echo "Invalid username or password";
}
?>
If username will be invalid I will get about 20 errors of invalid username, because i have 20 usernames in database and if I will add break; It will stop looping after first invalid username!!! How can I make it loop thro all records and after then Just say once that it is invalid username!?
I dont have any spaces there!!! Is there something wrong with cookie? I remember that I read someware that cookie hase to be set in the code beggining??? have can I modify this code, si it will give user a cookie if login will be successfull?? thank you!