Re: NT 4.0.6 session weirdness
| From: | Chris Lee | Date: | Wed, 17 Oct 2001 22:43:56 +0000 |
| Subject: | Re: NT 4.0.6 session weirdness | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-71415@lists.php.net to get a copy of this message | ||
Try this.
Page 1:
<?php
session_start();
$PHPSESSID = session_id();
$SID = "PHPSESSID=$PHPSESSID";
$userid = 'valid';
session_register('userid');
header("Location: http://$SERVER_NAME/protectedpage.php?$SID");
exit();
?>
Page 2: (protectedpage.php);
<?php
session_start();
$PHPSESSID = session_id();
$SID = "PHPSESSID=$PHPSESSID";
if( !isset($HTTP_SESSION_VARS['userid']) )
{
$msg = urlencode('Must Login!');
header("Location: http://$SERVER_NAME/loginpage.php?msg=$msg&$SID");
exit();
}
?>
--
Chris Lee
lee@mediawaveonline.com
"Hank Marquardt" <hmarq@yerpso.net> wrote in message
news:20011017153342.A45549@hermes.yerpso.net...
> Of course I didn't state the problem ...
>
> The $userid session variable isn't passed, is 'unset' and thus always
fails to authenticate the protected page, bouncing to login.
>
> On Wed, Oct 17, 2001 at 04:21:07PM -0500, Hank Marquardt wrote:
> > I saw someone else with this problem and no answer, yet I saw sniper
blow away as "Bogus" when reported as a bug(13687) --
> >
> > Warning -- I don't do much NT work so a configuration problem could be,
but session propogation seems flaky on 4.0.6 CGI NT --
> >
> > The particulars are like this:
> >
> > Page 1:
> > <?php
> > session_start();
> > session_register("userid");
> > $userid="valid";
> > header("location:protectedpage.php");
> > exit();
> > ?>
> >
> > Page 2: (protectedpage.php);
> > <?php
> > session_start();
> > session_register("userid");
> > if(!isset($userid)) {
> > $msg=urlencode("Must Login!");
> > header("location:loginpage.php?msg=$msg");
> > exit();
> > }
> > ?>
> >
> > Most of the time this just plain doesn't work -- even though it works on
every *nix box I have (various flavors of Linux and BSD) --
> >
> > Anyone else seeing this? ... BTW, as simple session test works fine:
> >
> > <?php
> > session_start();
> > session_register("count");
> > echo "You've visited ".$count++."times!<br>";
> > ?>
> >
> > That will keep incrementing and displaying a counter on refresh, it
seems to be the page transfer/header stuff that's fubared.
> >
> > Any thoughts?
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
> --
> Hank Marquardt <hank@yerpso.net>
> http://web.yerpso.net
>
> Web & Database Development in PHP, MySQL/PostgreSQL
> Small Office Networking Solutions - Debian GNU/Linux & FreeBSD
> PHP Instructor - International Webmasters Assn./HTML Writers Guild
> *** Beginning PHP -- Starts November 5, 2001
> *** See http://www.hwg.org/services/classes
>