我需要帮助来为我的网站创建登录并将其连接到数据库。
这是php代码
<?php
session_start();
include("dbconnect.php");
$numrows=0;
$member=$_GET['Membership_Number'];
$password=$_GET['Password'];
$query="select First_name, Last_name, Membership_Number from members where (Membership_Number='$member' && Password='$password')";
$link = mysql_query($query);
if (!$link) {
die('login error');
}
$numrows=mysql_num_rows($link);
if ($numrows>0){ // authentication is successfull
$row = mysql_fetch_array($link, MYSQL_ASSOC);
$_SESSION['user']['first_name']=$row['fname'];
$_SESSION['user']['last_name']=$row['lname'];
$_SESSION['user']['email']=$row['email'];
header("location:index.php");
} else {
header("location:../invalid.php"); // authentication was unsuccessfull
}
?>
这是 HTML 代码
<form id="jjjj" method="post" action="Send_log_details.php" class="register">
<ul>
<li>
Membership Number:<br>
<input type="text" id="Membership_Number" name="Membership_Number">
</li>
<li>
Password:<br>
<input type="password" id="Password" name="Password" value="Login">
</li>
<li>
<input type="submit" name="register" value="Login" onclick="logMeIn()">
</li>
</ul>
</form>
有人可以解释为什么这段代码不起作用
谢谢