RE: [PHP-DB] RE: regarding session
| From: | Smita Manohar | Date: | Thu, 19 Sep 2002 06:30:52 +0000 |
| Subject: | RE: [PHP-DB] RE: regarding session | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-21844@lists.php.net to get a copy of this message | ||
thanks !
its working fine now.
but again one question. (simple one , but i couldnt find the answer ) :-(
after user logs in, on each page i check whether valid session has been created. if not, then i wish to redirect to the login page. doing as,
if(!session_is_registered("UserID"))
{
header("Location: login.php");
}
else
{
... some other stuff, if user is logged in...
}
here, while redirecting to login.php , its giving "Cannot add header information - headers already sent " error.
whats wrong in the header function im using? or what changes i need to do in login.php to get it done??
thanks in advance :-)
smita.
From: "John Holmes" <holmes072000@charter.net> Reply-To: <holmes072000@charter.net> To: "'Smita Manohar'" <smitamanohar@hotmail.com>,<php-db@lists.php.net> Subject: RE: [PHP-DB] RE: regarding session Date: Wed, 18 Sep 2002 06:58:17 -0400 You must call session_start() _before_ any output is sent to the browser. This means before <html> or any other output at all. ---John Holmes... -----Original Message----- From: Smita Manohar [mailto:smitamanohar@hotmail.com] Sent: Wednesday, September 18, 2002 6:09 AM To: php-db@lists.php.net Subject: [PHP-DB] RE: regarding session Graeme , Terry : thnx for reply :) now some picture is clear in my head regarding session handling. i did the stuff as u suggested. but getting error msg as , Warning: Cannot send session cache limiter - headers already sent (output started at c:\phpdev\www\mediawatch\mast_maint.php:9) in c:\phpdev\www\mediawatch\mast_maint.php on line 10 Warning: Cannot add header information - headers already sent by (output started at c:\phpdev\www\mediawatch\mast_maint.php:9) in c:\phpdev\www\mediawatch\mast_maint.php on line 26 is it needed to pass session id with every url which is restricted for registerd users only ? i read in book that , if you compile PHP with the flag, enable-trans-sid, the seesion id will be automatically appended to every relative link in ur pages once a session has been started. i saw the flag session.use_trans_sid = 1 is set in php.ini file what is the use of this flag?? why im getting such error msg? please help me out. smita. _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php_________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com