I am making a login for my site and the code i have so far is...
if ($uname == "" || $pword == "") {
message("Login...","Please fill in your username and password!");
}
$cu = mysql_query("SELECT COUNT(*) as c FROM members WHERE username='$uname'") or die(mysql_error());
$cu = mysql_fetch_array($cu);
if ($cu[c] == 0) {
message("Login...","Username does not exist!");
}
$newpass = md5($pword);
$li = mysql_query("SELECT * FROM members WHERE username='$uname'") or die(mysql_error());
$li = mysql_fetch_array($li);
if ($li[password] != $newpass) {
message("Login...","Password is incorect");
}
elseif ($li[password] == $newpass) {
if($check == "yes") {
setcookie("user","$uname",time()+(3*86400));
}
else {
setcookie("user","$uname");
}
//start text log
$ip = $_SERVER['REMOTE_ADDR'];
$day=time();
$day=date("h:i:s A M d",$day);
filewrite("login.txt","Username: " . $uname . ", Date: " . $day . ", IP: " . $ip);
//end text log
echo "<META HTTP-EQUIV='Refresh' CONTENT='1; URL=index.php'>";
message("Login...","Loging in...");
}
$uname and $pword are the variables that are sent in a form from the other page. So is $check. Now the error I get when I try to login says
Warning: Cannot modify header information - headers already sent by (output started at /home/oprpg/public_html/el/functions.php:111) in /home/oprpg/public_html/el/login.php on line 83
How would I fix this, I even tried ob_start() and ob_end_flush()