-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontact.php
161 lines (133 loc) · 4.66 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
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<style>
@font-face {
font-family: Edition;
src: url(fonts/Phase-GGX_0-0-0.woff);
}
@font-face {
font-family: Phase;
src: url(fonts/Phase-GGX_10-63-100.woff);
}
body {
background:linear-gradient(90deg, #ffe85c 50%, #e1271e 50%);;
width:50vw;
margin:0;
-webkit-box-shadow: -2px 0px 15px 5px #000000;
box-shadow: -2px 0px 15px 5px #000000;
}
p {
font-size:2.8vw;
font-family: Edition;
padding:15px 15px 15px 15px;
line-height:1.25;
margin-bottom: 0;
margin-block-start:0;
}
a {
background: black;
color: #ffe85c;
text-align: center;
border: 2px solid black;
font-size: 2.8vw;
padding:10px;
margin-left: 15px;
font-family: 'Phase';
cursor: pointer;
text-decoration: none;
}
a:hover{
border: 2px solid black;
background: #e1271e;
color:black;
}
</style>
<?php
if($_POST) {
$title = "";
$author_name = "";
$link_to_work = "";
$description = "";
$affect = "";
$contributor_name = "";
$visitor_email = "";
$concerned_category = "";
$email_body = "<div>";
if(isset($_POST['title'])) {
$title = filter_var($_POST['title'], FILTER_SANITIZE_STRING);
$email_body .= "<div>
<label><b>Title:</b></label> <span>".$title."</span>
</div>";
}
if(isset($_POST['author_name'])) {
$author_name = filter_var($_POST['author_name'], FILTER_SANITIZE_STRING);
$email_body .= "<div>
<label><b>Author Name:</b></label> <span>".$author_name."</span>
</div>";
}
if(isset($_POST['link_to_work'])) {
$link_to_work = htmlspecialchars($_POST['link_to_work']);
$email_body .= "<div>
<label><b>Link to Work:</b></label>
<div>".$link_to_work."</div>
</div>";
}
if(isset($_POST['description'])) {
$description = htmlspecialchars($_POST['description']);
$email_body .= "<div>
<label><b>Description:</b></label>
<div>".$description."</div>
</div>";
}
if(isset($_POST['affect'])) {
$affect = htmlspecialchars($_POST['affect']);
$email_body .= "<div>
<label><b>How The Work Has Affected You:</b></label>
<div>".$affect."</div>
</div>";
}
if(isset($_POST['contributor_name'])) {
$contributor_name = filter_var($_POST['contributor_name'], FILTER_SANITIZE_STRING);
$email_body .= "<div>
<label><b>Contributor Name:</b></label> <span>".$contributor_name."</span>
</div>";
}
if(isset($_POST['visitor_email'])) {
$visitor_email = str_replace(array("\r", "\n", "%0a", "%0d"), '', $_POST['visitor_email']);
$visitor_email = filter_var($visitor_email, FILTER_VALIDATE_EMAIL);
$email_body .= "<div>
<label><b>Contributor Email:</b></label> <span>".$visitor_email."</span>
</div>";
}
if(isset($_POST['concerned_category'])) {
$concerned_category = filter_var($_POST['concerned_category'], FILTER_SANITIZE_STRING);
$email_body .= "<div>
<label><b>Category:</b></label> <span>".$concerned_category."</span>
</div>";
}
//Remember to change these to your email.
if($concerned_category == "yes") {
$recipient = "[email protected]";
}
else if($concerned_category == "no") {
$recipient = "[email protected]";
}
else {
$recipient = "[email protected]";
}
$email_body .= "</div>";
$headers = 'MIME-Version: 1.0' . "\r\n"
.'Content-type: text/html; charset=utf-8' . "\r\n"
.'From: ' . $visitor_email . "\r\n";
if(mail($recipient, $author_name, $email_body, $headers)) {
echo "<p>Thank you for contributing to the Library of Infinities, $contributor_name. <br> <br>We will review your submission, and if approved, will add it to the Library. <br> <br><br></p>" ;
echo '<a href="library.html" target="_blank">RETURN TO LIBRARY</a>';
} else {
echo '<p>We are sorry but your submission did not go through.<br><br><br></p>';
echo '<a href="library.html" target="_blank">RETURN TO LIBRARY</a>';
;
}
} else {
echo '<p>Something went wrong<br><br><br></p>';
echo '<a href="library.html" target="_blank">RETURN TO LIBRARY</a>';
;
}
?>