<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 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=utf-8" /> |
<title>无标题文档</title> |
</head> |
<body> |
<!--登录业务逻辑--> |
<?php |
//获取前台用户提交数据 |
if (isset( $_POST [ 'submit' ])){ |
$userName = $_POST [ 'username' ]; |
$passWord = $_POST [ 'password' ]; |
//连接数据库 |
$sql = "SELECT * FROM username='$userName' and password='$passWord'" ; |
$result = $dbcn ->query( $sql ); |
if ( $result ->rowCount()==1){ |
echo '登录成功!' ; |
//跳转到商品显示页面showgoods.php |
|
header( 'location:showgoods.php' ); |
|
} |
else { |
echo '请重新输入!' ; |
} |
} |
?> |
<!--用户登录的页面--> |
<form id= "form1" name= "form1" method= "post" action= "" > |
<table width= "500" border= "1" align= "center" > |
<tr> |
<th colspan= "2" >用户登录</th> |
</tr> |
<tr> |
<td>用户名:</td> |
<td><label for = "usename" ></label> |
<input type= "text" name= "username" id= "username" /></td> |
</tr> |
<tr> |
<td>密码:</td> |
<td><input type= "text" name= "password" id= "password" /></td> |
</tr> |
<tr> |
<td colspan= "2" align= "center" ><label for = "pwd" > |
<input type= "submit" name= "提交" id= "提交" value= "提交" /> |
</label></td> |
</tr> |
</table> |
</form> |
</body> |
</html> |