Example #1
0
<?php

header("content-type:text/html; charset=utf-8");
header("cache-control: private");
ob_start();
include_once $_SERVER['DOCUMENT_ROOT'] . "/common/lib/function.php";
$filepath = $_GET['filepath'];
$origin_filename = iconv_to_euckr($_GET['origin_filename']);
$filename = $_GET['filename'];
$real_filepath = $_SERVER['DOCUMENT_ROOT'] . $filepath . "/" . $filename;
if (!is_file($real_filepath)) {
    echo "\n\t<script language='javascript'>\n\talert('해당 파일이나 경로가 존재하지 않습니다.');\n\thistory.back();\n\t</script>\n\t";
    exit;
}
if (preg_match("/MSIE /", $_SERVER['HTTP_USER_AGENT'])) {
    header("Content-Type: doesn/matter");
    // 다운로드 받을 땐 무엇을 적어도 상관 없음
    header("Content-Length: " . (string) filesize("{$real_filepath}"));
    header("Content-Disposition: attachment; filename={$origin_filename}");
    header("Content-Transfer-Encoding: binary");
    header("Pragma: no-cache");
    header("Expires: 0");
    header("Cache-Control: cache, must-revalidate");
} else {
    Header("Content-type: file/unknown");
    Header("Content-Length: " . (string) filesize("{$real_filepath}"));
    Header("Content-Disposition: attachment; filename={$origin_filename}");
    Header("Content-Description: PHP4 Generated Data");
    Header("Pragma: no-cache");
    Header("Expires: 0");
}
Example #2
0
function sendmail($mailname, $mailfrom, $mailto, $mailtitle, $mailcontent)
{
    $header = "Return-Path: {$mailfrom}\r\n";
    //\r 엔터키
    $header .= "Reply-To: {$mailname}<{$mailfrom}>\r\n";
    $header .= "From: {$mailname}<{$mailfrom}>\r\n";
    $header .= "Content-Type: text/html\r\n";
    $header .= "MIME-Version: 1.0\r\n";
    $mailtitle = iconv_to_euckr($mailtitle);
    $mailcontent = iconv_to_euckr($mailcontent);
    mail($mailto, $mailtitle, $mailcontent, $header);
}