-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathform.php
More file actions
93 lines (79 loc) · 3.04 KB
/
form.php
File metadata and controls
93 lines (79 loc) · 3.04 KB
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
<?
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");
$err = array();
if (!$GLOBALS['APPLICATION']->CaptchaCheckCode($_REQUEST["captcha_word"], $_REQUEST["captcha_code"]))
$err['required'][] = 'captcha_word';
if ($err) {
$result['status'] = 'error';
$result['errors'] = $err;
}
else
$result['status'] = 'ok';
if($result['status'] == 'ok') {
$EOL = "\r\n";
$text = array(
'name' => 'Автор заявки',
'company' => 'Компания',
'phone' => 'Номер телефона',
'email' => 'Эл. почта',
'link' => 'Ссылка на сайт',
'budget' => 'Бюджет',
'type' => 'Тип сайта',
'description' => 'Описание',
'brief' => 'Бриф',
'resume' => 'Резюме',
'photo' => 'Фото',
'todo' => 'Хотим сделать',
);
$body = "<br />
С сайта было отправлено сообщение следующего содержания:<br />
____________________________________________________________<br />
<br />
";
foreach ($_REQUEST as $key => $value)
if($text[$key]&&strlen($value)>0)
$body .= $text[$key].': '.$value."<br /><br />\r\n";
foreach ($_FILES as $key => $value){
if($text[$key]) {
$value = CFile::GetPath(CFile::SaveFile($value));
$body .=$text[$key].': <a href="http://radia.ru'.$value.'">'.$value."</a><br /><br />\r\n";
}
}
$boundary = "--".md5(uniqid(time()));
$un = strtoupper(uniqid(time()));
$headers = "MIME-Version: 1.0;$EOL";
$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"$EOL";
$headers .= "From: Сайт ".$_SERVER['HTTP_HOST']." <mailer@".$_SERVER['HTTP_HOST'].">\r\n";
$multipart = "--$boundary$EOL";
$multipart .= "Content-Type: text/html; charset=UTF-8$EOL";
$multipart .= "Content-Transfer-Encoding: base64$EOL";
$multipart .= $EOL; // ðàçäåë ìåæäó çàãîëîâêàìè è òåëîì html-÷àñòè
$multipart .= chunk_split(base64_encode($body));
$multipart .= "$EOL--$boundary$EOL";
$multipart .= "Content-Type: application/octet-stream; name=\"$name\"$EOL";
$multipart .= "Content-Transfer-Encoding: base64$EOL";
//$multipart .= "Content-Disposition: attachment; filename = \"".$path."\"\n\n";
$multipart .= $EOL;
$multipart .= chunk_split(base64_encode($file));
$multipart .= "$EOL--$boundary--$EOL";
$body .= "<br />
____________________________________________________________<br />
";
$subject = "Заявка с сайта: ".$_REQUEST["theme"];
$subject = '=?UTF-8?B?'.base64_encode($subject).'?=';
if ($result['status'] == 'ok') {
$rs_user = CUser::GetList(
($by = 'name'),
($order = 'asc'),
array(
'GROUPS_ID' => array($_REQUEST["group_id"])
)
);
while($ar_user = $rs_user->GetNext()) {
mail($ar_user['EMAIL'], $subject, $multipart, $headers);
}
}
}
print json_encode($result);
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_after.php");
?>