1 Star 0 Fork 0

Yixun / PHP-Blog

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
send_comment_sql.php 1.13 KB
一键复制 编辑 原始数据 按行查看 历史
Yixun 提交于 2020-07-09 19:09 . 发布留言处理
<?php
if (!empty($_SESSION['fileid']) ) {
header("Location:./index.php");
exit();
}
else{
include("./sql_conn/conn.php");
include("./login_session_check.php");
$content = $_POST['message'];
$username = $_SESSION['uid'];
if (empty($_SESSION['fileid'])) {
header("Location:./index.php");
exit();
}
$fileid = intval($_SESSION['fileid']);
$comtime = date('Y-m-d h:i:s', time());
// echo $fileid;
$comment_sql = "INSERT INTO comment (id, fileid, username, content, comtime)
VALUES (NULL, '".$fileid."', '".$username."', '".$content."', '".$comtime."')";
// echo $comment_sql;
$res = mysqli_query($conn,$comment_sql);
if ($res>0) {
echo "<script language='javascript' type='text/javascript'>";
echo "alert('留言成功');";
echo "location.href='./blog_article.php?list=".$fileid."#comments';";
echo "</script>";
exit();
}
}
@session_start();
unset($_SESSION["fileid"]);
?>
1
https://gitee.com/zkroc/PHP-Blog.git
git@gitee.com:zkroc/PHP-Blog.git
zkroc
PHP-Blog
PHP-Blog
master

搜索帮助