-
Notifications
You must be signed in to change notification settings - Fork 3
/
thank-you-for-submission.php
52 lines (47 loc) · 1.63 KB
/
thank-you-for-submission.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
---
title: Thank you for the submission
layout: page
---
<?php
if (isset($_POST)) {
$dir = "/home/tgelu/wedding-posts/" . uniqid('wedding_' . date('Y-m-d') . '_');
mkdir($dir);
$description = getDescription($_POST);
writeDescription($dir, $description);
sendMails($description, ["[email protected]", "[email protected]"]);
}
function sendMails($body, $emails) {
$body = "Yaay!\nSomeone submitted a wedding to be featured with the following description: \n\n" . $body;
$headers = array(
"From: 'Wedding Season Notifications' <[email protected]>",
"X-Mailer: PHP/" . PHP_VERSION
);
foreach($emails as $email) {
mail($email, "😍 Someone submitted a wedding! 🎉", $body, implode("\r\n", $headers));
}
}
function getDescription($form) {
$description = '';
foreach($form as $key => $value) {
if ($key != 'submit') {
$description .= $key . "\n" . $value . "\n\n";
}
}
return $description;
}
function writeDescription($dir, $description) {
$file = fopen($dir . '/description.txt', 'w');
fwrite($file, $description);
fclose($file);
}
?>
<div class="container">
<div class="row center-xs" style="text-align: left;">
<div class="col-xs-12 col-sm-11 col-md-9 col-lg-8">
<h1>Thank you very much for your submission! 😍</h1>
<p>We appreciate it, and <em>we promise</em> to do our best in order to produce a high quality post to your credit.</p>
<p>We will let you know as soon as we are done!</p>
<img class="divider--end" role="presentation" src="/img/decorations/end-divider.svg"/>
</div>
</div>
</div>