Hi Jeff

Don't use session_register() just use the $_SESSION superglobal as you would
use any other array.

So does this work?

// Login stuff done OK
$_SESSION['verified'] = true;

// Other pages needing a valid login
if (!isset($_SESSION['verified'])) {
        // push user back to login page
        header('Location: http://mysite/index.php');

> -----Original Message-----
> From: Baumgartner Jeffrey [mailto:[EMAIL PROTECTED]]
> Sent: 18 February 2003 11:20
> Subject: [PHP-DB] Session variables when global variables switched off
> [Sorry, first message accidentally fired off to quickly ]
> [sorry for the incomplete posting of a couple moments ago. I hit ctl
> something or other and outlook fired off the e-mail against my wishes!]
> I am making a section on a web site which requires that visitors log-in.
> Log-in, password, etc are in an MySQL table. I am using (via a
> web host) PHP
> 4.2.2 with global variables turned off. Until now, I have worked with a
> different host in which global variables were switched on.
> The way it works
> The user logs in at index.php. When she does so successfully, index.php
> returns a menu of links. However, if she clicks on any of those
> links, which
> are different pages, she gets a please log-in first message because each
> page includes...
> if ($_SESSION['verified'] <> "yes"){
> echo "<P><a href='index.php'>Please log in first</a></P>";
> exit();
> }
> Returning to index.php requires a log-in again.
> So, it seems the session variable is not being sent being sent between
> pages, although it works within the same page. I expect I am missing
> something obvious. I've made this kind of thing work with global variables
> on - so I assume I am misunderstanding something related to lack of global
> variables.
> I use
> session_start();
> at the top of all pages and
> session_register($_SESSION['okbabe']);
> on index.php.
> Your enlightenment will be highly appreciated.
> Jeffrey Baumgartner

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

Reply via email to