-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontact_mail.php
More file actions
78 lines (75 loc) · 2.49 KB
/
Copy pathcontact_mail.php
File metadata and controls
78 lines (75 loc) · 2.49 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
<?php
/**
* Created by PhpStorm.
* User: maha
* Date: 12.08.17
* Time: 17:27
*/
/*
* html form
*form -> action page of post "" to localhost
*/
class contact_mail
{
/*
* if $num_order=NULL
* for success.php
* else
* for SUPPORT.php
*/
public function __construct($id, $question, $name, $email_address, $phone, $message, $vk, $fb, $num_order, $hn, $un, $pw, $db)
{
$question = strip_tags(htmlspecialchars($question));
//getting string and protect
$message = strip_tags(htmlspecialchars($message));
// Add your email
$to = 'mkon.masha@gmail.com';
$tos = 'iters@yandex.ru';
$email_subject = "Website Contact Form: $name";
$email_body = "You have received a new message
from your website contact form.\n\n" .
"Here are the details:\n
\nUser_id: $id\n
\nName: $name\n
\nEmail: $email_address\n
\nPhone: $phone\n
\nVK: $vk\n
\nFACEBOOK: $fb\n";
//for SUPPORT.php
$support= "\nQuestion: $question\n
\nMessage:\n$message";
if ($num_order!=NULL){
//for success.php
include_once '../authorisation/DataBase.php';
$bd=new DataBase($hn,$un,$pw,$db);
//get order of special number
$result = $bd->get_order($num_order);
$result->data_seek(0);
$row = $result->fetch_array(MYSQLI_NUM);
$order_ifa ="\nNumber of order: $row[0]\n
\nUrl_landing: $row[2]\n
\nVK_pixel: $row[3]\n
\nFB_pixel: $row[4]\n
\nMETKA_pixel: $row[5]\n
\nDate: $row[6]\n
\nPrice: $row[7]\n
\nText: $row[8]\n
\nModules: $row[9]\n
\nUrl_download: $row[10]\n
\nStatus:\n$row[11]\n";
$email_body.=$order_ifa;
} else {
$email_body.=$support;
}
// This is the email address the generated message will be from. We recommend using something like noreply@yourdomain.com
$headers = "From: noreply@localhost.com\n";
$headers .= "Reply-To: $email_address";
//send to Maha
$result = mail($to, $email_subject, $email_body, $headers);
if (!$result) echo "Ваша письмо не отправилось!";
//send to Stas
$result = mail($tos, $email_subject, $email_body, $headers);
if (!$result) echo "Ваша письмо не отправилось!";
}
}
?>