Okay, I'm making a little "shoutbox" script more as a learning experience than anything else. What I need to do is check if the username and password is correct. I'm pretty sure it's something like this, but it doesn't work.
Here's what I currently have:
No matter what I put in the username/password fields, it always goes to the else statement, rendering it useless.
Also, this error shows up whenever I try to "login":
Line 79 in my code is the setcookie function.
Here's what I currently have:
Code:
$sql = "SELECT COUNT($username) AS num FROM shout_users WHERE username='$nick' AND password = '$password'";
$result=mysql_query($sql);
if($num == 0) {
echo "Please recheck your username and password combination";
} else{
setcookie ("shoutuser", $username,time()+31536000);
echo "<META HTTP-EQUIV=\"refresh\" content=\"1;URL=$page\">";
}
Also, this error shows up whenever I try to "login":
Code:
Warning: Cannot add header information - headers already sent by (output started at /home/gta3tips/gta3tips.hey.nu/index.php:4) in /home/gta3tips/gta3tips.hey.nu/shoutbox.php on line 79