-
Notifications
You must be signed in to change notification settings - Fork 2
/
insertcom.php
34 lines (30 loc) · 959 Bytes
/
insertcom.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
32
33
34
<?php
require_once './db/conn.php';
require './includes/sanitise.php';
//Get values from post operation
if(isset($_POST['submit'])){
//extract values from the $_POST array
$cname = test_input($_POST['comment_name']);
$cmail = test_input($_POST['comment_mail']);
$doc = date('Y-m-d H:i:s');
$ccontent = $_POST['comment_content'];
$cbid = $_POST['blog_id'];
if ($crud->checkRepCom($cbid,$cmail)) {
//Call Crud function
$result = $crud->insertComments($cname, $cmail, $ccontent, $cbid, $doc);
// Redirect to index.php
if($result){
header("Location: blogpage.php?id=$cbid");
}
else{
include 'includes/errormessage.php';
}
}
else{
echo "<h3>You have already coomented on this blog</h3>";
}
}
else{
include 'includes/errormessage.php';
}
?>