-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsubmitFeedback.php
70 lines (62 loc) · 2.09 KB
/
submitFeedback.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
<?php
/*
* JavaScript Redstone Simulator
* Copyright (C) 2012 Jonathan Lydall (Email: [email protected])
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include_once 'includes/error_handling.php';
include_once 'includes/class_emailHelper.php';
include_once 'includes/utf8_handling.php';
include_once 'includes/function_removeMagicQuotesIfEnabled.php';
$host = $_SERVER['HTTP_HOST'];
$url = $_SERVER['HTTP_REFERER'];
$email = $_POST["email"];
$message = $_POST["message"];
$magic = $_POST["magic"];
$body = $email;
$body .= "\n\n";
$body .= $url;
$body .= "\n\n";
$body .= $message;
$inputError = false;
if (str_replace(" ", "", $email . $message) == "") {
$inputError = true;
$errorDetails = "all fields blank";
}
if ($magic = "") {
$inputError = true;
$errorDetails = "no magic";
}
date_default_timezone_set("utc");
$timeNow = date("Y-m-d H:i:s");
$email = new emailHelper();
$email->setSubject("Javascript Redstone Simulator - Feedback (" . $timeNow . ")");
$email->addAttachment(print_r($GLOBALS, TRUE), "globals.txt", "text/plain");
$email->appendToBody($body);
if ($inputError) {
echo json_encode(array('error' => 'true', 'type' => 'input', 'details' => $errorDetails));
}
else {
$sendSuccess = $email->send();
if ($sendSuccess) {
echo json_encode(array('error' => 'false'));
}
else {
echo json_encode(array('error' => 'true', 'type' => 'mailSend', 'details' => "Error sending mail, please try again later."));
}
}
?>