/home/mjc1/public_html/html/millennium/join_mail_send.php


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
<?php include_once("./_common2.php"); ?>
<?php

$mail_site 
$_POST['mail_site'];
$r_mail $_POST['r_mail'];
$r_id $_POST['r_id'];

function 
mail_log_write($post$mail){ // post, mail 로그
    
Global $r_id;
    if(
$post!=''){
        
ob_start();
        
print_r($post);
        
$res ob_get_contents();
        
ob_end_clean();
        
//$res = iconv("euckr","utf-8",$res);
    
}
    if(
$mail!=""){
        
ob_start();
        
print_r($mail);
        
$res ob_get_contents();
        
ob_end_clean();
    }

    
$datetime date("[Y-m-d H:i:s]",time());
    
$date_dir date("Y-m-d",time());
    
$month_dir date("Y-m",time());
    
$file_name "M_{$r_id}-{$date_dir}";

    @
mkdir($_SERVER['DOCUMENT_ROOT']."/sql_log/mail_log/{$month_dir}");
    @
chmod($_SERVER['DOCUMENT_ROOT']."/sql_log/mail_log/{$month_dir}",0707);

    
$fp fopen($_SERVER['DOCUMENT_ROOT']."/sql_log/mail_log/{$month_dir}/{$file_name}",'a');
    
fwrite($fp,$datetime.chr(10).$res);
    
fclose($fp);

    @
chmod($_SERVER['DOCUMENT_ROOT']."/sql_log/mail_log/{$month_dir}/{$file_name}",0707);

    if(
$handle opendir($_SERVER['DOCUMENT_ROOT']."/sql_log/mail_log/")) {
        while(
false !== ($entry readdir($handle))) {
            if(
$entry == '.' || $entry == '..')
                continue;

            
$path $_SERVER['DOCUMENT_ROOT']."/sql_log/mail_log/".$entry;

            if(
is_dir($path))
                
$directory[] = $path;
        }
    }

    
flush();

    
$m6 strtotime("-6 month $day"); // 6개월 이전껀 삭제
    
$key_date date("Y-m",$m6);

    foreach(
$directory as $dir){
        
$v explode("/",$dir);
        
$vv $v[count($v)-1];
        if(
$vv<$key_date){
            if(
$dir!=''){
                
exec("rm -rf {$dir}");
            }
        }
    }

}

mail_log_write($_POST'');

$loginUrl "http://mjsoft.co/html/millennium/join_mail.php";

$ch curl_init(); 
curl_setopt ($chCURLOPT_URL,$loginUrl); //접속할 URL 주소 
curl_setopt ($chCURLOPT_SSL_VERIFYPEERfalse); 
curl_setopt ($chCURLOPT_HEADER0); 
curl_setopt ($chCURLOPT_TIMEOUT30); 
curl_setopt ($chCURLOPT_RETURNTRANSFER1); 
$result curl_exec ($ch); 

include(
$_SERVER['DOCUMENT_ROOT']."/emillennium/lib/PHPMailer5/PHPMailerAutoload.php"); // phpmailer 5 모듈 그누보드 2.0 모듈하고 몇몇 명령어나 대소문자나 기타 틀림

$smtp_use "smtp.naver.com";
$smtp_port "465";
$smtp_mail_id "1000y3";
$smtp_mail_pw "mj15668680";

$send_email "1000y3@naver.com";
$send_name "엠제이소프트";
$recv_email $r_mail;
$email_subject "엠제이소프트 회원가입을 축하드립니다.";

$email_content $result;

$mail = new PHPMailer;
$mail->IsSMTP();
$mail->SMTPDebug 0;
$mail->Debugoutput 'html';
$mail->Host $smtp_use;
$mail->SMTPAuth true;
$mail->Port $smtp_port;
$mail->SMTPSecure "ssl";        // SSL을 사용함
$mail->Username $smtp_mail_id;
$mail->Password $smtp_mail_pw;

$mail->setFrom($send_email$send_name);
$mail->addAddress($recv_email);
$mail->Subject $email_subject;
$mail->isHTML(true); 
$mail->Body "{$email_content}<br>";

$mail_log[] = $mail_site;
$mail_log[] = $r_id;
$mail_log[] = $send_email;
$mail_log[] = $send_name;
$mail_log[] = $recv_email;
$mail_log[] = $email_subject;
$mail_log[] = $email_content;
mail_log_write(''$mail_log);

if (!
$mail->send()) {
    echo 
"FAIL";
} else {
    echo 
"OK";
    
$mail->ErrorInfo "OK";
}
mail_log_write(''$mail->ErrorInfo);

?>