Jump to content

[SOLVED] Cannot send session cookie- headers already sent


Recommended Posts

I get these warnings on most of my sites pages:

 

e.g

 

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /var/www/vhosts/propertyeagle.co.uk/httpdocs/searchproperties.php:19) in /var/www/vhosts/propertyeagle.co.uk/httpdocs/searchproperties.php on line 43

 

I have read a lot about these header errors, but never really understood the resolution to the problem. They don't seem to be stopping the site from working in any way, so I am tempted to just down the level of error/warning messages displaying on the actual pages:

 

error_reporting(E_USER_WARNING);

 

 

Am I being foolish not to resolve the problem? How would actually resolving the problem improve my site? Would it make it quicker?

 

 

That didn't work. I think the trouble is that I have HTML code above the PHP code:

 


<html>
<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=WINDOWS-1252">
<title>Propertyeagle.co.uk: Search Properties</title>
</head>
<body>
<p><img border="0" src="logo.GIF" >






<font face="Verdana" size="1"> 
<br>


<?php 

//error_reporting(E_USER_WARNING);

session_start();
$tempflag= $_GET['id'];

if ($tempflag == '1') {
$keywords=$_POST['keywords'];		//keywords
$keywordscriteria=$_POST['R1']; 	//keywords criteria
$minprice=$_POST['minprice'];		//minimum price
$maxprice=$_POST['maxprice'];		//maximum price
$daysposted=$_POST['daysposted'];	//how many days back to search
$resultsortcriteria=$_POST['R2']; 	//criteria used to sort results
$resultsortcriteriab=$_POST['R2']; 	//criteria used to fix problem with checkbox not sticking





no, no, like this

 

<?php 
/error_reporting(E_USER_WARNING);
session_start();
?>
<html>
<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=WINDOWS-1252">
<title>Propertyeagle.co.uk: Search Properties</title>
</head>
<body>
<p><img border="0" src="logo.GIF" >






<font face="Verdana" size="1"> 
<br>


<?php 
$tempflag= $_GET['id'];

if ($tempflag == '1') {
$keywords=$_POST['keywords'];		//keywords
$keywordscriteria=$_POST['R1']; 	//keywords criteria
$minprice=$_POST['minprice'];		//minimum price
$maxprice=$_POST['maxprice'];		//maximum price
$daysposted=$_POST['daysposted'];	//how many days back to search
$resultsortcriteria=$_POST['R2']; 	//criteria used to sort results
$resultsortcriteriab=$_POST['R2']; 	//criteria used to fix problem with checkbox not sticking


//Strip any possibly malicous PHP or HTML code out of all te variables used on this page

$keywords=strip_tags ($keywords);
$minprice=strip_tags ($minprice);
$maxprice=strip_tags ($maxprice);
$daysposted=strip_tags ($daysposted);



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.