ユーザーは最初にログインを求められます。ログインが成功した場合、ユーザーは index.php に送信されます。詳細を再入力するよう求められます。
ユーザーがログインした後、ユーザー名をindex.phpに表示したい。
そのため、index.phpファイルのecho関数をGET
ログインからのユーザー名に使用します
//check to see if they match
if($username==$dbusername&&$password==$password)
{
$_SESSION['username']=$username;
echo "Welcome '.$username.'";
header('Location: nindex.php');
die();
}
else
echo "incorrect password";
}
else
die("That user does not exist");
}
else
die("please provide a username and password");
?>