APP资源网_中文资源在线官网_А天堂中文官网_中文在线APP资源下载网

杏林同学录七

杏林同学录七

人气:2引自:中文资源APP下载网

留言簿部分:    班级成员留言簿: 显示留言:class/notebook/index.php <? session_start(); // 开始session if(!session_is_registered("userregister")||($userregister==""))//检查是否注册,如userregister未注册或session为空值,重新注册. { echo "请重新注册"; exit; } ?> 留言簿

" _ue_custom_node_="true">

<?php  include ("../config.php");  $result = mysql_query("SELECT * FROM notebook",$db);  $row=mysql_num_rows($result);//查看查询结果有多少行  $max=$row; //帖子总数  //设每页显示10篇,可自行设定,$p总页数,$page第几页,$low 从第几行开始读,$x 读取几行  if (!$page){ $page=1;}//$page默认值为1  $p=ceil($max/10);//页数为$max/10的最大整数  $low=10*($page-1);  if($page==$p&&($max%10)<>0){$x=($max%10);} else {$x=10;}//如果是最后一页,且不是10的整倍数,读取$max除以10的余数,否则取10  if($max==0){$x=0;}//如果没有帖子,$x取0  $result = mysql_query("select * from notebook ORDER BY time DESC limit $low,$x",$db);//按照帖子的时间降序查询  ?>                  

                                                                       

   <?php    for ($i=0;$i<=($x-1);$i++) {    $user=mysql_result($result,$i,'user');    $time=mysql_result($result,$i,'time');    $ip=mysql_result($result,$i,'ip');    $title=mysql_result($result,$i,'title');    $nnote=mysql_result($result,$i,'nnote');    $yresult = mysql_query("SELECT * FROM user where user='$user'",$db);//读取成员数据库    $name=mysql_result($yresult,0,'name');    $signature=mysql_result($yresult,0,'signature');//读取个人签名    $email=mysql_result($yresult,0,'email');    $face=mysql_result($yresult,0,'face');    $face='../image/face/icon'.$face;       echo "<table width='100%' border='0' cellspacing='0' cellpadding='0' height=107' bordercolor='#FFFFFF'>";   echo ""; echo        ""; echo        ""; echo        ""; echo        "  ";   echo        ""; echo        "

"; }  mysql_close($db); ?>               添加留言:class/notebook/addnote.php <? session_start(); // 开始session if(!session_is_registered("userregister")||($userregister==""))//检查是否注册,如userregister未注册或session为空值,重新注册. { echo "请重新注册"; exit; } ?> 添加留言

" _ue_custom_node_="true">

                 

<?php  include ("../config.php");  if ($submit){  $time=date("Y年m月d日 H:i:s A");  $ip=$REMOTE_ADDR;//留言人ip地址  $title=strip_tags($top);  $nnote=nl2br(strip_tags($content));//先去掉html标记,再将换行符转成 。  if (!$title||!$nnote){           //检查是否填写完整       echo "对不起,您必须填所有内容!"."返回";       exit; }    //写入数据库  $sql="INSERT INTO notebook (user,time,ip,title,nnote) VALUES ('$userregister','$time','$ip','$title','$nnote')";  $result = mysql_query($sql,$db);  mysql_close($db);  echo "留言成功!";  } ?>                                                               

                      

">   

专题文集:PHP实例 windows
引用标题:《杏林同学录七》
来源地址:https://www.xjanfang.cn/news/tpart-28740.html