-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathindex.php
65 lines (48 loc) · 2.12 KB
/
index.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
<?php
require_once "config.php";
$email = $_POST['email'] ?? null;
if ($email) {
$emails = file_get_contents(PATH_TO_DATA);
$emails = explode(PHP_EOL, $emails);
if (!in_array($email, $emails) && filter_var($email, FILTER_VALIDATE_EMAIL)) {
$success = file_put_contents(PATH_TO_DATA, $email . PHP_EOL, FILE_APPEND);
}
}
?>
<!DOCTYPE html>
<html lang="en" data-theme="light">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1, width=device-width" />
<title>HTML for People</title>
<link rel="stylesheet" href="/css/pico.red.min.css" />
<link rel="stylesheet" href="/css/style.css" />
</head>
<body>
<header class="container">
<img class="logo" src="/img/logo.svg" alt="HTML for People">
</header>
<main class="container">
<?php if ($email): ?>
<hgroup>
<h2>Thanks!</h2>
<p>I’ll let you know when HTML for People is ready.</p>
</hgroup>
<?php endif; ?>
<p>I’m working on a web book all about getting started making websites with HTML. It’s a beginner-level book aimed at people who may or may not have career aspirations as web developers. I don’t think websites were ever intended to be made only by “web professionals.” They are documents at heart and anyone should be able to make one if they want. Knowing how to write HTML and put it on the internet is a skill that’s valuable to all kinds of careers and personal pursuits. HTML is for anyone.</p>
<?php if (!$email): ?>
<p>If you want me to email you when the book is ready, leave your email address below. I won't spam you, sell your email address, or use it for anything other than letting you know when the book is released.</p>
<form action="/" method="post">
<label>
<strong>Email</strong>
<input type="email" name="email">
</label>
<button type="submit">Notify me!</button>
</form>
<?php endif; ?>
</main>
<footer class="container">
<p>A <a href="https://blakewatson.com/">Blake Watson</a> project.</p>
</footer>
</body>
</html>