有人可以帮我用我的 PHP 登录页面实现这个 HTML 吗?由于某种原因,该页面无响应。
这是HTML代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<link rel="stylesheet" href="css/screen.css" type="text/css" />
<!--[if ite - 8]><link rel="stylesheet" href="css/screen_ie.css" type="text/css" /><![endif]-->
<meta http-equiv="content-type" content="text/html; charset=windows-1251" />
<title>Index</title>
</head>
<body>
<div id="block">
<div class="logo"><img src="img/logo.png" alt="" /></div>
<div class="form">
<p class="login-box">Login box</p>
<div class="warning"><p>Wrong password, please try again.</p><p class="c"> </p></div>
<input type="text" value="Username"/>
<input type="text" value="*******"/>
<p class="btn">
<input type="button" value="Login"/>
</p>
<ul class="nav-path">
<li><a href="#">Forgot your password?</a></li>
<li><a href="#">Create new account</a></li>
</ul>
<i class="ctop"> </i>
<i class="cbottom"> </i>
</div>
</div>
</body>
</html>
这是带有临时表单的当前 PHP 登录页面:
<?php
include("db.php");
session_start();
if($_SERVER["REQUEST_METHOD"] == "POST")
{
// username and password sent from Form
$username=mysql_real_escape_string($_POST['username']);
$password=mysql_real_escape_string($_POST['password']);
$password = sha1($password);
$sql="SELECT * FROM client_login WHERE Username='$username' and Password='$password'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
$row = mysql_fetch_array($result);
$client_ref = $row['Client_ref'];
$user_level = $row['user_level'];
// If result matched $username and $password, table row must be 1 row
if($count==1)
{
$_SESSION['user_level'] = $user_level;
$_SESSION['client_ref'] = $client_ref;
$_SESSION['user'] = $username;
if ($user_level == '1') {
header('Location: admin.php');
} else {
header('Location: myaccount.php');
}
}
else
{
echo "Error logging in!";
}
}
?>
<form action="login.php" method="post">
<label>UserName :</label>
<input type="text" name="username"/><br />
<label>Password :</label>
<input type="password" name="password"/><br/>
<input type="submit" value=" Login "/><br />
</form>
任何建议或想法将不胜感激。