Header error
i am trying to use the redirect method header("location: links.php");
but some how or rather i always get the error message
Cannot modify header information
the code is working fine with the statements but once i put in the statements it just prompts error.
Warning: Cannot modify header information - headers already sent by (output started at c:\inetpub\wwwroot\sam\Organizer\login.php:12) in c:\inetpub\wwwroot\sam\Organizer\login.php on line 44
<?php
include("dblib.inc");
include("clublib.inc");
$message="";
$actionflag = $_POST['actionflag'];
$login = $_POST['login'];
$password = $_POST['password'];
// +++++++++++ Debug ++++++++++
print "actionflag : " .$actionflag. "<br />\n";
print "login : " .$login. "<br />\n";
print "password : " .$password. "<br />\n";
print "session_name : ". session_name(). "<br />\n";
print "session_id :" .session_id(). "<br />\n";
// +++++++++++ Debug ++++++++++
if ( isset( $actionflag ) && $actionflag == "login" )
{
if ( empty( $login ) || empty( $password ) )
$message .= "you must fill in all fields<br>\n";
if ( ! ( $row_array = checkPass( $login, $password ) ) )
$message .= "Incorrect password try again<br>\n";
if ( $message == "" ) // we found no errors
{
// +++++++++++ Debug ++++++++++
print "ID : ".$row_array[id]."<br />\n";
print "row_array[login] : ".$row_array[login]."<br />\n";
print "row_array[password] : ".$row_array[password]."<br />\n";
// +++++++++++ Debug ++++++++++
cleanMemberSession( $row_array[id], $row_array[login], $row_array[password] );
// +++++++++++ Debug ++++++++++
print "sessionID : ".$session[id]."<br />\n";
print "sessionLogin : ".$session[login]."<br />\n";
print "sessionPassword : ".$session[password]."<br />\n";
print "sessionLogged_in : ".$session[logged_in]."<br />\n";
// +++++++++++ Debug ++++++++++
header("Location: membersmenu.php");
}
}
?>
<html>
<head>
<title>Login</title>
</head>
<body>
<?php
include("publicnav.inc");
?>
<h1>Login</h1>
<?php
if ( $message != "" )
{
print "<p><b>$message</b></P>";
}
?>
<p>
<form Method="post" action="<?php print $_SERVER['PHP_SELF'];?>">
<input type="hidden" name="actionflag" value="login">
<input type="hidden" name="<?php print session_name() ?>"
value="<?php print session_id() ?>">
</p><p>
Login: <br>
<input type="text" name="login"
value="<?php print $login ?>">
</p><p>
Password: <br>
<input type="password" name="password" value="">
</p><p>
<input type="submit" value="update">
</form>
</body>
</html>
|