Hi,

I call up this script after someone fills out and submits a login form. The code is meant to see if the username and password matchs from another file and if it does, it should load the index page.

---------------------------------
<?
function authenticateUser($user, $password)
{

If($file = fopen("password.txt", "r")) {
$files = fread($file, 500);
$files = split("/", "$files");
$real_username = $files[0];
$real_password = $files[1];
If (($user == $real_username) && ($password == $real_password)) {
return 1 ;
} else {
return 0 ;
} // end if statement
} // end if statement

} // end function

If (authenticateUser($form_user_id,$form_password)) {
setcookie ("cookie_user","$form_user_id");
setcookie ("cookie_passwd","$form_password");
Header("Location: /index.php3");
}
?>
---------------------------------
When that page loads after I submit the login form, and when the login information is correct, it brings up these errors:

---------------------------------
Warning: Oops, php3_SetCookie called after header has been sent in /home/spot/spotscripts-www/phpmo/admin/admin.php3 on line 21

Warning: Oops, php3_SetCookie called after header has been sent in /home/spot/spotscripts-www/phpmo/admin/admin.php3 on line 22

Warning: Cannot add more header information - the header was already sent (header information may be added only before any output is generated from the script - check for text or whitespace outside PHP tags, or calls to functions that output text) in /home/spot/spotscripts-www/phpmo/admin/admin.php3 on line 23
---------------------------------

The previous code is the whole file.

Any help would be appreciated.

Chris Roane