ユーザーがログインボタン(index.php)をクリックすると、ログインIDとパスワードをチェックしているchechlogin.phpを呼び出しています-
if($count==1)
{
// Register $myusername, $mypassword and redirect to file "login_success.php"
session_register("myusername");
session_register("mypassword");
$_SESSION['UserId'] = $myusername;
$_session['SessionId'] = session_id();
header("location:LoggedUser.php");
}
LiggedUser.phpで
<?php session_start(); //starting session
if (!isset($_SESSION['SessionId']) || $_SESSION['SessionId'] == '') { header("location:index.php"); } ?>
問題:正しいユーザー ID とパスワードを入力しているにもかかわらず、常に index.php ページに戻ってしまいます。