Jump to content

Session variables are not being read


Go to solution Solved by mac_gyver,

Recommended Posts

I am finally making the upgrade from PHP 5.3 to PHP 7.3.  When converting over the code I noticed that session some sessions are not being processed.  My test code for this is below:

 

session_start(); 
include ("../includes/connect.inc");

echo "hiiiiiiii: ".$currentDate;
echo "Here: ".$_SESSION['user'];


if (isset($_SESSION['user']))
{
	$user = $_SESSION['user'];
	$currentDate = date("Y/m/d");

}
else
{
	echo "Session not started: ";
}

 

My include is listed below:

$link = mysqli_connect('localhost', 'root', ''); 
if (!$link) { 
    die('Could not connect: ' . mysql_error("Connection error message")); 
} 
mysqli_select_db($link, 'dbname') or die (mysqli_error($link)); 



date_default_timezone_set('America/Chicago');

define ("TZ_CORRECTION", 43200);

$bkcolor = "#FFFFFF";

$currentDate = (Date("Y-m-d"));

I am not getting the message "Session not started or the current date from the include".   

If it matters I am using WAMP as my testing server

Any help is greatly appreciated.

Link to comment
https://forums.phpfreaks.com/topic/311924-session-variables-are-not-being-read/
Share on other sites

  • Solution

are you using full <?php opening tags, per the problem in one of your previous threads? https://forums.phpfreaks.com/topic/311034-includes-not-being-displayed-on-page  how about the other improvements made in that thread? you seem to have gone backwards.

 

  • 3 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.