<form action='login.php' method='POST'>
Username: <input type='text' name='Username'><BR>
Password: <input type='password' name='Password'><BR>
<input type="checkbox" name="remember" > Rember Me
<input type='submit' value='Log in'>
<a href="reg.php"> Register </a>
<?php
session_start();
include 'db.php';
$Username = $_POST['Username'];
$Password = $_POST['Password'];
if ($Username&&$Password)
{
$query = mysql_query("SELECT * From Users WHERE Username='$Username'");
$numrow = mysql_num_rows($query);
if ($numrow!=0)
{
while ($row = mysql_fetch_assoc($query))
{
$Username = $row['Username'];
$Password = $row['Password'];
}
// check to see if they match
if ($Username==$Username&&$Password==$Password)
{
echo "You're in. <a href='index.php'>Click</a> here to enter the member page";
$_SESSION['Username']=$Username;
}
else
echo "Incorrect password";
}
else
die("That user doesn't exist");
}
else
die ("please enter a username and a password");
?>
誤差即時得到是:說明:未定義指數誤差
說明: 未定義指數:用戶名在/home/stud/0/1314683/public_html/MathsrUs/login.php在線路48上的通知:未定義指數:密碼在/home/stud/0/1314683/public_html/MathsrUs/login.php在線49
您的代碼在一個文件或兩個單獨的文件中。另外你的文件操作是一些東西,但你的按鈕是一個鏈接正在把你帶到別的地方? –
都在與html和php相同的名爲login.php的文件中。 –