user表
friend表text表
#首先需要写一个注册与登录
##注册zhuce.html
zhuce
zhuce.php
alert('请确认信息完整性!'); history.go(-1);"; } else { $link=mysqli_connect("localhost","root","","liuyan");//连接数据库 mysqli_query($link,"set names utf8"); $sql="select username from user where username='$_POST[username]'"; $result=mysqli_query($link,$sql);//执行sql语句 $num=mysqli_num_rows($result);//统计执行结果影响的行数 if($num)//如果存在该用户 { echo ""; } else//注册新用户 { $sql_insert="insert into user (username,password)values('$_POST[username]','$_POST[password]')"; $res_insert=mysqli_query($link,$sql_insert); if($res_insert) { echo ""; } else { echo ""; } } } ?>
#效果如下
##登录denglu.html
denglu
denglu.php
alert('请输入用户名或密码!'); history.go(-1);"; } else { $link=mysqli_connect("localhost","root","","liuyan");//连接数据库 mysqli_query($link,"set names utf8"); $sql = "select username,password from user where username = '$_POST[username]' and password = '$_POST[password]'"; $result=mysqli_query($link,$sql);//执行sql语句 $num=mysqli_num_rows($result);//统计影响结果行数,作为判断条件 if($num) { echo "";//登录成功页面跳转 } else { echo ""; } } ?>
#效果如下#下面需要我们写一个登录进去的页面,它显示别人给你发来的留言以及进入你要给别人留言的页面或者退出系统,在这里我将html代码嵌入phpphp代码如下003.php
发布信息 退出系统 留言信息:
#效果如下#接下来我们就该写发布的页面以及PHP代码了fabu.html
fabu
fabu.php
alert('发布失败!');window.location='fabu.html';"; } else { echo ""; } ?>
#效果如下#最后是退出系统
alert('退出成功!');window.location='denglu.html';"; ?>
上一篇:QueryList怎么在TP5框架中使用
下一篇:怎么在php中应用策略模式