废话不多说,代码如下
conn.php
//公用调取数据库文件
mysql_connect("localhost","root","");
mysql_select_db("test");
mysql_query("set names 'utf8'");
?>
login.html
//登陆视图文件
用户名:
密码:
logincheck.php
//检测用户名密码是否正确
include_once("conn.php");
//print_r($_POST);
$name=$_POST['name'];
$pwd=$_POST['pwd'];
$sql="select * from user where name='$name' and password='$pwd'";
$query=mysql_query($sql);
$result=mysql_fetch_array($query);
if ($result){
print "跳转点击";
}
else{
echo '登录失败';
}
?> 很简单很使用的一个小程序