Re: plz check the warning message
| From: | Balaji Ankem | Date: | Fri, 10 Aug 2001 10:38:19 +0000 |
| Subject: | Re: plz check the warning message | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-62150@lists.php.net to get a copy of this message | ||
Hi, munnik,
thankyou for u'r help.
I am getting the following warning while closing session.
Warning: Trying to destroy uninitialized session in c:\www\logout.php on line 3
session closed for 85744
Plz do the needful. I am sending the following files.
logout.php
<?php
session_unregister(emp_id);
session_destroy();
echo "session closed for $emp_id";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE>Thankyou </TITLE>
<meta http-equiv="Expires" CONTENT="0">
<meta http-equiv="Cache-Control" CONTENT="no-cache">
<meta http-equiv="Pragma" CONTENT="no-cache">
</HEAD>
<BODY background="nightsky.gif" text="white">
<p>
<center><h1>THANKYOU FOR USING IMAC TOOL</h1></center><br><br>
<center> <h3>Do you want to login again?</h3><a
href="login.php">clickhere</a> </center>
</p>
</BODY>
</HTML>
Authentication.php
<?php
header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");
// Connect to MySQL
mysql_connect( 'localhost', 'balaji', 'pingpong' )
or die ( 'Unable to connect to server.' );
// Select database on MySQL server
mysql_select_db( 'imac' )
or die ( 'Unable to select database.' );
// Formulate the query
$sql = "SELECT * FROM employee WHERE
emp_id = '$emp_id' AND emp_pass = '$emp_pass'";
// Execute the query and put results in $result
$result = mysql_query( $sql )
or die ( 'Unable to execute query.' );
// Get number of rows in $result.
$num = mysql_numrows( $result );
if ( $num != 0 ) {
// A matching row was found - the user is authenticated.
$auth = true;
session_start();
session_register(emp_id);
$row = mysql_fetch_object($result);
if ($row->user_type=='S')
{
include('super.php');
}
else if ($row->user_type=='O')
{
include('ordinary.php');
}
}
else
{
file://User does not exist or not authenticated.
echo '<center><h1>Authorization Required.</h1></center>';
header( 'WWW-Authenticate: Basic realm="Private"' );
header( 'HTTP/1.0 401 Unauthorized' );
exit;
}
?>
Thanks in advance
With warm Regards
-Balaji
----- Original Message -----
From: Renze Munnik
To: Balaji Ankem ; Yamin Prabudy
Cc: php-general@lists.php.net
Sent: Friday, August 10, 2001 2:49 PM
Subject: Re: [PHP] plz check the warning message
On Fri, Aug 10, 2001 at 02:44:09PM +0530, Balaji Ankem wrote:
>
> Warning: Cannot send session cache limiter - headers already sent (output started at
> c:\www\authentication.php:2) in c:\www\authentication.php on line 38
>
I don't know what's in authentication.php, but I do know that -like
the warningmsg says- you try to send headers while on line 2 you've
already sent some output (echo, print, whatever).
You'll have to put the session_start() before your output.
--
* R&zE:
-- »»»»»»»»»»»»»»»»»»»»»»»»
-- Renze Munnik
-- DataLink BV
--
-- E: renze@datalink.nl
-- W: +31 23 5326162
-- F: +31 23 5322144
-- M: +31 6 21811143
-- H: +31 23 5516190
--
-- Stationsplein 82
-- 2011 LM HAARLEM
--
-- http://www.datalink.nl
-- ««««««««««««««««««««««««
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net
----------------------------------------------------------------------------------------------------------------------- Information transmitted by this E-MAIL is proprietary to Wipro Limited and is intended for use only by the individual or entity to which it is addressed, and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient or it appears that this mail has been forwarded to you without proper authority, you are notified that any use or dissemination of this information in any manner is strictly prohibited. In such cases, please notify us immediately at mailto:mailadmin@wipro.com and delete this mail from your records. ------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------- Information transmitted by this E-MAIL is proprietary to Wipro Limited and is intended for use only by the individual or entity to which it is addressed, and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient or it appears that this mail has been forwarded to you without proper authority, you are notified that any use or dissemination of this information in any manner is strictly prohibited. In such cases, please notify us immediately at mailto:mailadmin@wipro.com and delete this mail from your records. ------------------------------------------------------------------------------------------------------------------------