-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresponse.php
More file actions
224 lines (199 loc) · 9.31 KB
/
Copy pathresponse.php
File metadata and controls
224 lines (199 loc) · 9.31 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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<?php
use PHPMailer\PHPMailer\PHPMailer;
date_default_timezone_set("Africa/Algiers");
$forme_Salone = ['U'=>['A','B','C'],'L'=>['A','B'],'G'=>['A','B','C','D','E'],'C'=>['A','B','C']];
/* Start */
$body = '<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Demande de prix - Commande</title>
<meta http-equiv="Content-Type" content="text/html"/>
<meta charset="UTF-8">
<style media="all">
*{
margin: 0;
padding: 0;
line-height: 1.3;
font-family: sans-serif;
color: #333542;
}
body{font-size: .875rem;}
.gry-color *,.gry-color{color:#878f9c;}
.black-color{color: #010;}.red-color{color:red}
table{width: 100%;}
table th{font-weight: normal;}
table.padding th{padding: .5rem .7rem;}
table.padding td{padding: .7rem;}
table.sm-padding td{padding: .2rem .7rem;}
.border-bottom td,
.border-bottom th{border-bottom:1px solid #f2f2f2;}
.text-upper{text-transform: uppercase;}.text-center{text-align: center;}
.text-left{text-align:left;}
.text-right{text-align:right;}.strong{font-weight: bold;}
.small{font-size: .85rem;}img{float: right;}
</style>
</head>
<body><div style="margin-left:auto;margin-right:auto;">';
if ($_SERVER["REQUEST_METHOD"] == "POST") {
require_once "PHPMailer/PHPMailer.php";
require_once "PHPMailer/SMTP.php";
require_once "PHPMailer/Exception.php";
$nom = isset($_POST["nom"])?filter_var($_POST["nom"],FILTER_SANITIZE_STRING):"";
$telephone = isset($_POST["telephone"])?filter_var($_POST["telephone"],FILTER_SANITIZE_NUMBER_INT):"";
$addresse = isset($_POST["addresse"])?filter_var($_POST["addresse"],FILTER_SANITIZE_STRING):"";
if (!empty($nom) && !empty($telephone) && !empty($addresse)) {
$body .= '<div style="background: #f2f2f2;padding: 1.5rem;">
<table>
<tr>
<td style="font-size: 2rem;" class="text-left text-upper">Demande de prix</td>
<td>
<img src="images/logo.png" class="text-right" width="130px" height="50px" style="display:inline-block;">
</td>
</tr>
</table>
<table>
<tr>
<td style="font-size: 1.2rem;" class="strong gry-color">Mr.<span class="text-upper black-color">'.$nom.'</span></td>
<td class="text-right"></td>
</tr>
<tr>
<td class="gry-color">Adresse : <span class="strong black-color">'.$addresse.'</span></td>
<td class="text-right"><span class="strong">N°DP896323</span></td>
</tr>
<tr>
<td class="gry-color">Téléphone : <span class="strong black-color">'.$telephone.'</span></td>
<td class="text-right gry-color">Date : <span class="strong black-color">'.date("d-m-20y - H:i:s").'</span></td>
</tr>
</table></div>
<div style="padding: 1.5rem;padding-bottom: 0">
<h3 class="gry-color text-center" style="background: #f2f2f2;padding:10px">Désignation : SALON MAROCAIN REF <span class="strong black-color">ASSIA0253</span></h3>
</div>
<div style="padding: 1.5rem;">
<table class="padding text-left small border-bottom">
<thead>
<tr>
<th width="25%" style="background: #f2f2f2;">Croquis de salon et cotations</th>
<th width="75%" style="background: #f2f2f2;">Dimension Forme de salon : <span class="strong red-color">'.$_POST["forme_salon"].'</span></th>
</tr>
</thead>
<tbody class="strong">';
$ligne_forme = "";
for ($i=0; $i < count($forme_Salone[$_POST["forme_salon"]]); $i++) {
$ligne_forme .= '<tr class="strong"><td class="gry-color">Linge « '.$forme_Salone[$_POST["forme_salon"]][$i].' »</td>
<td class="strong black-color">'.$_POST["forme_linge_" . $forme_Salone[$_POST["forme_salon"]][$i]].' <span class="gry-color">ML</span></td></tr>';
}
$body .= $ligne_forme . '</tbody></table></div>';
$element2 = "";
if (!empty($_POST["type_banquette"]) || !empty($_POST["type_bois"]) || !empty($_POST["texture_bois"]) || !empty($_POST["tissus_brocard"])) {
$element2 = '<div style="padding: 1.5rem;">
<table class="padding text-left small border-bottom">
<thead>
<tr>
<th width="50%" style="background: #f2f2f2;">Titre</th>
<th width="50%" style="background: #f2f2f2;">Eléments à intégrer dans le salon</th>
</tr>
</thead>
<tbody class="strong">';
}
$body .= (!empty($element2))?$element2:"";
if (!empty($_POST["type_banquette"])) {
$body .= '<tr class="strong"><td class="gry-color">Banquettes</td>
<td class="strong black-color">'.$_POST["type_banquette"].'</td></tr>';
}
if (!empty($_POST["type_bois"])) {
$body .= '<tr class="strong"><td class="gry-color">Bois préférez</td>
<td class="strong black-color">'.$_POST["type_bois"].'</td></tr>';
}
if (!empty($_POST["texture_bois"])) {
$body .= '<tr class="strong"><td class="gry-color">Texture bois</td>
<td class="strong black-color">'.$_POST["texture_bois"].'</td></tr>';
}
/* this array exploade ou imploade */
if (!empty($_POST["tissus_brocard"])) {
$body .= '<tr class="strong"><td class="gry-color">Tissus préférez</td>
<td class="strong black-color">'.implode(";",$_POST["tissus_brocard"]).'</td></tr>';
}
$body .= (!empty($element2))?'</tbody></table></div>':"";
$element3 = "";
if (!empty($_POST["table"]) || !empty($_POST["cendrier"]) || !empty($_POST["coin"]) || !empty($_POST["accoudoir"])) {
$element3 .= '<div style="padding: 1.5rem;">
<table class="padding text-left small border-bottom">
<thead>
<tr>
<th width="50%" style="background: #f2f2f2;">Eléments et accessoires</th>
<th width="25%" style="background: #f2f2f2;">Réf</th>
<th width="25%" style="background: #f2f2f2;">Qté</th>
</tr>
</thead>
<tbody class="strong">';
}
$body .= (!empty($element3))?$element3:"";
if (!empty($_POST["table"])) {
$body .='<tr class="strong">
<td class="gry-color">Table</td>
<td class="strong black-color">'.$_POST["table"].'</td>
<td class="strong black-color">'.$_POST["qte_table"].'</td></tr>';
}
if (!empty($_POST["cendrier"])) {
$body .='<tr class="strong">
<td class="gry-color">Cendrier</td>
<td class="strong black-color">'.$_POST["cendrier"].'</td>
<td class="strong black-color">'.$_POST["qte_cendrier"].'</td></tr>';
}
if (!empty($_POST["coin"])) {
$body .='<tr class="strong">
<td class="gry-color">Coin</td>
<td class="strong black-color">'.$_POST["coin"].'</td>
<td class="strong black-color">'.$_POST["qte_coin"].'</td></tr>';
}
if (!empty($_POST["accoudoir"])) {
$body .='<tr class="strong">
<td class="gry-color">Accoudoir</td>
<td class="strong black-color">'.$_POST["accoudoir"].'</td>
<td class="strong black-color">'.$_POST["qte_accoudoir"].'</td></tr>';
}
$body .= '</tbody></table></div>';
$body .= '<div class="text-center" style="background: #f2f2f2;padding: 1.5rem;"><p>VOTRE COMMANDE</p></div></div></body></html>';
/* End */
//$email = "YoussefApiwi48@gmail.com"; this is email Youssef Apiwi Developer
/* Methode 1 Mail in p-php */
//add email here
$email = "example@gmail.com";
$subject = "Demande de Prix " . date("d-m-20y");
$headers = "From: Commande <contact@apiwi-multimedia.com>\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset-utf-8";
if(mail($email, $subject, $body,$headers))
{
$status = "success";
} else {
$status = "failed";
}
/* Methode PHPMailer */
/* $mail = new PHPMailer();
//SMTP Settings
$mail->isSMTP();
$mail->Host = "smtp.gmail.com";
$mail->SMTPAuth = true;
$mail->Username = "example@gmail.com";
$mail->Password = '************';
$mail->Port = 465;
$mail->SMTPSecure = "ssl";
//Email Settings
$mail->isHTML(true);
$mail->setFrom("example@gmail.com", $nom);
$mail->addAddress("example@gmail.com");
$mail->Subject = "Demande de Prix " . date("d-m-20y");
$mail->Body = $body;
if ($mail->send()) {
$status = "success";
} else {
$status = "failed";
}
*/
exit(json_encode(array("status" => $status)));
} else {
header('Location: index.html');
exit;
}
}