【php开源代码栏目提醒】:网学会员为需要php开源代码的朋友们搜集整理了16_4.php相关资料,希望对各位网友有所帮助!
<?php
//引用公用文件
include_once("16_1.php");
//判断用户是否提交登录数据
if(isset($_GET["action"]) and $_GET["action"]=="login"){
$username = $_POST["name"];
$password = $_POST["pwd"];
$rs = $conn->Execute("select * from members where username = '".$username."' and password = '".md5($password)."'");
if($rs->RecordCount()>0){
setcookie("username",$username,time()+3600);
setcookie("pass
word",md5($password),time()+3600);
print "<script>
alert('登录成功.');
window.location.href='16_5.php?ListItem=true';
</script>";
}else{
print "<script>
alert('用户名或密码错误.');
window.location.href='16_4.php';
</script>";
}
}else{
//显示登录界面
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD X
HTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>管理员登录</title>
<link href="templates/style.css" rel="stylesheet" type="text/css" />
</head>
<body><br /><br /><br /><br /><br /><br />
<table width="248" height="144" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#FFFFFF"><form id="form1" name="form1" method="post" action="16_4.php?action=login">
<table border="0" align="center" cellpadding="0" cellspacing="5">
<tr>
<td colspan="2" bgcolor="#efefef"><div align="center">内容
管理系统</div></td>
</tr>
<tr>
<td>用户名:</td>
<td><label>
<input name="name" type="text" id="name" />
</label></td>
</tr>
<tr>
<td>密码:</td>
<td><label>
<input name="pwd" type="password" id="pwd" />
</label></td>
</tr>
<tr>
<td> </td>
<td><label>
<input type="submit" name="Submit" value="提交" />
</label></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>
<?php
}
?>