Apache crashed when running my php login script....pls help.
Posted: 17. January 2007 06:06
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!
<?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!