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.
";` – CP510 Aug 20 '13 at 01:10
";` adding a `$` to `auth`. `auth` should be a variable. Am just not sure what it is you are trying to achieve. – Funk Forty Niner Aug 20 '13 at 01:16
` with a line break. *Confused and baffled* – Funk Forty Niner Aug 20 '13 at 01:21
";` supposed to print/echo `auth = yes` ? Is that your expected result? Or as `href` => `portal page link. Auth set to: yes` ? – Funk Forty Niner Aug 20 '13 at 01:55