-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomment_write_action.php
30 lines (24 loc) · 1.14 KB
/
comment_write_action.php
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
<?php
$connect = mysqli_connect("localhost", "root", "", "20201125") or die("fail");
session_start();
$parentn = $_SESSION['parentn'];
$id = $_GET['name']; //Writer
$title = $_GET['title']; //Title
$content = $_GET['content']; //Content
$date = date('Y-m-d H:i:s'); //Date
$URL = './comment.php'; //return URL
$query = "insert into comment (number,title, content, date, id, parent_number)
values(null,'$title', '$content', '$date', '$id','$parentn')";
$result = $connect->query($query);
if($result){
?> <script>
alert("<?php echo "글이 등록되었습니다."?>");
location.replace("<?php echo $URL?>");
</script>
<?php
}
else{
echo "FAIL";
}
mysqli_close($connect);
?>