PHP Session variables not saving between pages? -
login page:
<?php session_start(); #echo session_id (); $_session["auth"]= "yes"; echo '<a href="portaltest.php?t='.time().'">portal page link. auth set to: {$_session["auth"]}</a>'; ?>
portal page:
<?php session_start(); echo "auth = {$_session["auth"] } <br />"; echo session_id (); ?>
the auth
session lost between 2 pages somehow!
edit
here test url:
http://proserv01.services.lyris.com/nfpinsurance/unsegmentedmemberreport/logintest.php
when trouble-shooting sessions, there few things tend do, let's start code.
here updated version of page code see value stored in $_session['auth'] (your quotes causing trouble):
<?php session_start(); $_session["auth"] = "yes"; echo '<a href="portaltest.php?t='.time().'">portal page link. auth set to: ' . $_session["auth"] . '</a>'; ?>
here updated version of portal page, removes additional space after closing curly bracket:
<?php session_start(); echo "auth = {$_session["auth"]} <br />"; ?>
now, if don't see auth these revisions, can try:
- changing code in portal dumps out session can see you've got: session_start(); var_dump($_session);
- checking make sure error reporting enabled, php helps identify many potential issues quite (e.g., index doesn't exist, headers sent, etc.): ini_set('display_errors','1'); error_reporting(e_all);
- you can check php config file (php.ini) make sure there no settings causing session issues directly.
Comments
Post a Comment