473,769 Members | 7,058 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Warning: session_start() : Cannot send session cookie - headers already sent by

Bob
Seem to have a problem ending a session. I get the following message.
Warning: session_start() : Cannot send session cookie - headers already
sent by (output started at
C:\xitami\xitam i-24\app\webpages \logout.php:9) in
C:\xitami\xitam i-24\app\webpages \logout.php on line 10

Warning: session_start() : Cannot send session cache limiter - headers
already sent (output started at
C:\xitami\xitam i-24\app\webpages \logout.php:9) in
C:\xitami\xitam i-24\app\webpages \logout.php on line 10

You have been logged off, you must re-login to use the system.
Log In

The code is as follows.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Logged Out</title>
</head>

<body>
<?php
session_start() ;
session_unset() ;
session_destroy ();

//unset($HTTP_SES SION_VARS['valid_user']);
//unset($HTTP_SES SION_VARS['privlevel']);
//session_destroy ();

echo '<h3>You have been logged off, you must re-login to use the
system.</h3>';
echo '<a href="log_in.ph p">Log In</a><br />';
?>

</body>
</html>
I am using Homesite4.5 and saving the file as "pc" format. The
webserver is Xitami.

Help would be appreciated.
Jul 17 '05 #1
4 14091
>Seem to have a problem ending a session. I get the following message.

Warning: session_start() : Cannot send session cookie - headers already
sent by (output started at
You may not output ANYTHING before calling session_start() , (or
other functions that need to send headers, like cookie setting).
Nada. Zip. Nothing. Put your HTML, DOCTYPE, blank lines, single
spaces, etc. *after* calling session_start() .

Gordon L. Burditt
C:\xitami\xita mi-24\app\webpages \logout.php:9) in
C:\xitami\xita mi-24\app\webpages \logout.php on line 10

Warning: session_start() : Cannot send session cache limiter - headers
already sent (output started at
C:\xitami\xita mi-24\app\webpages \logout.php:9) in
C:\xitami\xita mi-24\app\webpages \logout.php on line 10

You have been logged off, you must re-login to use the system.
Log In

The code is as follows.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Logged Out</title>
</head>

<body>
<?php
session_start( );
session_unset( );
session_destro y();

//unset($HTTP_SES SION_VARS['valid_user']);
//unset($HTTP_SES SION_VARS['privlevel']);
//session_destroy ();

echo '<h3>You have been logged off, you must re-login to use the
system.</h3>';
echo '<a href="log_in.ph p">Log In</a><br />';
?>

</body>
</html>
I am using Homesite4.5 and saving the file as "pc" format. The
webserver is Xitami.

Help would be appreciated.

Jul 17 '05 #2
While the city slept, Bob (cl****@quality think.com) feverishly typed...
Seem to have a problem ending a session. I get the following message.

Warning: session_start() : Cannot send session cookie - headers already

[etc]

You cannot have any output before the session (including normal HTML
output). Try re-organising as follows;

<?php
session_start() ;
session_unset() ;
session_destroy ();

//unset($HTTP_SES SION_VARS['valid_user']);
//unset($HTTP_SES SION_VARS['privlevel']);
//session_destroy ();
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Logged Out</title>
</head>

<body>
<h3>You have been logged off, you must re-login to use the system.</h3>';
<p><a href="log_in.ph p">Log In</a></p>
</body>
</html>

.... A couple of non-php points. It is probably time for you to consider
coding the HTML 4.01 Strict doctype. Why have you used H3 to mark up the
"You have been logged off..." text? Where are the first and second level
headings that should precede it?

Hope that helps,
Nige

--
Nigel Moss
http://www.nigenet.org.uk
Mail address not valid. ni***@DOG.nigen et.org.uk, take the DOG. out!
In the land of the blind, the one-eyed man is very, very busy!
Jul 17 '05 #3
Bob
Thanks to both of you for the help.
Jul 17 '05 #4
While the city slept, Bob (cl****@quality think.com) feverishly typed...
Thanks to both of you for the help.


Your welcome. :-)

Cheers,
Nige

--
Nigel Moss
http://www.nigenet.org.uk
Mail address not valid. ni***@DOG.nigen et.org.uk, take the DOG. out!
In the land of the blind, the one-eyed man is very, very busy!
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3173
by: Phyzlo | last post by:
Hello, I've recently started learning PHP and have a question. I tried running below script which can be found at http://se2.php.net/manual/sv/function.setcookie.php but I keep getting this message on my browser, why? Warning: Cannot add header information - headers already sent by (output started at /var/www/cookietest.php:2) in
1
2450
by: None | last post by:
Hello, I am a total newbie to PHP and programming in general. I am playing around with a PHP / MySQL shopping cart script which I found at http://www.macromedia.com/devnet/mx/dreamweaver/articles/php_cart.html. When I try to start a session or create a cookie, I get the following errors. Warning: Cannot send session cache limiter - headers already sent (output started at /wrapper_head2.php:27) in /cart.php on line 13 Warning: Cannot...
2
1385
by: bobkaku | last post by:
I added session control to my survey application. I want to retain the person's name entered on the 1st page and use it as a variable value on subsequent pages. I added on the first script: <? session_start();
3
53663
by: lawrence k | last post by:
I'm getting this warning: PHP Warning: session_start(): Cannot send session cache limiter - headers already sent in /home/httpd/vhosts/monkeyclaus.org/httpdocs/media/audio/pdsIncludes/CommandStartSession.php on line 14 line 14 is this:
19
7928
by: lawrence k | last post by:
How can I find out where my script is outputting to the screen for the first time? My error logs are full of stuff like this: PHP Warning: session_start(): Cannot send session cache limiter - headers already sent in /home/httpd/vhosts/monkeyclaus.org/httpdocs/media/audio/pdsIncludes/CommandStartSession.php on line 14
2
6223
by: samcode3 | last post by:
Hi, I would be thankfull if anyone could give me the solution for this header problem. There are no blank spaces at end as there is html code in end. I have used <?php session_start();?> in first line and in between am checking this for session. <?php if($_SESSION == "email"){ echo "username already taken. Please try another!"; $_SESSION="";} else if($_SESSION == "user"){ echo "Email exist. If you have registered then please login!";...
5
7193
by: siyaverma | last post by:
Hi, I am new to php, i was doing some small chnages in a project developed by my collegue who left the job and i got the responsibility for that, After doing some changes when i run it on my local server it was working fine but giving some errors those are Notice: Undefined index: phplogin in C:\Inetpub\wwwroot\sampleft\index.php on line 116 Notice: Undefined variable: username in C:\Inetpub\wwwroot\sampleft\index.php on line 116 ...
3
2847
by: mrosado | last post by:
Hi everybody, I have this problem.- The browser launch this two errors: Warning: session_start() : Cannot send session cache limiter - headers already sent (output started at /home/notasluz/public_html/administrador/Administrador.php:1) in /home/notasluz/public_html/administrador/verificaEntrada.php on line 2  Warning: Cannot modify header information - headers already sent by (output started at...
2
2008
by: sanjusb | last post by:
My problem is : Warning: session_start() : Cannot send session cookie - headers already sent by (output started at /home/xtreme/public_html/forum_tire.php:2) in /home/xtreme/public_html/forum_tire.php on line 26 My Code is : // Using PHP5 version <?php session_start();
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10216
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10049
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9997
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8873
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5309
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.