-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomment.php
29 lines (22 loc) · 969 Bytes
/
comment.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
<?php
include 'session.php';
$name = $_POST['name'];
$comment = $_POST['comment'];
$email = $_POST['email'];
// if (!isset($_SESSION['captcha'])) {
// $secret = "6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe";
// $response = $_POST['g-recaptcha-response'];
// $remoteip = $_SERVER['REMOTE_ADDR'];
// $url = "https://www.google.com/recaptcha/api/siteverify?secret=$secret&response=$response&remoteip=$remoteip";
// $data = file_get_contents($url);
// $row = json_decode($data, true);
// if ($row['success'] == true) {
// $_SESSION['captcha'] = time() + (10 * 60);
// } else {
// $_SESSION['error'] = 'Please answer recaptcha correctly';
// header('location: signup');
// exit();
// }
// }
$stmt = $conn->prepare("INSERT INTO comment (email, name, message) VALUES (:email, :name, :message )");
$stmt->execute(['email' => $email, 'name' => $name, 'message' => $comment]);