Reply to Re: Session Variables Lost - Help

Your name:

Reply:


Posted by Aaron Saray on 09/01/07 14:42

On Aug 31, 10:35 pm, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> On Fri, 31 Aug 2007 15:58:43 +0200, Eddie <eddieandr...@gmail.com> wrote:
> > I am having difficulty in setting variables in a session, and then
> > accessing those variables throughout the web pages that they click
> > on. After having them set a user name and password, successfully
> > authenticating against Active Directory, I send them from the
> > login.php page to the index.php page. But when I get to the index.php
> > page, the session ID is visible, but the session variables and values
> > are not. Can you help me out? Also, I'm curious how to distinguish
> > between various sessions if multiple ones are available.
>
> Multiple sessions in a single request are not really supported using
> 'normal' PHP. It is theoretically possible, but it would require a lot of
> tinkering, and normally wouldn't be something you want.
>
> > -- excerpt of login.php page
>
> > start_session();
>
> > $user= $_POST[u];
> > $pass= $_POST[p];
>
> > if (isset($_SESSION[user]) and ($_SESSION[user]==$user)){
>
> How does $_SESSION['user'] (mind the quotes as indicated earlier) get set
> _before_ this if statement? In these excerpts it will not be set anywhere,
> so all the code in the if statement will not run?
>
>
>
> > $_SESSION[auth] = admin_all;
> > $_SESSION[user] = $user;
> > $_SESSION[timelast] = time();
> > $_SESSION[email] = 'testem...@testdomain.com';
>
> > header('Location:http://mydomain.com/index.php');
> > }
>
> > but when I go to the on to the index.php page, I cannot see the
> > results. What am I missing?
>
> Heed Erwin's advice about error_reporting(E_ALL); (and possibly an
> ini_set('display_errors',true); If these are true excerpts there are more
> problems then just the carrying on of a session.
> --
> Rik Wasmus
>
> My new ISP's newsserver sucks. Anyone recommend a good one? Paying for
> quality is certainly an option.

I would try using session_write_close() right before your header()
statement - and see if that helps. From time to time, setting new
variables in sessions won't stick for whatever reason, unless you
close a session on that page first.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация