使用PHP实现登录与注册功能以及使用PHP读取mysql资料库——以表格形式展现资料
登录窗口<body>
<form action=”login1.php” method=”post”>
<div>客户名:<input type=”text” name=”uid” /></div><br />
<div>密码:<input type=”password” name=”pwd” /></div><br />
<div><input type=”submit” value=http://www.shenzhoubaby.com/”登录”/>
</form>
</body>
后台登录处理<?php
$uid = $_POST[“uid”];
【用PHP制作一个简单的注册登录页面 php登录页面实现】$pwd = $_POST[“pwd”];
$db = new MySQLi(“localhost”,”root”,””,”0710_info”);
if(mysqli_connect_error()){
die(“连接失败”);
}
$sql = “select pwd from users where uid='{$uid}'”;
//echo $sql;
$result = $db->query($sql);
$arr = $result->fetch_row();
//以免sql注入进攻
if($arr[0]==$pwd && !empty($pwd)){
//跳转到主窗口(php方法)
header(“location:register_system.php”);
//js跳转页面方法
/*echo “<script>
window.location.href=http://www.shenzhoubaby.com/’register_system.php’
</script>”;*/
}else{
header(“location:login_system.php”);
}
?>
注册窗口<body>
<form action=”register1.php” method=”post” >
<div style=”font-size:20px; font-weight:1000; font-family:微软雅黑; margin-left:50px; margin-bottom:20px”>客户注册</div>
<div>客户名:<input type=”text” name=”uid” /></div><br />
<div>登录密码:<input type=”password” name=”pwd” /></div><br />
<div>姓名:<input type=”text” name=”name” /></div><br />
<div>性别:
<input type=”radio” name=”sex” value=http://www.shenzhoubaby.com/”1″ />男
<input type=”radio” name=”sex” value=http://www.shenzhoubaby.com/”0″ />女
</div><br />
<div><input type=”submit” value=http://www.shenzhoubaby.com/”注册” onclick=”return check()”/>