私は自分のComputer Scienceプロジェクト用のウェブサイトを作成しています。ログインページに戻った後にメッセージボックスを表示させる
私はPHP/HTMLコーディングも新しくなっています。
基本的には、この考え方です。私はログインページを持っていますが、これはあなたをウェブサイトに連れ込ませてくれるものです。しかし、拒否されたときにユーザー名/パスが正しくないことをウェブサイトに伝えたいと思います。あなたが正常にログインしたときに
<html>
<link rel="stylesheet" type="text/css" href="Style.css">
<body>
<center>
<h1 style="font-size:70px;">FitnessHub<h1>
<p>Enter Username & Password to get started</P>
<form action="Welcome.php" method="post">
<table>
<tr>
<td><input type="text" name="username" placeholder="Username" style="width:400px;height:30px;"></td>
</tr>
<tr>
<td><input type="password" name="password" placeholder="Password" style="width:400px;height:30px;"></td>
</tr>
</table>
<input type="submit" value="Login" style="width:100px;height:30px;">
<br>
</form>
<img src="fitnesshub.png" alt="logo" style="width:400px;height=300px;">
</center>
</body>
</html>
そしてここに歓迎のページです:ここで
は、ログインページがある
<html>
<link rel="stylesheet" type="text/css" href="Style.css">
<body>
<h1> Hello <?php echo $_REQUEST[username] ?> </h1>
<p style="Font-Size:15px;">FitnessCenter can be used to book customers into multiple services<br>
Use the buttons to start using the database
</p>
<?php
$db = new mysqli("127.0.0.1", "root", "root", "fitnessbooking");
$query= $db->query("select Username from users where Username = '$_POST[username]' and Pass = '$_POST[password]'");
if ($query->num_rows ==1){
echo "";
}
else {
header("Location: http://localhost/pages/login.php");
exit;
}
?>
</body>
</html>
私が言ったように、私はウェブサイトのもので、何の専門家でないので、してみてください私が理解できる方法で事を説明する!
ありがとうございました
[ユーザーを別のWebページにリダイレクトした後にメッセージを表示する](http://stackoverflow.com/questions/12249906/displaying-a-message-after-redirecting-the-user-to-another-web-page ) – FirstOne
の代わりに、すぐにウェルカムページに投稿するフォーム、投稿する別のPHPページを作成し、資格情報をチェックし、悪い場合はそれを拒否するか、それとも良い場合はwelcome.phpに送信してください – Derek