-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathform.php
More file actions
22 lines (21 loc) · 783 Bytes
/
form.php
File metadata and controls
22 lines (21 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
/* [VERIFY CAPTCHA FIRST] */
$secret = 'SECRET KEY'; // CHANGE THIS TO YOUR OWN!
$url = "https://www.google.com/recaptcha/api/siteverify?secret=$secret&response=".$_POST['g-recaptcha-response'];
$verify = json_decode(file_get_contents($url));
/* [PROCESS YOUR FORM] */
if ($verify->success) {
$to = "igby.veko@gmail.com"; // CHNAGE THIS TO YOUR OWN!
$subject = "Contact Form";
$message = "Name - " . $_POST['name'] . "<br>";
$message .= "Email - " . $_POST['email'] . "<br>";
$message .= "Message - " . $_POST['message'] . "<br>";
if (@mail($to, $subject, $message)) {
// Send mail OK - Show a nice thank you page or something
} else {
// Send mail error... Ask user to retry or give alternative
}
} else {
// Invalid captcha - Ask user to retry
}
?>