so i have a page that has an admin login for my database.... i can log in correctly, and all my error handling works the way it should (ie. i get the password is not correct error if i enter the wrong password)... my problem lies in my redirect after the user/pass has been checked.... i get the header error "Warning: Cannot modify header information - headers already sent by (output started at c:\inetpub\wwwroot\login.php:12) in c:\inetpub\wwwroot\login.php on line 30" now i know this means that at line 12 im sending some code, but i cat see the code that im sending..... if anybody could help me out with this that would be grand, thx in advance and here is my code
<?php
session_start();
include("other.inc");
$connection = mysql_connect($host,$user,$password) or die ("couldn’t connect to server");
$db = mysql_select_db($database,$connection) or die ("Couldn’t select database.");
$sql = "SELECT loginName FROM admin WHERE loginName='$_POST[fusername]'";
$result = mysql_query($sql) or die(mysql_error($connection));
$num = mysql_num_rows($result);
if ($num == 1) // login name was found
{
$sql = "SELECT loginName FROM admin WHERE loginName='$POST[fusername]'
AND password='$POST[fpassword]'";
$result2 = mysql_query($sql) or die(mysql_error($connection));
$num2 = mysql_num_rows($result2);
if ($num2 > 0) // password is correct
{
$SESSION['auth']="yes";
$logname=$POST['fusername'];
$SESSION['logname'] = $logname;
$today = date("Y-m-d hⓂs");
$sql = "INSERT INTO Login (loginName,loginTime) VALUES ('$logname','$today')";
mysql_query($sql) or die(mysql_error($connection));
header("Location: member_only.php");
}
else // password is not correct
{
echo "The Login Name, '$POST[fusername]' exists, but you have not entered the
correct password! Please try again.<br>";
}
}
elseif ($num == 0) // login name not found
{
echo "The Login Name you entered does not exist! Please try again.<br>";
}
?>