Skip to main content
Participant
March 16, 2007
Question

Login failure (cannot modify header) PHP/MySQL

  • March 16, 2007
  • 2 replies
  • 280 views
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.

Error
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:
Code (All Dreamweaver 8 Generated)
<?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 );
}
}
?>
This topic has been closed for replies.

2 replies

jtowneAuthor
Participant
March 16, 2007
I already checked that also. Again it is whatever Dreamweaver created in the Connections folder.
Inspiring
March 16, 2007
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.