-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcomment_function.php
More file actions
40 lines (37 loc) · 1.44 KB
/
comment_function.php
File metadata and controls
40 lines (37 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php session_start(); ?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
//include("mysql_connect.inc.php");
//include("blue_head.inc.php");
session_start();
if (isset($_SESSION["uid"]) && !empty($_SESSION["uid"])) {
$uid = $_SESSION["uid"];
}
if (isset($_SESSION["email"]) && !empty($_SESSION["email"])) {
$email = $_SESSION["email"];
}
include_once("./include/db/configure.php");
include_once("./include/db/db_func.php");
include_once("./include/commonFunction.php");
include_once("./include/head_line.inc.php");
$db_conn = connect2db($dbhost, $dbuser, $dbpwd, $dbname);
$text = $_POST["comment"];
$id = $_POST["myid"]; //from session id
$pid = $_POST["post_id"];//from hidden post
//$currentPage = $_POST["currentState"];
date_default_timezone_set('Asia/Taipei');
$date = date("Y-m-d H:i:s");
if($text != null) {
$sql = "INSERT INTO tsc_comment (UserIndex, Time, PostIndex , CommentContent, Valid) VALUES ('$id', '$date', '$pid', '$text', '0')";
$ret_sql = querydb($sql, $db_conn);
if($ret_sql == TRUE) {
//exit();
//echo "<img src = './pic/Commentsuccess.png' width='90%' style='display:block; margin:auto;'>";
//echo "<meta http-equiv=REFRESH CONTENT=1;url='view_article.php'>";
}
else {
echo "Faild!";
exit();
}
}
?>