-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunstatic.php
58 lines (44 loc) · 1.54 KB
/
unstatic.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
<?php
$allowedEmails = array("[email protected]", "[email protected]");
$defaultEmails = array("[email protected]");
$replaceSign = "#";
$subject = "Запрос с Mycompany (" .date("Y-m-d H:i:s") . ")";
$message = "";
foreach ($_POST as $_name => $_value){
switch( $_name ){
case "subject":
$subject = $_value . " (" .date("Y-m-d H:i:s") . ")";
break;
case "thankyou":
case "to":
break;
default:
$message .= "<strong>{$_name}:</strong> {$_value} <br />";
}
}
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
if( isset($_POST["to"]) ){
if( is_array($_POST["to"]) ){
foreach($_POST["to"] as $_email){
$_email = str_replace($replaceSign, "@", $_email);
if( in_array($_email, $allowedEmails) ){
@mail($_email, $subject, $message, $headers);
}
}
}else{
$_email = str_replace($replaceSign, "@", $_POST["to"]);
if( in_array($_email, $allowedEmails) ){
$result = @mail($_email, $subject, $message, $headers);
}
}
}else{
foreach($defaultEmails as $_email){
@mail($_email, $subject, $message, $headers);
}
}
if( isset($_POST["thankyou"]) ) {
header("Location: {$_POST["thankyou"]}");
}else{
echo "Are you bot?";
}