-
Notifications
You must be signed in to change notification settings - Fork 0
/
contact-confirmation.php
114 lines (102 loc) · 4.34 KB
/
contact-confirmation.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php require_once "core/header.php"; ?>
<?php require_once "core/navigation.php"; ?>
<?php
define('TO_EMAIL', '[email protected], [email protected]');
if(!empty($_POST['contact_form'])) {
$captcha_error = false;
$recaptcha_url = 'https://www.google.com/recaptcha/api/siteverify';
$recaptcha_response = $_POST['recaptcha_response'];
$recaptcha = file_get_contents($recaptcha_url . '?secret=' . $captcha_private_v3 . '&response=' . $recaptcha_response);
$recaptcha = json_decode($recaptcha);
if ($recaptcha->score > 0.8) {
$name = filter_var($_POST['nom'], FILTER_SANITIZE_STRING);
$email = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL);
$phone = filter_var($_POST['phone'], FILTER_SANITIZE_EMAIL);
$message = filter_var($_POST['message'], FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES);
if (!empty($name) && !empty($email) && !empty($message)) {
$headers = 'From: [email protected]\r\n';
$headers .= 'Reply-To: ' . $email . "\r\n";
$headers .= 'Content-Type: text/plain; charset=UTF-8' . "\r\n";
/* Formatting Email Message */
$title = 'Toprak Transport : Nouveau message de ' . $name;
$message .= "\n\n\n" . 'Téléphone: ' . $phone . "\n\n";
// Send Mail
$result = mail(TO_EMAIL, $title, $message, $headers);
if ($result) {
$status = 1;
} else {
$status = 0;
}
}
}else {
$captcha_error = true;
}
}
/**
* Function for getting user IP address
* @return string ( Return IP Address )
*/
function getUserIp() {
$ip = '';
if (getenv('HTTP_CLIENT_IP')) {
$ip = getenv('HTTP_CLIENT_IP');
} else if(getenv('HTTP_X_FORWARDED_FOR')) {
$ip = getenv('HTTP_X_FORWARDED_FOR');
} else if(getenv('HTTP_X_FORWARDED')) {
$ip = getenv('HTTP_X_FORWARDED');
} else if(getenv('HTTP_FORWARDED_FOR')) {
$ip = getenv('HTTP_FORWARDED_FOR');
} else if(getenv('HTTP_FORWARDED')) {
$ip = getenv('HTTP_FORWARDED');
} else if(getenv('REMOTE_ADDR')) {
$ip = getenv('REMOTE_ADDR');
} else {
$ip = 'N/A';
}
return $ip;
}
?>
<section class="tj-payment" id="success-payment">
<div class="container">
<div class="row">
<div class="col-md-8 col-sm-8">
<div class="success-msg">
<?php if (isset($captcha_error) && $captcha_error == false) { ?>
<span class="fas fa-check"></span>
<h3>Message envoyé!</h3>
<p>Votre message a bien été envoyé, nous y répondrons par email sous 48 heures</p>
<a href="/"><i class="fa fa-arrow-circle-left" aria-hidden="true"></i> Retour à l'accueil</a>
<?php } else { ?>
<span class="fas fa-exclamation-triangle"></span>
<h3>Erreur!</h3>
<p>Votre message n'a pas été envoyé, veuillez réessayer</p>
<a href="/"><i class="fa fa-arrow-circle-left" aria-hidden="true"></i> Retour à l'accueil</a>
<?php } ?>
</div>
</div>
<div class="col-md-4 col-sm-4">
<div class="address-box">
<div class="add-info">
<span class="icon-map icomoon"></span>
<p>Toprak Transport, <br>Montereau-Fault-Yonne,<br> France</p>
</div>
<div class="add-info">
<span class="icon-phone icomoon"></span>
<p>
<a href="tel:0659742684" title="Contact téléphone">06.59.74.26.84</a>
</p>
</div>
<div class="add-info">
<span class="icon-mail-envelope-open icomoon"></span>
<p>
<a href="mailto:[email protected]" title="Contact email">
</a>
</p>
</div>
</div>
</div>
</div>
</div>
</section>
<?php require_once "core/footer.php"; ?>