> 
> On 02 October 2003 17:27, Jeff McKeon wrote:
> 
> > Ok,
> > 
> > I've got a login page that has these funtions to set the userid and 
> > password to session variables....
> > 
> > [code start]
> > session_start();
> >     if(!isset($userid)) {
> >             login_form();
> >             exit;
> > }
> > else {
> >     session_register("userid", "userpassword");
> >     $username = auth_user($userid, $userpassword);
> >     if(!$username) {
> >             session_unregister("userid");
> >             session_unregister("userpassword");
> >             echo "Authorization failed. " .
> >                      "You must enter a valid userid and password
> > combo. " .
> >                      "Click on the following link to try
> > again.<BR>\n";
> >             echo "<A HREF=\"$PHP_SELF\">login</A><BR>";
> >             echo "If you do not have login, please contact
> > Operations to obtain one.<br>\n";
> >             exit;
> >     }
> >     else echo "welcome, $username!";
> > }
> > [code end]
> > 
> > I then have a simple test page with the following code...
> > 
> > [code start]
> > <?php
> > include "./register_functions.php";
> > 
> > if($_SESSION['userid'] == 'bob'){
> >     Echo $_SESSION['userid'];
> >     Echo"Access Denied Bobby boy!!!";
> >     }
> >     else {
> >     echo"OK, since it's not Bob, it's ok";
> >     }
> > html_footer();
> > [code end]
> > 
> > The problem is that the $_SESSION['userid'] doesn't return 
> anything on 
> > this page.. Am I not calling the session variable correctly or not 
> > storing it correctly? In my php.ini I have globals turned 
> off.  Does 
> > this effect it?
> 
> (1) I don't see a session_start() on the second page (unless 
> it's in register_functions.php?).
> 

OK, including session_start(); at the top of the test_auth.php page
worked.

> (2) I would advise not mixing $_SESSION and 
> session_register() -- it's problematical in some situations.  
> Just stick to using the $_SESSION array.
> 

I'm not quite sure what you mean here, can you give an example or
elaborate.  Sorry, real newbie here... :o)

Thanks,

Jeff

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to