Got a small session variables problem here. I set a session variable on one page, but it will not display on the next page. Here is the code (Linux OS).
<?php
session_start();
session_register(\"sessionusername\");
session_register(\"sessionpassword\");
$sessionusername=\"user\";
$sessionpassword=\"open\";
if ( ( !isset( $PHP_AUTH_USER )) || (!isset($PHP_AUTH_PW))
|| ( $PHP_AUTH_USER != $sessionusername ) || ( $PHP_AUTH_PW != $sessionpassword )
) {
header( \'WWW-Authenticate: Basic realm=\"Private\"\' );
header( \'HTTP/1.0 401 Unauthorized\' );
echo \'Authorization Required.\';
exit;
} else {
echo(\"blah, whatever, the rest of the page\");
}
?>
And here is the next page that I use to display the variables. But they don\'t. The two echo statements @ the top are just to see if the data is being passed. The first two variables are displaying fine, but the ones in the second echo are not.
<?php
echo($PHP_AUTH_USER.\"---\".$PHP_AUTH_PW.\"<br>\");
echo($sessionusername.\"---\".$sessionpassword);
if (( !isset( $PHP_AUTH_USER )) || (!isset($PHP_AUTH_PW)) || ($PHP_AUTH_USER != $sessionusername) || ($PHP_AUTH_PW !=$sessionpassword)) {
header( \'WWW-Authenticate: Basic realm=\"Private\"\' );
header( \'HTTP/1.0 401 Unauthorized\' );
echo \'Authorization Required.\';
exit;
} else {
?>
Page stuff....
<?
}
?>
I am a rookie at this php stuff, so hopefully there is a nice easy solution... I looked throught the forums, but most folks were getting some kind of error - I am not.
dave