質問編集履歴
2
追加編集しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -32,6 +32,10 @@
|
|
32
32
|
|
33
33
|
```php
|
34
34
|
|
35
|
+
complete.php
|
36
|
+
|
37
|
+
|
38
|
+
|
35
39
|
<?php
|
36
40
|
|
37
41
|
session_start();
|
1
追加編集しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -27,3 +27,427 @@
|
|
27
27
|
Can't open /virtual/ikeno-derma/public_html/_demo/company_inquiry/log/contact.csv!
|
28
28
|
|
29
29
|
```
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
```php
|
34
|
+
|
35
|
+
<?php
|
36
|
+
|
37
|
+
session_start();
|
38
|
+
|
39
|
+
session_unset();
|
40
|
+
|
41
|
+
session_destroy();
|
42
|
+
|
43
|
+
?>
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
<?php
|
48
|
+
|
49
|
+
include("phpmailer.inc.php");
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
//edit(メールアドレスのみ。例えば携帯メールアドレスが必須のような場合「if($_POST['email']!="" && $_POST['email_mobile']!=""){」と記述する。)
|
56
|
+
|
57
|
+
//only for mailaddress
|
58
|
+
|
59
|
+
if($_POST['email']!=""){
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
$files = glob('uploads/*');
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
//edit(ファイル添付がある場合、その分だけ用意する。この項目が無かったらコメントアウトすること)if the image exists. you must commentout when this column is nothing.
|
68
|
+
|
69
|
+
//$my_path = "uploads/".$_POST['img'];
|
70
|
+
|
71
|
+
//$my_path2 = "uploads/".$_POST['img2'];
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
//edit(自動返信メール(管理者、複数指定可))reply mail for admin (you can specify multiple)
|
78
|
+
|
79
|
+
$items[] = array('subject' => '【】ホームページよりお問い合わせがありました。',
|
80
|
+
|
81
|
+
'header_mail' => $_POST['name'].' 様より、以下のお問い合わせがありました。<br><br><br>',
|
82
|
+
|
83
|
+
'footer_mail' => '',
|
84
|
+
|
85
|
+
'send_fromname' => $_POST['name'],
|
86
|
+
|
87
|
+
'send_from' => $_POST['email'],
|
88
|
+
|
89
|
+
'send_to' => array('support@netoption.co.jp'),
|
90
|
+
|
91
|
+
);
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
//edit(自動返信メール(エンドユーザ) ※「send_fromname」「send_from」にエンドユーザ向けのFROM表記・メアドを入力する。)reply mail for enduser (input to "send_fromname" & "send_from)
|
96
|
+
|
97
|
+
$items[] = array('subject' => '【】お問い合わせありがとうございます。',
|
98
|
+
|
99
|
+
'header_mail' => $_POST['name'].' 様<br><br>
|
100
|
+
|
101
|
+
お問い合わせありがとうございます。<br>
|
102
|
+
|
103
|
+
このメールは自動送信メールです。<br>
|
104
|
+
|
105
|
+
翌営業日を過ぎましてもお問い合わせに対する対応がない場合は、<br>
|
106
|
+
|
107
|
+
お手数をおかけしますがまで<br>
|
108
|
+
|
109
|
+
ご連絡くださいますようお願い申し上げます。<br><br><br>',
|
110
|
+
|
111
|
+
'footer_mail' => '',
|
112
|
+
|
113
|
+
'send_fromname' => '',
|
114
|
+
|
115
|
+
'send_from' => '',
|
116
|
+
|
117
|
+
'send_to' => array($_POST['email']),
|
118
|
+
|
119
|
+
);
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
foreach($items as $item)
|
126
|
+
|
127
|
+
{
|
128
|
+
|
129
|
+
//////////////header_mail////////////
|
130
|
+
|
131
|
+
$data= $item['header_mail'];
|
132
|
+
|
133
|
+
////////////////////////////////////
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
//edit(管理者・エンドユーザ共通、メールの中心部分)reply mail body for admin & enduser
|
140
|
+
|
141
|
+
$data.= "
|
142
|
+
|
143
|
+
氏名:<br>".$_POST['name']."<br><br>
|
144
|
+
|
145
|
+
フリガナ:<br>".$_POST['kana']."<br><br>
|
146
|
+
|
147
|
+
郵便番号:<br>〒".$_POST['postcode']."<br><br>
|
148
|
+
|
149
|
+
ご住所:<br>".$_POST['add1'].$_POST['add2']."<br><br>
|
150
|
+
|
151
|
+
電話番号:<br>".$_POST['tel1']."-".$_POST['tel2']."-".$_POST['tel3']."<br><br>
|
152
|
+
|
153
|
+
FAX番号:<br>".$_POST['fax1']."-".$_POST['fax2']."-".$_POST['fax3']."<br><br>
|
154
|
+
|
155
|
+
メールアドレス:<br>".$_POST['email']."<br><br>
|
156
|
+
|
157
|
+
お問い合わせ内容:<br>".$_POST['message']."<br><br>
|
158
|
+
|
159
|
+
";
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
//////////////footer_mail////////////
|
164
|
+
|
165
|
+
$data.= $item['footer_mail'];
|
166
|
+
|
167
|
+
////////////////////////////////////
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
$fromname = $item['send_fromname'];
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
////////////// Subject ////////////
|
176
|
+
|
177
|
+
$subject = $item['subject'];
|
178
|
+
|
179
|
+
////////////////////////////////////
|
180
|
+
|
181
|
+
$send_from = $item['send_from'];
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
$body = $data;
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
$mailBody = $body;
|
190
|
+
|
191
|
+
$objMail = new PHPMailer();
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
$objMail->ContentType = "text/html";
|
196
|
+
|
197
|
+
$objMail->CharSet = "utf-8";
|
198
|
+
|
199
|
+
$objMail->Mailer = "mail";
|
200
|
+
|
201
|
+
$objMail->Priority = 3;
|
202
|
+
|
203
|
+
$objMail->From = $send_from;
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
$objMail->FromName =$fromname;
|
208
|
+
|
209
|
+
$objMail->Subject = $subject;
|
210
|
+
|
211
|
+
//edit(ファイル添付がある場合↑と合わせる。)if the image exists. (same ↑.)
|
212
|
+
|
213
|
+
if($_POST['img']!=""){
|
214
|
+
|
215
|
+
$objMail->AddAttachment($my_path);
|
216
|
+
|
217
|
+
}
|
218
|
+
|
219
|
+
if($_POST['img2']!=""){
|
220
|
+
|
221
|
+
$objMail->AddAttachment($my_path2);
|
222
|
+
|
223
|
+
}
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
$objMail->Body = $mailBody;
|
228
|
+
|
229
|
+
//////////////Send to////////////
|
230
|
+
|
231
|
+
foreach($item['send_to'] as $send_to){
|
232
|
+
|
233
|
+
$objMail->AddAddress($send_to);
|
234
|
+
|
235
|
+
}
|
236
|
+
|
237
|
+
////////////////////////////////////
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
$objMail->Send();
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
}
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
// get all file names
|
250
|
+
|
251
|
+
foreach($files as $file){ // iterate files
|
252
|
+
|
253
|
+
if(is_file($file))
|
254
|
+
|
255
|
+
unlink($file); // delete file
|
256
|
+
|
257
|
+
}
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
/**
|
264
|
+
|
265
|
+
* Logging class:
|
266
|
+
|
267
|
+
* - contains lfile, lwrite and lclose public methods
|
268
|
+
|
269
|
+
* - lfile sets path and name of log file
|
270
|
+
|
271
|
+
* - lwrite writes message to the log file (and implicitly opens log file)
|
272
|
+
|
273
|
+
* - lclose closes log file
|
274
|
+
|
275
|
+
* - first call of lwrite method will open log file implicitly
|
276
|
+
|
277
|
+
* - message is written with the following format: [d/M/Y:H:i:s] (script name) message */
|
278
|
+
|
279
|
+
//$msg = str_replace("<br>",",",$datalog);
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
/*--Start Config Log----------------------------------------------------------------*/
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
// Filename of log to use when none is given to write_log , and log folder change permission to 777
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
//edit(ログファイル設定 DEFAULT_LOGはサーバに合わせること)logfile (DEFAULT_LOG is setting for server)
|
294
|
+
|
295
|
+
define("DEFAULT_LOG","/virtual/ikeno-derma/public_html/_demo/company_inquiry/log/contact.csv");
|
296
|
+
|
297
|
+
$datalog.='氏名:'.$_POST['name'].'';
|
298
|
+
|
299
|
+
$datalog.=",";
|
300
|
+
|
301
|
+
$datalog.='フリガナ:'.$_POST['kana'].'';
|
302
|
+
|
303
|
+
$datalog.=",";
|
304
|
+
|
305
|
+
$datalog.='郵便番号:'.$_POST['postcode'].'';
|
306
|
+
|
307
|
+
$datalog.=",";
|
308
|
+
|
309
|
+
$datalog.='ご住所:'.$_POST['add2'].'';
|
310
|
+
|
311
|
+
$datalog.=",";
|
312
|
+
|
313
|
+
$datalog.='電話番号:'.$_POST['tel'].'';
|
314
|
+
|
315
|
+
$datalog.=",";
|
316
|
+
|
317
|
+
$datalog.='FAX番号:'.$_POST['fax'].'';
|
318
|
+
|
319
|
+
$datalog.=",";
|
320
|
+
|
321
|
+
$datalog.='メールアドレス:'.$_POST['email'].'';
|
322
|
+
|
323
|
+
$datalog.=",";
|
324
|
+
|
325
|
+
$datalog.='お問い合わせ内容:'.$_POST['message'].'';
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
/*--END Config Log----------------------------------------------------------------*/
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
$msg = $datalog;
|
340
|
+
|
341
|
+
class Logging {
|
342
|
+
|
343
|
+
// declare log file and file pointer as private properties
|
344
|
+
|
345
|
+
private $log_file, $fp;
|
346
|
+
|
347
|
+
// set log file (path and name)
|
348
|
+
|
349
|
+
public function lfile($path) {
|
350
|
+
|
351
|
+
$this->log_file = $path;
|
352
|
+
|
353
|
+
}
|
354
|
+
|
355
|
+
// write message to the log file
|
356
|
+
|
357
|
+
public function lwrite($message) {
|
358
|
+
|
359
|
+
// if file pointer doesn't exist, then open log file
|
360
|
+
|
361
|
+
if (!is_resource($this->fp)) {
|
362
|
+
|
363
|
+
$this->lopen();
|
364
|
+
|
365
|
+
}
|
366
|
+
|
367
|
+
// define script name
|
368
|
+
|
369
|
+
$script_name = pathinfo($_SERVER['PHP_SELF'], PATHINFO_FILENAME);
|
370
|
+
|
371
|
+
// define current time and suppress E_WARNING if using the system TZ settings
|
372
|
+
|
373
|
+
// (don't forget to set the INI setting date.timezone)
|
374
|
+
|
375
|
+
$time = @date('[d/M/Y:H:i:s]');
|
376
|
+
|
377
|
+
// write current time, script name and message to the log file
|
378
|
+
|
379
|
+
// fwrite($this->fp, "$time ($script_name) $message" . PHP_EOL);
|
380
|
+
|
381
|
+
fwrite($this->fp, "$time , $message" . PHP_EOL);
|
382
|
+
|
383
|
+
}
|
384
|
+
|
385
|
+
// close log file (it's always a good idea to close a file when you're done with it)
|
386
|
+
|
387
|
+
public function lclose() {
|
388
|
+
|
389
|
+
fclose($this->fp);
|
390
|
+
|
391
|
+
}
|
392
|
+
|
393
|
+
// open log file (private method)
|
394
|
+
|
395
|
+
private function lopen() {
|
396
|
+
|
397
|
+
$log_file_default = DEFAULT_LOG;
|
398
|
+
|
399
|
+
// define log file from lfile method or use previously set default
|
400
|
+
|
401
|
+
$lfile = $this->log_file ? $this->log_file : $log_file_default;
|
402
|
+
|
403
|
+
// open log file for writing only and place file pointer at the end of the file
|
404
|
+
|
405
|
+
// (if the file does not exist, try to create it)
|
406
|
+
|
407
|
+
$this->fp = fopen($lfile, 'a') or exit("Can't open $lfile!");
|
408
|
+
|
409
|
+
}
|
410
|
+
|
411
|
+
}
|
412
|
+
|
413
|
+
|
414
|
+
|
415
|
+
// Logging class initialization
|
416
|
+
|
417
|
+
$log = new Logging();
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
// set path and name of log file (optional)
|
422
|
+
|
423
|
+
$log->lfile(DEFAULT_LOG);
|
424
|
+
|
425
|
+
|
426
|
+
|
427
|
+
// write message to the log file
|
428
|
+
|
429
|
+
$log->lwrite($msg);
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
// close log file
|
434
|
+
|
435
|
+
$log->lclose();
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
}else{
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
header("Location: index.php");
|
444
|
+
|
445
|
+
|
446
|
+
|
447
|
+
}
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
?>
|
452
|
+
|
453
|
+
```
|