-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcontact.php
More file actions
executable file
·39 lines (36 loc) · 1.91 KB
/
contact.php
File metadata and controls
executable file
·39 lines (36 loc) · 1.91 KB
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
<?php
session_start();
if ( empty( $_SESSION['contact_token'] ) ) {
$_SESSION['contact_token'] = bin2hex( random_bytes( 32 ) );
}
define( 'page_title', 'Contact' );
define( 'page_description', 'Page description for search engines here.' );
define( 'page_keywords', 'keywords, for, search engines, here' );
define( 'page_id', 'contact' );
define( 'page_index', '<meta name="robots" content="index">' );
include( 'header.php' );
?>
<script>
function nospam() {
const message = document.forms["contact-form"]["message"].value;
const comment = document.getElementById("comment");
const link = message.indexOf("http");
if (link > -1) {
comment.setCustomValidity("Links are welcome, but please remove the https:// portion of them.");
comment.reportValidity();
} else {
comment.setCustomValidity("");
comment.reportValidity();
}
}
</script>
<form id="contact-form" name="contact-form" method="post" action="email.php">
<input type="hidden" name="token" value="<?php echo safe( $_SESSION['contact_token'], 'attr' ); ?>">
<p id="name"><label for="name-input" class="visually-hidden">Name</label><input type="text" id="name-input" name="name" placeholder="Name" autocomplete="off" required></p>
<p id="email"><label for="email-input" class="visually-hidden">Email</label><input type="email" id="email-input" name="email" placeholder="Email" autocomplete="off" required></p>
<p id="phone"><label for="phone-input" class="visually-hidden">Phone</label><input type="tel" id="phone-input" name="phone" placeholder="Phone (optional)" autocomplete="off"></p>
<p id="url"><input type="url" name="url" placeholder="URL" value="https://example.com/" autocomplete="off" tabindex="-1" required></p>
<p id="message"><label for="comment" class="visually-hidden">Message</label><textarea id="comment" name="message" placeholder="Message" onkeyup="nospam()" required></textarea></p>
<p id="submit"><input type="submit" value="Submit"></p>
</form>
<?php include( 'footer.php' ); ?>