|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /home/queenjbs/www/conf/ |
Upload File : |
<?
function Alert_back($msg) { // 메시지를 보이고 뒤로
echo "<script>alert('$msg');history.back()</script>";
exit;
}
function Alert_msg($msg) { // 메시지를 보인다.
echo "<script>alert('$msg');</script>";
// exit; <-- 중단 하지 않도록 한다.
}
function Alert_go($msg,$url) { // 메시지를 보이고 해당 url 로 이동
echo "<script>alert('$msg');location.href='$url';</script>";
exit;
}
function Opener_close($msg) { // 메시지를 보이고 자식창을 닫는다.
echo "<script>alert('$msg');opener.document.location.reload();self.close();</script>";
exit;
}
function Gogo($url,$sec=0) { // 해당 주소로 간다.
echo "<META http-equiv='refresh' content='$sec; url=$url'>";
exit;
}
function Opener_reload_close() { // 부모창 다시읽고 자식창을 닫는다.
echo "
<script>
opener.document.location.reload();
self.close();
</script>
";
exit;
}
function Confirm_go($msg,$url,$url2) { // 사용자의 동의를 받고 해당 url 로 이동
echo "
<script>
if ( confirm('$msg') ) {
location.href='$url';
} else {
location.href='$url2';
}
</script>";
exit;
}
function Parent_go($msg,$url) { // 사용자의 동의를 받고 해당 url 로 이동
echo "
<script>
alert('$msg');
parent.location.href='$url'
</script>";
exit;
}
//메일
function sendmail_jpn($to, $subject, $message, $from_email,$from_name, $filepath)
{
//$mime_type = "application/octet-stream";
// 添付ファイルのエンコード
//$filename = basename( $filepath );
// マルチパートなので、パートの区切り文字列を指定
$boundary = '----=_Boundary_' . uniqid(rand(1000,9999) . '_') . '_';
// 件名のエンコード
$subject = mb_convert_encoding($subject, 'ISO-2022-JP', 'UTF-8');
$subject = mb_encode_mimeheader_ex($subject);
// 本文のエンコード
$message = mb_convert_encoding($message, 'ISO-2022-JP', 'UTF-8');
// toをエンコード
//$to = mb_convert_encoding($mail['to']['name'], "ISO-2022-JP", "UTF-8");
$to = "=?ISO-2022-JP?B?" . base64_encode($to) . '?= <' . $to . '>';
// fromをエンコード
// $from = mb_convert_encoding($mail['from']['name'], "UTF-8", "UTF-8");
$from = "=?ISO-2022-JP?B?" . base64_encode($from_name) . '?= <' . $from_email . '>';
// 添付ファイルのエンコード
//$filename = mb_convert_encoding($filename, 'ISO-2022-JP', 'UTF-8');
//$filename = "=?ISO-2022-JP?B?" . base64_encode($filename) . "?=";
// ヘッダーの指定
$head = "";
$head .= "From: {$from}\n";
$head .= "MIME-Version: 1.0\n";
$head .= "Content-Type: text/html; charset=ISO-2022-JP";
//$head .= "Content-Type: multipart/mixed; boundary=\"{$boundary}\"\n";
//$head .= "Content-Type: multipart/mixed; \n";
$head .= "Content-Transfer-Encoding: 7bit";
$body = "";
// 本文
$body .= "\n";
$body .= "{$message}\n";
$body .= "\n";
// 添付ファイルの処理
/*$body .= "--{$boundary}\n";
$body .= "Content-Type: {$mime_type}; name=\"{$filename}\"\n" .
"Content-Transfer-Encoding: base64\n" .
"Content-Disposition: attachment; filename=\"{$filename}\"\n";
$body .= "\n";
$fp = fopen( $filepath, "r" ) or die("Error on mailing. (attachment file cannot open)");
$contents = fread( $fp, filesize($filepath) );
fclose( $fp );
$f_encoded = chunk_split(base64_encode($contents)); //添付ファイルをbase64エンコードする
$body .= "{$f_encoded}\n";
$body .= "\n";
*/
if (mail($to, $subject, $body, $head)) {
echo 'sendmail_jpn : OK.';
} else {
echo 'sendmail_jpn : FAILURE.';
}
}
// mb_encode_mimeheaderのバグ対策用
function mb_encode_mimeheader_ex($text, $split_count = 34) {
$position = 0;
$encorded = '';
while ($position < mb_strlen($text, 'ISO-2022-JP')) {
if ($encorded != '') {
$encorded .= "\r\n ";
}
$output_temp = mb_strimwidth($text, $position, $split_count, '', 'ISO-2022-JP');
$position = $position + mb_strlen($output_temp, 'ISO-2022-JP');
$encorded .= "=?ISO-2022-JP?B?" . base64_encode($output_temp) . "?=";
}
return $encorded;
}
?>