/var/www/hkosl.com/ifapc/html_20210817/tc/contact_controler.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
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
<?php

$companyname 
$_POST["companyName"];
$name $_POST["name"];
$email $_POST["email"];
$phone $_POST["phone"];
$detial $_POST["detial"];




// Event
if (!function_exists('call_curl')) {
        function 
call_curl($url$postData$post)
        {
                if (!empty(
$post)) {
                        
$ch curl_init();
                        
curl_setopt($chCURLOPT_URL$url);
                        
curl_setopt($chCURLOPT_RETURNTRANSFER1);
                        
curl_setopt($chCURLOPT_POST1);
                        
curl_setopt($chCURLOPT_IPRESOLVECURL_IPRESOLVE_V4);
                        
curl_setopt($chCURLOPT_HEADER0);
                        
curl_setopt($chCURLOPT_SSL_VERIFYPEER0);
                        
curl_setopt($chCURLOPT_POSTFIELDS$postData);
                        
$result curl_exec($ch);
                        
curl_close($ch);
                } else {
                        
$ch curl_init();
                        
curl_setopt($chCURLOPT_URL$url);
                        
curl_setopt($chCURLOPT_RETURNTRANSFER1);
                        
curl_setopt($chCURLOPT_IPRESOLVECURL_IPRESOLVE_V4);
                        
curl_setopt($chCURLOPT_HEADER0);
                        
curl_setopt($chCURLOPT_SSL_VERIFYPEER0);
                        
$result curl_exec($ch);
                        
curl_close($ch);
                }

                return 
$result;
        }
}



//$google_recaptcha_secret_key = '6LfHl-kZAAAAABGPau2E1jd99V2r5dGuNu5FiCm6';
//$url          = "https://www.google.com/recaptcha/api/siteverify";
//$post_data    = array("secret" => $google_recaptcha_secret_key, "response" => $_POST["g-recaptcha-response"]);
//$result       = call_curl($url, $post_data, 1);
//$result_array = json_decode($result, true);





if (isset($_POST)) {

        
$subject "香港股票分析師協會上市公司年度大獎 - " date("Ymd");
        
$formtitle '<h1>香港股票分析師協會上市公司年度大獎查詢</h1>';
        
$content .= '公司名稱:' $companyname;
        
$content .= '<br/><br/>聯絡人:' $name;
        
$content .= '<br/><br/>聯絡人電話:' $phone;
        
$content .= '<br/><br/>Email Address:' $email;
        
$content .= '<br/><br/>介紹人/渠道:' $detial;

        
contactForm($subject$formtitle$content);
}
function 
contactForm($subject$formtitle$content '')
{

        
$email_subject  $subject//"Urbanhousehk Website Enquiry - ".date("Ymd");


        
$body '<html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <style type="text/css">
    body,td,th {
        font-size: 16px;
        font-family: Arial, Helvetica, sans-serif, Simhei, STHeiti, Apple LiGothic Medium";
        color: #000;
    }
        a {color: #cfa231;}
    </style>
    </head>
    
    <body><table width="570" border="0" cellspacing="0" cellpadding="0"><tbody>
    <tr><td>'
;
        
$body .= $formtitle;
        
$body .= $content;
        
// $body .=  'Family Name:'.$familyName;
        // $body .= '<br/>Email Address:'.$emailAddress;
        // $body .= '<br/>Tel:'.$tel;
        // $body .= '<br/>Company Name:'.$companySize;
        // $body .= '<br/>Hear about URBANHOUSE Workspace in:'.$where;
        // $body .= '<br/>message:'.$message;
        // $body .= '<br/>newsletter:'.$newsletter;
        
$body .= '</td>
        </tr></tbody></table></center>'
;
        
$body .= '</body></html>';

        
submitForm($email_subject$body);
}






function 
submitForm($email_subject$body)
{


        
$sender_email "#";

        
$receiver "#";

        require_once(
'inc/class.phpmailer.php');

        
$x_mail = new PHPMailer();
        
$x_mail->IsSMTP();


        
$x_mail->Host       'localhost';                   // Specify main and backup server
        // $x_mail->Port       = 587;                                    // Set the SMTP port
        //   $x_mail->SMTPAuth   = true;                               // Enable SMTP authentication
        //   $x_mail->Username   = 'apikey';                // SMTP username
        //   $x_mail->Password   = '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';   // SMTP password
        // $x_mail->SMTPSecure = 'tls';

        
$x_mail->CharSet "UTF-8";
        
$x_mail->Sender  $sender_email;
        
$x_mail->AddReplyTo($sender_email"sender");
        
$x_mail->From     $sender_email;
        
$x_mail->FromName "聯絡我們";

        
$x_mail->AddAddress("#""name");
        
$x_mail->AddBCC("#""BCC name");

        
$x_mail->WordWrap 50;
        
$x_mail->IsHTML(true);
        
$x_mail->Subject $email_subject;
        
$x_mail->Body  $body;


        if (
$x_mail->Send()) {

                
// header("Location: http://www.redirect.to.url.com/");

                
echo '<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
body,td,th {
    font-size: 16px;
    font-family: Arial, Helvetica, sans-serif, Simhei, STHeiti, Apple LiGothic Medium";
    color: #000;
}
    a {color: #cfa231;}
</style>
</head>

<body style="background-color:#fff;"><div style="text-align: center;box-shadow: rgba(0, 0, 0, 0.1) 2px 2px 24px 0px;margin:  10%;padding: 50px;background: #fff;"><h1 style="text-align: center;color: #000;">謝謝你的查詢!</h1><a href="http://www.jciqueensway.org.hk/eba/" style="color:#cdcdcd">返回官網</a></div></body></html>'
;



                echo 
'<script>setTimeout(function(){ window.location.href = "http://www.jciqueensway.org.hk/eba/"; }, 3000);</script>';

                
// $msg = "true";
                // exit;
        
} else {
                echo 
"false";
                
//echo "<script type='text/javascript'>alert('$msg');</script>";
                //$x_mail->errorinfo();
                // var_dump($x_mail);
                // exit;
        
}
}