Jump to content

Logout Session Problem


ballouta

Recommended Posts

Hello

 

I have a logout page, i put this code at the most top of the page:

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

 

But i got this error when i try to log out, please help.

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/dcompany/public_html/Login/logout.php:1) in /home/dcompany/public_html/Login/logout.php on line 1

 

Thank you

Link to comment
https://forums.phpfreaks.com/topic/136335-logout-session-problem/
Share on other sites

this is all the page code

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="rtl">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="ar-lb">

<link href="../Store/style.css" rel="stylesheet" type="text/css" />
<link href="../Store/layout.css" rel="stylesheet" type="text/css" />


<title>Logout</title>


</head>
<body>
<div class="main" id="page7">
  <div class="menu">
          <p style="text-indent: -30px">
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"
width="766" height="98">
      <param name="movie" value="../flash/members.swf?button=0" />
      <param name="quality" value="high" />
      <param name="menu" value="false" />
      <param name="wmode" value="transparent" />
      <!--[if !IE]> <-->
      <object data="../flash/members.swf?button=0"
		  width="766" height="98" type="application/x-shockwave-flash">
        <param name="quality" value="high" />
        <param name="menu" value="false" />
        <param name="wmode" value="transparent" />
        <param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer" />
        FAIL (the browser should render some flash content, not this).
      </object>
      <!--> <![endif]-->
    </object>
  </div>
  
  
  <div id="content">
    <div class="in1">
      <div class="in2">
        <div class="in3">
          <div class="col1"> 
		<p style="text-align: right; text-indent:25px" dir="rtl"> 
		<img src="../images/spacer.gif" alt="" width="1" height="20" />
					<p style="text-align: right; text-indent:35px" dir="rtl">
		<b><font face="Tahoma" size="2" color="#FF0000">تسجيل خروج</font></b></p>
		<p style="text-align: right; text-indent:35px" dir="rtl"> 
		</p>
		<p style="text-align: right; text-indent:35px" dir="rtl">
		<b><font face="Tahoma" size="2" color="#44A30F">you ahve signed out successfully!</font></b></p>
            
             <?php
echo "<META HTTP-EQUIV=\"refresh\" content=\"2; URL=http://www.CompanyName.com\"> ";
		?>					

		<p style="text-align: right; text-indent:35px" dir="rtl"> 
		</p>
		<p style="text-align: right; text-indent:35px" dir="rtl"> 
		</p>
		<p style="text-align: right; text-indent:35px" dir="rtl"> 
		</p>
		<p style="text-align: right; text-indent:35px" dir="rtl"> 
		</p>
		<p style="text-align: right; text-indent:35px; line-height:200%" dir="rtl">
		<img border="0" src="../images/spacer.gif" width="1" height="240"></p>
		<p style="text-align: right; text-indent:35px" dir="rtl"> 
		</p>
		<p style="text-align: right; " dir="rtl">

		</p> <!-- here it ends -->


<!--here it ends -->
		</div>
        </div>
      </div>
    </div>
  </div>
  <div id="footer" style="width: 766px; height: 76px">
    <div style="margin-left:45px; margin-top:11px;">
	<p style="text-align: right; text-indent:25px" dir="rtl">
	<font face="Tahoma"><a href="../index.php">الرئيسية</a></font>      |      <font face="Tahoma"><a href="../About~us.php">عن 
	الدار</a></font>      |      <font face="Tahoma"><a href="../Store">الإصدارات</a></font>      |      <font face="Tahoma"><a href="../Members.php">الأعضاء</a></font>      |      <font face="Tahoma"><a href="../Search.php">البحث</a></font>      |      <font face="Tahoma"><a href="../Customer~Support.php">contact us</a></font><br />
    </div>
    <br style="line-height:16px;" />
    <div style="margin-left:45px;">
	<p style="text-align: right; text-indent:25px" dir="rtl">
	<font face="Tahoma" size="2" color="#7A7A7A">DMC Company</font></p>
	<p style="text-align: right"> </div>
  </div>
</div>
</body>
</html>

this is all the page code

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="rtl">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="ar-lb">

