首页 > 其他 > 详细

bbs回帖核心代码

时间:2016-12-03 02:17:54      阅读:261      评论:0      收藏:0      [点我收藏+]

<?php
//加载初始化文件
include ‘../init.php‘;

//加载数据库文件
include DIR_CORE.‘MYSQLDB.php‘;

//接收表单传送过来的数据
$content = addslashes(strip_tags(trim($_POST[‘content‘])));
$rep_pub_id= $_POST[‘pub_id‘];
//判断数据的合法性
if(empty($content)){
    header("refresh:2;url=./reply.php");
    die("内容不能为空,请输入内容!");
}
//插入数据

$rep_owner = "游客";
$rep_time= time();

$sql = "insert into reply values(null,$rep_pub_id,‘$rep_owner‘,‘$content‘,$rep_time)";
$result = my_query("$sql");

//判断数据是否插入成功,插入成功,跳转到回复页面,否则回复失败!
if($result){
    header("location:./show.php?pub_id=$rep_pub_id&action=reply");
}else{
    header("refresh:2;url=./reply.php");
    die("发生未知错误,请重新回复!");
}

bbs回帖核心代码

原文:http://www.cnblogs.com/phpindex/p/6127801.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!