-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_send_khachhang.php
More file actions
188 lines (135 loc) · 5.67 KB
/
Copy path_send_khachhang.php
File metadata and controls
188 lines (135 loc) · 5.67 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<?php
@ session_start();
if (empty($_SESSION["user_login"])) {
unset($_SESSION["user_login"]);
echo "<script>window.location.href='login.php'</script>";
exit;
}
include str_replace('\\','/',dirname(__FILE__)).'/content_spaw/spaw.inc.php';
include str_replace('\\','/',dirname(__FILE__)).'/class/class.DEFINE.php';
include str_replace('\\','/',dirname(__FILE__)).'/class/class.HTML.php';
include str_replace('\\','/',dirname(__FILE__)).'/class/class.JAVASCRIPT.php';
include str_replace('\\','/',dirname(__FILE__)).'/class/class.UTILITIES.php';
include str_replace('\\','/',dirname(__FILE__)).'/class/class.CSS.php';
include str_replace('\\','/',dirname(__FILE__)).'/class/class.SINGLETON_MODEL.php';
include str_replace('\\','/',dirname(__FILE__)).'/class/simple_html_dom.php';
include str_replace('\\','/',dirname(__FILE__)).'/class/class.BUSINESSLOGIC.php';
include str_replace('\\','/',dirname(__FILE__)).'/class/template.php';
include str_replace('\\','/',dirname(__FILE__)).'/Cache_Lite/Lite/Function.php';
$html=SINGLETON_MODEL::getInstance("HTML");
$js=SINGLETON_MODEL::getInstance("JAVASCRIPT");
$css=SINGLETON_MODEL::getInstance("CSS");
$utl=SINGLETON_MODEL::getInstance("UTILITIES");
$dbf=SINGLETON_MODEL::getInstance("BUSINESSLOGIC");
?>
<meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
<?php
$token = rand(100000,999999);
$page = ($_GET["page"]);
$tungay = ($_GET["tungay"]);
$denngay = ($_GET["denngay"]);
$khachhang_id = $_GET["khachhang_id"];
$rad_name = $_GET["rad_name"];
if($khachhang_id!="")
{
$khachhang = $dbf->getInfoColum("khachang",$khachhang_id);
$email = $khachhang["email"];
$hovaten_khachhang = $khachhang["title"];
}
$url = "http://".$_SERVER["HTTP_HOST"]."/".$page."?tungay=".$tungay."&denngay=".$denngay."&khachhang_id=".$khachhang_id."&rad_name=".$rad_name."&token=".$token;
if(isset($_POST['cmdsendmail']) && $_POST['cmdsendmail']!='' )
{
$msg="";
$email = $_POST['email'];
$subject = stripcslashes($_POST['subject']);
$noidung = stripcslashes($_POST['noidung']);
$token_post = stripcslashes($_POST['token']);
$isvalue = true;
if($email=='')
{
$msg.= "Vui lòng nhập mail người nhận";
$isvalue = false;
}
if($subject=='')
{
$msg.= "Vui lòng nhập tiêu đề mail";
$isvalue = false;
}
if($noidung=='')
{
$msg.= "Vui lòng nhập nội dung mail";
$isvalue = false;
}
if($isvalue)
{
include("class.phpmailer.php");
$arraySMTPSERVER=array("host"=>"mail.giaiphaptoiuu.net","user"=>"info@giaiphaptoiuu.net","password"=>"H0eq8fIC","from"=>"http://giaiphapthongminh.net");
//khoi tao website
$mail = new PHPMailer();
$SMTP_Host = $arraySMTPSERVER["host"];
$SMTP_Port = 25;
//******************************************************************************/
$SMTP_UserName = $arraySMTPSERVER["user"];
$SMTP_Password = $arraySMTPSERVER["password"];
$from = $SMTP_UserName;
$fromName = "VIỆT THÁI";
$to = $email;
$mail->IsSMTP();
$mail->Host = $SMTP_Host;
$mail->SMTPAuth = true;
$mail->Username = $SMTP_UserName;
$mail->Password = $SMTP_Password;
$mail->From = $from;
$mail->FromName = $fromName;
$mail->AddAddress($to);
$mail->AddReplyTo($from, $fromName);
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->Subject = $subject;
$mail->Body = $noidung;
$mail->AltBody = "This is the text-only body";
if(!$mail->Send()) {
$msg.= "Gửi mail bị lỗi. Xin vui lòng thực hiện lại";
$arraySendmail = array("status"=>"Thất bại","khachhang"=>$subject,"email"=>$email,"content"=>$noidung,"token"=>$token_post,"datecreated"=>time());
$affect = $dbf->insertTable("sendkhachhang", $arraySendmail);
}
else
{
$msg.= "Gửi mail thành công";
//insert database
$arraySendmail = array("status"=>"Thành công","khachhang"=>$subject,"email"=>$email,"content"=>$noidung,"token"=>$token_post,"datecreated"=>time());
$affect = $dbf->insertTable("sendkhachhang", $arraySendmail);
}
}
}
?>
<script type="text/javascript" src="js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
// General options
mode : "textareas",
theme : "simple"
});
</script>
<div style="width:780px; height: 580px; overflow-y:hidden; overflow-x:hidden; position: relative ">
<div style="height: auto; padding: 0px 10px 0px;">
<form name="frmsendmail" id="frmsendmail" action="" method="post">
<div style="color: red; padding: 5px 0px 5px; min-height: 30px;"><?php echo $msg; ?></div>
<p>
<label style="float: left; width:100px">Email:</label>
<input type="email" name="email" value="<?=$email?>" required />
<input type="hidden" value="<?=$token?>" name="token" />
</p>
<label style="float: left; width:100px">Tiêu đề: </label><input type="text" class="validate[required]" name="subject" id="subject" style="width:600px;" value="<?php echo $title;?>" required>
<h3>Nội dụng</h3>
<textarea class="validate[required]" id="noidung" name="noidung" style=" width:770px; height: 340px; font-size: 12px">
<h1>Dear <?php echo (($hovaten_khachhang!="")?$hovaten_khachhang:"Khách Hàng");?>, </h1>
Click vào link này để xem nội dung: <br>
<p><?=$url?></p>
</textarea>
<div style="text-align: center; padding: 10px 0px 0px; margin: 0px;">
<input type="submit" name="cmdsendmail" id="cmdsendmail" value="Sendmail" />
</div>
</form>
</div>
</div>