留言板php数据库设计 留言板的数据库设计

如何用php做出登陆注册留言板登录页留言板php数据库设计:login.php
【留言板php数据库设计 留言板的数据库设计】?php
include("conn.php");
$username=$_POST['name'];
$password=$_POST['password'];
$yanzheng=$_POST['yanzheng'];
if(isset($_POST['submit']))
{
$sql=("select username,password from member where username='$username' and password='$password'") or die("sql语句执行失败");
//print_r($sql);
$ar=mysql_query($sql);
if($ar)
{
if($row=mysql_fetch_array($ar))
{
session_start();
if($_POST["yanzheng"])
{
if($yanzheng!=$_session[pic]||$yanzheng=="")
{
echo "验证码输入有误";
exit;
}
if($yanzheng==$_session[pic])
{
header("location:index.php");
}
}
}
else
{
echo "用户名或密码错误";
}
}
}
?
form action="login.php" method="post"
table border=1 align=center width=500 height=300 bgColor=#DFFFDF bordercolor=#fffbec
tr
td colspan=2 align=center用户登录/td
/tr
tr
td用户姓名:/td
tdinput type="text" name="name" id="name"//td
/tr
tr
td用户密码:/td
tdinput type="password" name="password" id="password"//td
/tr
tr
td验证码:/td
tdinput type="text" name="yanzheng" id="yanzheng"/
img src="/images/defaultpic.gif"/img
/td
/tr
tr
td colspan=3 align=center
input type="submit" name="submit" value="https://www.04ip.com/post/登录"/
input type="reset" name="reset" value="https://www.04ip.com/post/重置"/
a href="https://www.04ip.com/post/register.php"注册/a
/td
/tr
/table
/form
注册页:register.php
?php
include("conn.php");
if(isset($_POST['submit'])$_POST['submit']) {
if($_POST['username']=='')
{
echo "用户名不能为空";
exit();
}
if($_POST['password']=='')
{
echo "密码不能为空";
exit();
}
if($_POST['realpass']!=$_POST['password'])
{
echo "两次密码输入不一致";
exit();
}
$sql="insert into member(username,real_name,password,email,headimg) values('$_POST[username]','$_POST[username]','$_POST[password]','$_POST[email]','')";
$ar=mysql_query($sql);
if($ar)
{
header("location:index.php");
}
else
{
echo mysql_error();
}
}
?
body
form action="register.php" method="post"
table border=1 align=center width=500
tr
td height=40 bgColor=#DFFFDF colspan=2会员注册[a href="https://www.04ip.com/post/login.php"返回登录页/a]/td
/tr
tr
td height=40 bgColor=#fffbec 会员ID/td
tdinput type="text" name="username" id="username"//td
/tr
tr
td height=40 bgColor=#fffbec密码/td
tdinput type="password" name="password" id="password"//td
/tr
tr
td height=40 bgColor=#fffbec确认密码/td
td
input type="password" name="realpass" id="realpass"/
/td
/tr
tr
td height=40 bgColor=#fffbecEMAIL/td
tdinput type="text" name="email" id="email"/
/tr
tr
td height=40 bgColor=#fffbec/td
tdinput type="submit" name="submit" value="https://www.04ip.com/post/注册"/input type="reset" value="https://www.04ip.com/post/重置"/td
/tr
/table
/form
/body
主页显示:index.php
?php
include("conn.php");
function cutstr($str,$cutleng)
{
$str = $str; //要截取留言板php数据库设计的字符串
$cutleng = $cutleng; //要截取留言板php数据库设计的长度
$strleng = strlen($str); //字符串长度

推荐阅读