I am working on my websites login system. But when I login it goes through all my security checks and then when it is suppose to start the session it gives me this error.
“Cannot send session cookie - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/Site/Sign_In.php:7)”
Here is my code
<?php
session_start();
include 'Include/Database.php';
$Mail = mysql_real_escape_string(strip_tags(trim($_POST['Mail'])));
$Password = mysql_real_escape_string(md5(strip_tags(trim($_POST['Password']))));
if ($Mail && $Password) {
$Query = mysql_query("SELECT * FROM Users WHERE Email='$Mail' AND Enabled='1'");
$Rows_Number = mysql_num_rows($Query);
if($Rows_Number==0) {
echo '<span class="Label" style="color: #CC0000;">Username or password is incorrect</span>';
}else{
while($Fetch_Row = mysql_fetch_assoc($Query))
{
$DB_Mail = $Fetch_Row['Email'];
$DB_Password = $Fetch_Row['Password'];
}
if($DB_Mail==$Mail && $DB_Password==$Password) {
$_SESSION['User_Session'] = $DB_Mail;
echo $_SESSION['User_Session'];
}else{
echo '<span class="Label" style="color: #CC0000;">Username or password is incorrect</span>';
}
}
}else{
echo '<span class="Label" style="color: #CC0000;">Your must enter you mail and password</span>';
}
?>
Does anybody know the problem?