Re: Session Broken

From: Date: Thu, 01 Jan 1970 00:00:00 +0000
Subject: Re: Session Broken
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-14132@lists.php.net to get a copy of this message
1: Rid any whitespace between '<?php' and 'session_start()' 2: You need to populate the variable you wish to use as a session variable before registering it <?php session_start(); if(!isset($UserName)){ $UserName = "guest"; session_register('"UserName'); } //----rest of script goes here ?> HTH Russ On Wed, 7 Nov 2001 20:02:03 -0500 Matthew Tedder <matthew@tedder.com> wrote: > > Can anyone tell me why my session isn't working? I have attached the problem > script. Without even going to another page, the $PHPSESSID and $UserName > variables are both empty. They are also empty on subsequent pages. > > It starts with: > ========================================================= > <?php > > session_start(); > session_register("UserName"); > > /*=====<< Check for New User Session >>=====*/ > if(!isset($UserName)) > { > $UserName = "guest"; > }; > ========================================================== > > And toward the end, it has the following: > ========================================================== > function ShowMessage($message) > { > print "<br>\n"; > print "<table border=2 align=center>\n"; > print "<tr><td align=center><font color=yellow>$UserName ($PHPSESSID): > > $message</font></td></tr>\n"; > print "</table>\n"; > } > > ?> > ========================================================== > > In this function, the variables are flat empty. > > --Matthew > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > #-------------------------------------------------------# "Believe nothing - consider everything" Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: r.j.michell@apu.ac.uk w: www.apu.ac.uk/webteam www.theruss.com #-------------------------------------------------------#

« previous php.db (#14132) next »