-
Notifications
You must be signed in to change notification settings - Fork 18
/
contact.php
executable file
·51 lines (49 loc) · 1.78 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
<?php
include 'header.php';
foreach($_POST as $key => $value) {
$posts[$key] = filter($value);
}
if(isset($posts['name'])) {
if($posts['name'] == ""){
$error = "Please enter your real name!";
}else if(!isEmail($posts['email'])){
$error = "Please enter a valid email address!";
}else if($posts['message'] == ""){
$error = "Please enter your message!";
}else{
$subject ="Contact";
$message="{$posts['message']}";
$header="From: {$posts['name']} <{$posts['email']}>";
$to = $site->site_email;
$send_contact=mail($to,$subject,$message,$header);
$success = "Message Sent!";
}
}
?>
<div class="contentbox">
<div class="head">Contact</div>
<div class="contentinside">
<?php if(isset($error)) { ?>
<div class="error">ERROR: <?php echo $error; ?></div>
<?php }
if(isset($success)) { ?>
<div class="success">SUCCESS: <?php echo $success; ?></div>
<?php }
if(isset($warning)) { ?>
<div class="warning">WARNING: <?php echo $warning; ?></div>
<?php } ?>
<form class="contentform" method="post">
Name<br/>
<input name="name" type="text" value="<?php if(isset($posts["name"])) { echo $posts["name"]; } ?>"/><br/><br/>
Email<br/>
<input name="email" type="text" value="<?php if(isset($posts["email"])) { echo $posts["email"]; } else { if(isset($data->email)) { echo $data->email; } } ?>"/><br/><br/>
Message<br/>
<textarea rows="10" name="message"><?php if(isset($posts["message"])) { echo $posts["message"]; } ?></textarea><br/><br/>
<p>
<input style="width:100%;" type="Submit"/>
</form>
</div>
</div>
<?php
include 'footer.php';
?>