-
Notifications
You must be signed in to change notification settings - Fork 2
/
contact.php
executable file
·78 lines (66 loc) · 2.81 KB
/
contact.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
require_once('display_fns.php');
display_header();
function isValid()
{
try {
$url = 'https://www.google.com/recaptcha/api/siteverify';
$data = ['secret' => '[6Ld5bAkUAAAAAN0BV0H6YnjEpksBIGsGZakEBL85]',
'response' => $_POST['g-recaptcha-response'],
'remoteip' => $_SERVER['REMOTE_ADDR']];
$options = [
'http' => [
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data)
]
];
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return json_decode($result)->success;
}
catch (Exception $e) {
return null;
}
}
echo "<div id='container'>";
echo '<p><img src="images/newsgoldbullet.gif" border="0"style="margin-left: 0px"><b>Contact</b></p>';
echo "<p> If you have questions or comments about our application that we provide, we would be pleased to hear from you!</p>";
echo "<form action='contact.php' method='POST'>";
echo "<span>Name</span></br>";
echo "<input type='text' name='userName' size='35'/></br>";
echo "<span>Your email address (optional)</span></br>";
echo "<input type='text' name='userEmail' size='35'/></br>";
echo "<span>Subject</span></br>";
echo "<input type='text' name='userSubject' size='35'/></br>";
echo "<span>Message</span></br>";
echo "<textarea rows=12 cols=50 name='userMessage'></textarea></br></br>";
echo "<span>Please click below</span></br>";
echo "<div class='g-recaptcha' data-sitekey='6Ld5bAkUAAAAACCsl45X83H6YyJM2xf2dg6dcKdS'></div><br/>";
echo "<input type='submit' name='userSubmit'/>";
echo "</form>";
if(isset($_POST['userSubmit'])){
if (isValid()==false){ echo "<p><b>You need to click to prove that you are not robot! </p>"; }
else if((!empty($_POST['userName']))&&(!empty($_POST['userMessage']))&&(!empty($_POST['userSubject']))){
$to_email = '[email protected]';
$subject = test_input($_POST['userSubject']);
$subject = '[WebGIVI contact] '.$subject.'--'.test_input($_POST['userName']);
$message = test_input($_POST['userMessage']);
$userEmail = test_input($_POST['userEmail']);
if (!empty($userEmail)){
$headers = 'From:'.$userEmail."\r\n".'Reply-To:'.$userEmail."\r\n".'X-Mailer: PHP/' . phpversion();
mail($to_email, $subject, $message,$headers);
}
else{
$to_email = $to_email; // dummy line because the next line is commented out. -- ASHIQUE
mail($to_email, $subject, $message);
}
echo "<p><b>Thanks for your question, we will contact you as soon as possible!</b></p>";
}
else{
echo "<p><b>You forgot to input your name or subject or mesage!</b></p>";
}
}
echo "</div>";
display_footer();
?>