?? login.php
字號:
<!--管理員登陸頁面-->
<?php
$name=$_POST["name"];
//如果用戶提交了登錄信息,則連接到數據庫,與數據庫中的信息相比較
if($name!="")
{
$password=$_POST["password"];
$id=mysql_connect("localhost","root","1234");
mysql_select_db("gbook",$id);
$query="select * from admin where username='" . $name . "'";
$result=mysql_query($query,$id);
if(mysql_num_rows($result) < 1)
{
echo "該用戶不存在!請重新登陸!";
}
else{
$info=mysql_fetch_array($result);
if($info['userpass']!=$password)
{
echo "密碼輸入錯誤,請重新登陸!";
}
else
{
//如果用戶名密碼都正確,則注冊一個session來標記其登錄狀態.
session_start();
$_SESSION["login"]="YES";
echo "<script language=javascript>alert('登錄成功');location.href='manage.php';</script>";
exit;
}
}
mysql_close($id);
}
?>
<html>
<head>
<title>歡迎使用簡約不簡單-我的留言本
</title>
<style type=text/css>
TD{
font-size:12px;
line-height:150%;
}
</style>
</head>
<body>
<table border=1 cellspacing=0 cellpadding=0 style="border-collapse:collapse" align=center width=400 bordercolor=black height="358">
<tr>
<td height=100 bgcolor=#6c6c6c>
<font style="font-size:30px;line-height:30px" color=#ffffff face="黑體">簡約不簡單-我的留言本</font></td>
</tr>
<tr>
<td height=25> <a href=send.php>[我要寫留言]</a> <a href=login.php>[管理留言]</a></td>
</tr>
<tr>
<td height=178>
<form method="POST" action="login.php">
<table border="1" width="95%" id="table1" cellspacing="0" cellpadding="0" bordercolor="#808080" style="border-collapse:collapse" height="154">
<tr>
<td colspan="2" height="29">
<p align="center">歡迎管理員登錄</td>
</tr>
<tr>
<td width="32%">
<p align="right">用戶名:</td>
<td width="67%"> <input type="text" name="name" size="20"></td>
</tr>
<tr>
<td width="32%">
<p align="right">密 碼:</td>
<td width="67%"> <input type="password" name="password" size="20"></td>
</tr>
<tr>
<td width="99%" colspan="2">
<p align="center"><input type="submit" value="登錄" name="B1"></p></td>
</tr>
</table>
</form>
</td>
</tr>
<tr><td height=60 bgcolor=#6c6c6c align=center>
<font color=#FFFFFF>版權所有:我的工作室<br>E-mail:lovejingru@yeah.net
</td>
</tr>
</table>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -