Page 1 of 1

Apache crashed when running my php login script....pls help.

PostPosted: 17. January 2007 06:06
by gunblade83
This is the code that I tried to run:
<?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['login_username'])) {
$loginUsername=$_POST['login_username'];
$password=$_POST['login_password'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "/index.php";
$MM_redirectLoginFailed = "/fail.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_connTestServer, $connTestServer);

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

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

//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 );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>

When i try to run, it gave me this error message:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\Program Files\xampp\htdocs\login.php:1) in C:\Program Files\xampp\htdocs\login.php on line 1363

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Program Files\xampp\htdocs\login.php:1) in C:\Program Files\xampp\htdocs\login.php on line 1363

Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\xampp\htdocs\login.php:1) in C:\Program Files\xampp\htdocs\login.php on line 70


I've tried to put the session.save_path = "0;600;C:\Temp" in php.ini but it didn't work...and have been seraching around the web and forum for this solution...

Additional information, I have posted the result if i run the script at http://community.apachefriends.org/f/viewtopi ... highlight=

it actually crashed apache.exe...can someone help on this pls..
Thanks in advance!

PostPosted: 17. January 2007 06:14
by gunblade83
I found the error for the first 2 warning message from:
http://www.wallpaperama.com/forums/warn ... -t416.html

Now new error...
Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\xampp\htdocs\ \login.php:5) in C:\Program Files\xampp\htdocs\login.php on line 69


:D i step closer!

PostPosted: 17. January 2007 07:54
by Wiedmann
All 3 warning messages are because of the same error.