Sessions and Cookies

From: Date: Wed, 05 Feb 2003 05:01:12 +0000
Subject: Sessions and Cookies
Groups: php.general 
Request: Send a blank email to php-general+get-134370@lists.php.net to get a copy of this message
I'm trying to use cookies in PHP4 (.whatever the latest release is). I want to use them for validation (ensuring a user has logged in) but all I can find is setcookie, which seems only to create the cookie. In trying to use PHP sessions, I end up with odd errors. When I try to use sessions I get the error message the header has already been sent. I've pasted them below (I was getting different errors before I moved the code before the < html > tag). Warning: Cannot send session cookie - headers already sent by (output started at /home/allan/public_html/sestest2.php:10) in /home/allan/public_html/verifysession.php on line 6 Warning: Cannot send session cache limiter - headers already sent (output started at /home/allan/public_html/sestest2.php:10) in /home/allan/public_html/verifysession.php on line 6 My Questions: If I create a cookie with set_cookie how do I read it/check it? How do I use sessions if they can't be sent in the code? What use are sessions if I can only mess with them in one place? What if I need to do some processing first to decide what to do with them? Any insight is welcome. Allan Cleaveland Webmaster and Computer Technician Math Department Univeristy of Arkansas

« previous php.general (#134370) next »