Jump to content

Cannot send session cookie - eaders already sent


mat3000000

Recommended Posts

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/bakerde1/public_html/oceangamer.com/login.php:1) in /home/bakerde1/public_html/oceangamer.com/login.php on line 2

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/bakerde1/public_html/oceangamer.com/login.php:1) in /home/bakerde1/public_html/oceangamer.com/login.php on line 2

 

These are my error messages, here is my code. I don't know if it is the UTF-8 code at the start, but if it is can anyone recommend a binary editor to remove this. If it isn't what is the problem?

 

<?php  
  session_start();



$username = $_POST['username'];
$password = base64_decode($_POST['password']);


$errors = array();

if($username == 'User Name' || $username == ''){
  $errors[] = 'Please enter a valid username';
}

if($password == 'Password' || $password == ''){
  $errors[] = 'Please enter a valid password';
}

$link = mysql_connect("localhost","*****","******") or die ("Could not connect!");
mysql_select_db("chef");

$query = mysql_query("SELECT * FROM `users` WHERE `username`='$username'");
$numrows = mysql_num_rows($query);

if ($numrows!=0)
{
while($row = mysql_fetch_assoc($query))
{
	$dbusername = $row['username'];
	$dbpassword = $row['password'];
}
if ($username==$dbusername&&$password==$dbpassword)
{ 
$_SESSION['user'] = $username;
	while ($row = mysql_fetch_array($res)) {
  		$type = $row['Type'];
	}
	if ($type == "0") {
	header("location: chefpanel.php");
	}else{
	header("location: restpanel.php");
	}
}
else
 $errors[] = 'Username or Password Incorrect';	
}
else
 $errors[] = 'Username or Password Incorrect';
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

Link to comment
Share on other sites

So, that is the file login.php? Is there ANYTHING before the first opening "<?php" tag - including spaces, line breaks, etc?

 

EDIT

I don't know if it is the UTF-8 code at the start, but if it is can anyone recommend a binary editor to remove this.

 

Wait, what application are you using to edit your files? You must save as a plain text file. There are plenty of free text editors available. If all else fails use notepad.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.