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:

  1. changing code in portal dumps out session can see you've got: session_start(); var_dump($_session);
  2. 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);
  3. you can check php config file (php.ini) make sure there no settings causing session issues directly.

Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -