bbs mysql_BBS(php & mysql)完整版(一)

BBS(php & mysql)完整版(一)推荐查看本文HTML版本

此页面为say.php

include "signup/mysql.inc";

if($id1){

       $sql="select * from $table where id='$id1'";    //显示回复题目

       $result=mysql_query($sql)or die(mysql_error());

       $row=mysql_fetch_array($result);

       $title="RE:".$row["title"];

        }

$ip=$REMOTE_ADDR;

$sql="select * from user_stus where ip='$ip'";    //查询当前用户名

$result=mysql_query($sql)or die(mysql_error());

$row=mysql_fetch_array($result);

if(!$row)                                         //判断用户是否登陆

{

echo "

";

echo"

3.gif
";

echo" 

"; 

echo"

嘻嘻!! 请先登陆

";

echo"

返回

";

exit();

}

else $userid=$row["userid"];

if($ok)

{

    if($title==""||$content=="")

    {

        echo "

      请您添完整后提交";

    }

    else{

    $id=time();                                 //提交文章

    $date1=date("Y/m/d");

    $title=htmlspecialchars($title);

    $content=htmlspecialchars($content);

    $sql="select * from ".$table;

    $result=mysql_query($sql)or die(mysql_error());

    $row1=mysql_num_rows($result);

    $row1++;

    if($id1){

    $sql="insert into bbs_re (id,userid,date1,title,content)values('$id','$userid','$date1','$title','$content')";

    mysql_query($sql)or die(mysql_error());

    $sql="select * from ".$table." where id='$id1'";

    $result=mysql_query($sql)or die(mysql_error());

    $lin=mysql_fetch_array($result);

    for($i=1;$i<6;$i++)

        {

         $re="r".$i;

         if(!$lin["$re"])

         break;

        }

    $sql="update ".$table." set ".$re."='$id' where id='$id1'";

           }

    else  

    $sql="insert into ".$table." (id,userid,date1,title,content,row)values('$id','$userid','$date1','$title','$content','$row1')";

    $result=mysql_query($sql)or die(mysql_error());

    if($result)

       {

              header("Location:php3.php?p=1&&table=$table");

        exit ;

       }

    }

}

?>

xiaoyang
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值