I have this code for my script
<?php
include('config.php');
switch($mode) {
/ Logs the user in /
case 'Login':
$password = md5($password);
if($username == '') {
$noname = 1; }
if($password == '') {
$nopass = 1; }
$sql = "SELECT username FROM phpbb_users WHERE username = '$username'";
if(!$result = mysql_query($sql)) {
$error = 1; }
if(mysql_num_rows($result) == 0) {
$nouser = 1; }
$sql = "SELECT user_id FROM phpbb_users WHERE username = '$username' AND user_password = '$password'";
if(!$result = mysql_query($sql)) {
$error = 1; }
if(mysql_num_rows($result) == 0) {
$nomatch = 1; }
if($noname == 1 && $nopass == 0) {
die('You did not enter a username.'); }
if($noname == 1 && $nopass == 1) {
die('You did not enter a username or password.'); }
if($noname == 0 && $nopass == 1) {
die('You did not enter a password.'); }
if($error == 1) {
die('There was a server error.'); }
if($nouser == 1) {
die('That username does not exist.'); }
if($nomatch == 1) {
die('That password is incorrect.'); }
if($save == 1) {
setcookie("ffmod","$username:$password",2592000, "","",false);
} else {
setcookie("ffmod","$username:$password",3600,"","",false);
}
header("Location: home.php");
break;
/ Log out /
case 'Logout':
setcookie("ffmod","",time - 2592000, "","",false);
header("Location: home.php");
break; }
?>
Now when ever i try to run it i get:
Warning: Cannot add header information - headers already sent by (output started at /home/virtual/site7/fst/var/www/html/NewSite/login.php:7) in /home/virtual/site7/fst/var/www/html/NewSite/login.php on line 40
Warning: Cannot add header information - headers already sent by (output started at /home/virtual/site7/fst/var/www/html/NewSite/login.php:7) in /home/virtual/site7/fst/var/www/html/NewSite/login.php on line 44
I have tried many things, dont know what is wrong. That would be nice if you could help.