Hi i have this problem. when im previewing my login page of my site im getting this error
Warning: session_start(): Cannot send session cookie - headers already sent in D:\Programs\SWSetup\xampp\htdocs\pro\login.php on line 0
Warning: session_start(): Cannot send session cache limiter - headers already sent in D:\Programs\SWSetup\xampp\htdocs\pro\login.php on line 0
These are my codes. Could someone please help me. Thanks
<?php virtual('/pro/Connections/feedback.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_feedback, $feedback);
$query_Recordset1 = "SELECT FROM login";
$Recordset1 = mysql_query($query_Recordset1, $feedback) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?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['Email'])) {
$loginUsername=$POST['Email'];
$password=$_POST['Password'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "/pro/viewdetails.php";
$MM_redirectLoginFailed = "/pro/login.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_feedback, $feedback);
$LoginRS__query=sprintf("SELECT Email, Password FROM login WHERE Email=%s AND Password=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $feedback) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
//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 );
}
}
?>