Re: Session Variables Lost - Help



On Aug 31, 12:37 pm, 4sak3n 0ne <4sak3n...@xxxxxxxxx> wrote:
On Aug 31, 6:58 am, Eddie <eddieandr...@xxxxxxxxx> 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. My files are
below. Thanks.

Eddie

-- excerpt of login.php page

start_session();

$user= $_POST[u];
$pass= $_POST[p];

if (isset($_SESSION[user]) and ($_SESSION[user]==$user)){

$_SESSION[auth] = admin_all;
$_SESSION[user] = $user;
$_SESSION[timelast] = time();
$_SESSION[email] = 'testem...@xxxxxxxxxxxxxx';

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?

-- excerpt of index.php page

$sessname = session_name();
$sessid = session_id();
session_start();

print "<pre>\nContents of \$_COOKIE:\n";
foreach ($_COOKIE as $k => $v) {
print " $k = $v\n";

}

print "\nContents of \$_SESSION:\n";
foreach ($_SESSION as $k => $v) {
print " $k = $v\n";}

print "</pre><br>";

print "sessionuser = " . $_SESSION[user] . " <br>";
print "sessiontimelast = " . $_SESSION[timelast] . " <br>";

-- output of index.php page

Contents of $_COOKIE:
PHPSESSID = e12d796fc6e373569202c58d8f096815

Contents of $_SESSION:
user =
timelast =

Session name = PHPSESSID
Session id = e12d796fc6e373569202c58d8f096815

-- excerpt of php.ini file

session.use_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.serialize_handler = php

start_session() isn't a php function (unless you declared a function
by that name I didn't notice), replace it with session_start().

You're right. My code says session_start(). :-)

.



Relevant Pages

  • Re: Session Variables Lost - Help
    ... page, the session ID is visible, but the session variables and values ... -- excerpt of login.php page ... PHPSESSID = e12d796fc6e373569202c58d8f096815 ... start_sessionisn't a php function (unless you declared a function ...
    (comp.lang.php)
  • Re: Session Variables Lost - Help
    ... authenticating against Active Directory, ... page, the session ID is visible, but the session variables and values ... PHPSESSID = e12d796fc6e373569202c58d8f096815 ...
    (comp.lang.php)
  • Re: PHPSESSID!!!!
    ... Tom Loudon wrote: ... > The page creates a PHPSESSID on its own. ... So if you don't want to autostart session, ... It can use the coockie or the URL-rewritting for it. ...
    (comp.lang.php)
  • Re: Session creation question
    ... In Active Directory, locate the user you want to do this to and under ... > Is there a simple one two three directions on the web for creating a WTS ... > session that opens ONLY one program and exits after the program exits? ...
    (microsoft.public.windows.terminal_services)
  • Any cool solution to save ENTIRE screen content and state?
    ... even terminate the session and restart another session an hour+ later) ... I know I could write code to save the contents and state of each control ... authenticated against Active Directory. ... Frederick Volking ...
    (microsoft.public.dotnet.framework.aspnet)