<link href="../Store/style.css" rel="stylesheet" type="text/css" />
<link href="../Store/layout.css" rel="stylesheet" type="text/css" />


<title>Logout</title>


</head>
<body>
<div class="main" id="page7">
  <div class="menu">
          <p style="text-indent: -30px">
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"
width="766" height="98">
      <param name="movie" value="../flash/members.swf?button=0" />
      <param name="quality" value="high" />
      <param name="menu" value="false" />
      <param name="wmode" value="transparent" />
      <!--[if !IE]> <-->
      <object data="../flash/members.swf?button=0"
		  width="766" height="98" type="application/x-shockwave-flash">
        <param name="quality" value="high" />
        <param name="menu" value="false" />
        <param name="wmode" value="transparent" />
        <param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer" />
        FAIL (the browser should render some flash content, not this).
      </object>
      <!--> <![endif]-->
    </object>
  </div>
  
  
  <div id="content">
    <div class="in1">
      <div class="in2">
        <div class="in3">
          <div class="col1"> 
		<p style="text-align: right; text-indent:25px" dir="rtl"> 
		<img src="../images/spacer.gif" alt="" width="1" height="20" />
					<p style="text-align: right; text-indent:35px" dir="rtl">
		<b><font face="Tahoma" size="2" color="#FF0000">تسجيل خروج</font></b></p>
		<p style="text-align: right; text-indent:35px" dir="rtl"> 
		</p>
		<p style="text-align: right; text-indent:35px" dir="rtl">
		<b><font face="Tahoma" size="2" color="#44A30F">you ahve signed out successfully!</font></b></p>
            
             <?php
echo "<META HTTP-EQUIV=\"refresh\" content=\"2; URL=http://www.CompanyName.com\"> ";
		?>					

		<p style="text-align: right; text-indent:35px" dir="rtl"> 
		</p>
		<p style="text-align: right; text-indent:35px" dir="rtl"> 
		</p>
		<p style="text-align: right; text-indent:35px" dir="rtl"> 
		</p>
		<p style="text-align: right; text-indent:35px" dir="rtl"> 
		</p>
		<p style="text-align: right; text-indent:35px; line-height:200%" dir="rtl">
		<img border="0" src="../images/spacer.gif" width="1" height="240"></p>
		<p style="text-align: right; text-indent:35px" dir="rtl"> 
		</p>
		<p style="text-align: right; " dir="rtl">

		</p> <!-- here it ends -->


<!--here it ends -->
		</div>
        </div>
      </div>
    </div>
  </div>
  <div id="footer" style="width: 766px; height: 76px">
    <div style="margin-left:45px; margin-top:11px;">
	<p style="text-align: right; text-indent:25px" dir="rtl">
	<font face="Tahoma"><a href="../index.php">الرئيسية</a></font>      |      <font face="Tahoma"><a href="../About~us.php">عن 
	الدار</a></font>      |      <font face="Tahoma"><a href="../Store">الإصدارات</a></font>      |      <font face="Tahoma"><a href="../Members.php">الأعضاء</a></font>      |      <font face="Tahoma"><a href="../Search.php">البحث</a></font>      |      <font face="Tahoma"><a href="../Customer~Support.php">contact us</a></font><br />
    </div>
    <br style="line-height:16px;" />
    <div style="margin-left:45px;">
	<p style="text-align: right; text-indent:25px" dir="rtl">
	<font face="Tahoma" size="2" color="#7A7A7A">DMC Company</font></p>
	<p style="text-align: right"> </div>
  </div>
</div>
</body>
</html>

try moving the session_start(); down to the second line and get rid of that space, I can't think of anything else

When the error refers to output at line 1 and you have removed or determined there is nothing before the <?php tag, your file is probably saved in UTF-8 encoding and the BOM (Byte Order Mark) characters at the start of the file is content sent to the browser and prevents headers from working. Save your file as ANSI/ASCII or if you must save it as UTF-8, save it without the BOM.

You either have content/characters before <?php or the BOM characters. If you tried to save the file without the BOM and you still got the error, then either that did not work or the file was not uploaded correctly onto the web server. Try it again.

 

How are you uploading the file to the web server? If using FTP, make sure you are using ASCII mode and not binary mode.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.