I don't know if this will fix anything or not but instead of using check_valid_user(), try making the if statement say this:
is(!isset($_SESSION['valid_user)) { echo "NOT LOGGED IN"; } else { echo "LOGGED IN"; } ----- Original Message ----- From: "Martin Hudec" <[EMAIL PROTECTED]> To: "1LT John W . Holmes (U.S. Army)" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Thursday, December 05, 2002 8:18 AM Subject: [PHP] code for my question about sessions ;) sorry > Hello , > > okay here's the code...sorry forgot to post it.... > everything works in login.php....session is registered...but in index, > it seems that session is empty... > > login.php: > <? > session_start(); > include ("forum_fns.php"); > login($username); > echo "<script language=\"JavaScript\">"; > //reloads index.php (login.php is popup from index.php > echo "window.opener.location.reload();"; > echo "setTimeout('window.close()',1000)"; > echo "</script>"; > ?> > > ************ > index.php: > <? > session_start(); > include ("forum_fns.php"); > if (check_valid_user()) > { > $login_status = true; > } > else > { > $login_status = false; > } > if ($login_status == false) > { > echo "LOGGED IN"; > } > else > { > echo "NOT LOGGED IN"; > } > > ?> > > ************ > forum_fns.php: > <? > //will just set $username.... > //we are talking only about session all other works > $username = "Corwin"; > > function login($username) > { > global $valid_user; > $valid_user = $username; > session_register("valid_user"); > } > > function check_valid_user() > { > if (session_is_registered("valid_user")) > { > echo "\$valid_user registered<br>"; > return true; > } > else > { > echo "\$valid_user not registered!!<br>"; > return false; > } > } > ?> > > > > -- > Best regards, > Martin mail [EMAIL PROTECTED] > mobile +421.907.303.393 > icq 34358414 > www http://www.corwin.sk > > PGP key fingerprint 21365ca05ecfd8aeb1cf19c838fff033 > > "In those days spirits were brave, the stakes were high, > men were real men, women were real women and small furry > creatures from Alpha Centauri were real small furry creatures > from Alpha Centauri." > > by Douglas Adams > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php