-
Notifications
You must be signed in to change notification settings - Fork 2
/
contact.php
54 lines (45 loc) · 1.55 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
<?php
include 'include/context.php';
$to = "[email protected]";
$sent = isset($_GET['sent']);
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$email = stripslashes($_POST['email']);
$name = stripslashes($_POST['name']);
$subject = stripslashes($_POST['subject']);
$message = stripslashes($_POST['message']) . PHP_EOL;
$message .= "--" . PHP_EOL;
$message .= "Sent from lucianmarin.com" . PHP_EOL;
$headers = "From: $name <$email>" . PHP_EOL;
$headers .= "Reply-To: $email" . PHP_EOL;
$headers .= "Cc: $to" . PHP_EOL;
mail($to, $subject, $message, $headers);
header('Location: /contact.php?sent');
exit;
}
?>
<?php include 'include/header.php'; ?>
<?php include 'include/menu.php'; ?>
<div class="main">
<div class="center">
<?php if($sent): ?>
<div class="content">
<h4><a href="contact.php">Message sent</a></h4>
<p class="quote">See what I’m doing now on <a href="https://sublevel.net/lucian/">Sublevel</a>...</p>
<p class="note">...or wait for an answer.</p>
</div>
<?php else: ?>
<form action="<?= $self ?>" method="post" autocomplete="off">
<input type="email" name="email" placeholder="Email"
required />
<input type="text" name="subject" placeholder="Subject"
required />
<textarea name="message" placeholder="Message" rows="4" cols="80"
oninput="expand(this)" required></textarea>
<input type="text" name="name" placeholder="Name"
class="last" required />
<input type="submit" value="Send" />
</form>
<?php endif; ?>
</div>
</div>
<?php include 'include/footer.php'; ?>