-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathx-comments-post.php
31 lines (27 loc) · 959 Bytes
/
x-comments-post.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
31
<?php
require_once "core/init.php";
if(isset($_POST['submit'])){
$id_a = $_SESSION['id'];
$canonical = $_SESSION['url_con'];
$isi_komen = trim($_POST['isi_komen']);
$nama = trim($_POST['nama']);
$email = trim($_POST['email']);
$web_url = trim($_POST['web_url']);
if(!empty($isi_komen) && !empty($nama) && !empty($email)){
if(add_comment($id_a, $nama, $email, $web_url, $isi_komen)){
$message = 'Komentar telah terkirim';
$_SESSION['message'] = $message;
header('Location: '.$canonical);
unset($_SESSION['id']);
unset($_SESSION['url_con']);
exit;
}else{
$message = 'Any wrong while send a comment';
$_SESSION['message'] = $message;
}
}else{
$message = 'Nama, Email dan Komentar harus disi!';
$_SESSION['message'] = $message;
}
}
?>