When trouble-shooting sessions, there are a few things I tend to do, but let's start with your code.
Here is an updated version of your page code so you actually see the value stored in $_SESSION['auth'] (your quotes were causing some trouble):
<?php
session_start();
$_SESSION["auth"] = "yes";
echo '<a href="Portaltest.php?t='.time().'">portal page link. Auth set to: ' . $_SESSION["auth"] . '</a>';
?>
Here is the updated version of the portal page, which removes the additional space after the closing curly bracket:
<?php
session_start();
echo "auth = {$_SESSION["auth"]} <BR />";
?>
Now, if you don't see the auth with these revisions, you can try:
- Changing the code in portal so it just dumps out the session so you can see what you've got: session_start(); var_dump($_SESSION);
- Checking to make sure the error reporting is enabled, as PHP helps you identify many potential issues quite quickly (e.g., index doesn't exist, the headers were already sent, etc.): ini_set('display_errors','1'); error_reporting(E_ALL);
- You can check your PHP config file (php.ini) to make sure that there are no settings causing session issues directly.
$_SESSION["auth"]in the echo. The quotes will throw it off. Instead do this...echo 'auth = '.$_SESSION["auth"].' <br />";echo "$auth = ".$_SESSION["auth"]."<BR />";adding a$toauth.authshould be a variable. Am just not sure what it is you are trying to achieve.