Login failure (cannot modify header) PHP/MySQL  
Author Message
jtowne





PostPosted: 2007-3-16 22:29:54 Top

dreamweaver, Login failure (cannot modify header) PHP/MySQL I have a login form 100% Dreamweaver8 built using PHP/MySQL. After logging in
it fails to goto the $MM_redirectLoginSuccess page (index.php). I did not have
this issue prior to the 8.02 update. I designed it the same way as I had
before the 8.02 update. I have checked multiple times for whitespace before
and after the PHP open and close tags in Dreamweaver and other text editors.

Below is what info is needed I hope.

[b]Error[/b]
PHP Warning: Cannot modify header information - headers already sent by
(output started at /var/www/web4/web/login.php:4) in
/var/www/web4/web/login.php on line 72, referer:
[b]Code (All Dreamweaver 8 Generated)[/b]
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['username'])) {
$loginUsername=$_POST['username'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "Account_Type";
$MM_redirectLoginSuccess = "index.php";
$MM_redirectLoginFailed = "loginfailed.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_dnsturtle, $dnsturtle);

$LoginRS__query=sprintf("SELECT Email, Password, Account_Type FROM accounts
WHERE Email=%s AND Password=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password,
"text"));

$LoginRS = mysql_query($LoginRS__query, $dnsturtle) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {

$loginStrGroup = mysql_result($LoginRS,0,'Account_Type');

//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;

if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess ); --------------------Line
72
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>

 
gareth





PostPosted: 2007-3-17 1:14:00 Top

dreamweaver >> Login failure (cannot modify header) PHP/MySQL I take it you have an include file as well on the page, to reference the
database? Check in there for whitespace.


--
Gareth
http://www.phploginsuite.co.uk/
PHP Login Suite V2 - 34 Server Behaviors to build a complete Login system.


 
jtowne





PostPosted: 2007-3-17 2:07:00 Top

dreamweaver >> Login failure (cannot modify header) PHP/MySQL I already checked that also. Again it is whatever Dreamweaver created in the Connections folder.