-
Notifications
You must be signed in to change notification settings - Fork 0
/
contact.php
86 lines (62 loc) · 2.29 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
<?php
include "inc/init.php";
if($user->isAdmin()) {
header("Location: $set->url");
exit;
}
$page->title = "Contact to ". $set->site_name;
$presets->setActive("contact"); // we highlith the contact link
if($_POST && isset($_SESSION['token']) && ($_SESSION['token'] == $_POST['token'])) {
$email = $_POST['email'];
$message = $_POST['message'];
if(!$options->isValidMail($email))
$page->error = "Email address is not valid.";
else if(!isset($message[10]))
$page->error = "Message was too short !";
else {
$from ="From: ".$email;
$sub = "Contact Admin $set->site_name !";
if($options->sendMail($email, $sub, $message, $from))
$page->success = "Your message was sent !";
}
} else if($_POST)
$page->error = "Invalid request !";
include 'header.php';
$_SESSION['token'] = sha1(rand()); // random token
echo "<div class='container'>
<div class='span3 hidden-phone'></div>
<div class='span6'> ";
if(isset($page->error))
$options->error($page->error);
else if(isset($page->success))
$options->success($page->success);
echo "<form class='form-horizontal well' action='#' method='post'>
<fieldset>
<legend>Contact Admin</legend>
<div class='control-group'>
<div class='control-label'>
<label>Your Email</label>
</div>
<div class='controls'>
<input type='text' name='email' class='input-large' value='".($user->islg() ? $user->filter->email : "")."'>
</div>
</div>
<div class='control-group'>
<div class='control-label'>
<label>Message</label>
</div>
<div class='controls'>
<textarea name='message' rows='5' class='input-large'></textarea>
</div>
</div>
<input type='hidden' name='token' value='".$_SESSION['token']."'>
<div class='control-group'>
<div class='controls'>
<button type='submit' id='submit' class='btn btn-primary'>Send</button>
</div>
</div>
</fieldset>
</form>
</div>
</div><!-- /container -->";
include 'footer.php';