Hi there, make sure you aren't outputting anything to the browser prior to sending headers ie the echos on top of page 3. When you register a session variable you should assign it a value ie:
session_register("mysessionvar"); $mysessionvar = $whateveryouwish; Also make sure session_start(); is at the top of every page with no space before. These should help you out a little. Joe :) Álvaro muñoz sánchez <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, all > > First of all, I apologize if this is a dump question but I can't find the > answer. I'm trying to use sessions to keep the information about user and > password in a database driven web application. I am trying with a simple web > page but I can't make it work correctly. Help me, please. > > Environment: Red Hat Linux 7.2, Apache 1.3.20, PHP 4.0.6 > Web pages: > Page 1: web page with a form asking for a user name and password. > Page 2: php page to validate the user name and pass and register them as > session variables. > Page 3: php page to show the user name and pass introduced. > > Code: > > Page 2: > > <? session_start(); ?> > <? $sessionid = session_id(); ?> > <? session_register ( $usr, $password, $sessionid); ?> > > Page 3 > > <? session_start(); ?> > <? echo $GLOBALS["usr"]; ?> > <? echo $GLOBALS["password"]; ?> > > Results: > Page 2: Opening the session > Warning: Cannot send session cookie - headers already sent by (output started > at /var/www/html/sigma/agenda/index.php:13) in > /var/www/html/sigma/agenda/index.php on line 27 > > Warning: Cannot send session cache limiter - headers already sent (output > started at /var/www/html/sigma/agenda/index.php:13) in > /var/www/html/sigma/agenda/index.php on line 27 > > Page 3: the same warnings and the value of the session variables is lost. > > Here are my settings for sessions in the php.ini, It could be a configuration > mistake. > > session.save_handler = files > session.save_path = /tmp > session.use_cookies = 1 > session.name = PHPSESSID > session.auto_start = 0 > session.cookie_lifetime = 0 > session.cookie_path = / > session.cookie_domain = > session.serialize_handler = php > session.gc_probability = 1 > session.gc_maxlifetime = 1440 > session.referer_check = > session.entropy_length = 0 > session.entropy_file = > session.cache_limiter = nocache > session.cache_expire = 180 > session.use_trans_sid = 1 > > I know that questions related to sessions had been treated in the list before > but I can't find the answer to this, so I think this must be a very stupid > question, sorry. > > > Thank you very much in advanced. > -- > --------------------------------- > Álvar Muñoz Sánchez > Oficina Verde - UPV > Información y Documentación > --------------------------------- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php