250 lines
8.7 KiB
PHP
250 lines
8.7 KiB
PHP
<?
|
|
/*****
|
|
* 공통 include 파일
|
|
*
|
|
* 각 Script 에 include 될 파일이다.
|
|
* 따라서 모든 페이지에 include 될 부분일 이곳에 적용해준다.
|
|
*****/
|
|
|
|
ini_set('zlib.output_compression', 'On');
|
|
ini_set('zlib.output_compression_level', 5 );
|
|
|
|
function callback($buffer)
|
|
{
|
|
global $_DB;
|
|
if(is_object($_DB) && !DB::isError($_DB)){
|
|
### disconnect
|
|
$_DB->disconnect();
|
|
|
|
### unset
|
|
unset($_DB);
|
|
}
|
|
|
|
if(_ALERT == "1"){
|
|
return _MSG;
|
|
}else{
|
|
//return ob_gzhandler($buffer,5);
|
|
return $buffer;
|
|
}
|
|
// 모든 apples를 oranges로 치환합니다.
|
|
//return (str_replace("apples", "oranges", $buffer));
|
|
}
|
|
|
|
ob_start("callback"); //출력 버퍼링을 켭니다. 출력 버퍼링을 활성화하면, (헤더를 제외한) 스크립트의 모든 출력을 내부 버퍼에 저장하고, 실제로 전송하지 않습니다.
|
|
|
|
# for HTTP/1.1
|
|
header ('Cache-Control: no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0');
|
|
# for HTTP/1.0
|
|
header ('Pragma: no-cache');
|
|
|
|
require_once dirname(__file__).'/conf/config.php'; // 기본설정
|
|
require_once dirname(__file__).'/lib/lib.util.php'; // 함수
|
|
require_once dirname(__file__).'/lib/class.cipher.php'; // 암호화/복호화
|
|
require_once dirname(__file__).'/phpThumb/phpThumb.config.php'; //썸네일
|
|
require_once dirname(__file__).'/upload/src/class.upload.php'; //썸네일 변환
|
|
require_once dirname(__file__).'/lib/class.smtp.php'; // SMTP
|
|
require_once dirname(__file__).'/lib/class.phpmailer.php'; // SMTP
|
|
require_once dirname(__file__).'/lib/class.user.php'; // 회원
|
|
require_once dirname(__file__).'/lib/class.board.php'; // 게시판
|
|
require_once dirname(__file__).'/lib/class.contact.php'; // 문의
|
|
require_once dirname(__file__).'/lib/class.popup.php'; // 팝업
|
|
require_once dirname(__file__).'/lib/class.banner.php'; // 배너관리
|
|
require_once dirname(__file__).'/lib/class.history.php'; // 연혁관리
|
|
|
|
$sessdir = str_replace("/mobile","",_PDS)."sessions";
|
|
ini_set('session.save_path', $sessdir);
|
|
|
|
### 정보에 대해 세션을 사용할것이다. 따라서 이곳에서 start 해준다.
|
|
if(!session_id()){
|
|
session_start();
|
|
}
|
|
|
|
// 1 시간 이상된 세션을 강제로 삭제한다.
|
|
$d = dir(_PDS."sessions");
|
|
while (false !== ($entry = $d->read())) {
|
|
if (substr($entry, 0, 1) != '.' && $entry != 'index.php'){
|
|
$temp = file(_PDS."sessions" . '/' . $entry);
|
|
if( date ("YmdHis", filemtime(_PDS."sessions" . '/' . $entry)) < date("YmdHis",strtotime("-1 hour", strtotime(date ("Y-m-d H:i:s")))) ){
|
|
@unlink(_PDS."sessions" . '/' . $entry);
|
|
|
|
}
|
|
//debug($temp);
|
|
}
|
|
}
|
|
|
|
// pear 패키지가 기본만 설치되어 있어 더 필요한 부분을 사용할때 이용하기 위한 부분이다.
|
|
ini_set ("include_path",dirname(__file__)."/PEAR/".PATH_SEPARATOR.dirname(__file__)."/lib/".PATH_SEPARATOR.ini_get("include_path"));
|
|
|
|
// 0 이면 디버그 메세지 출력 안함, 1일경우 디버깅 메세지 출력
|
|
$_DEBUG = 1;
|
|
|
|
require_once "DB.php";
|
|
|
|
### DB connect
|
|
$res = $_DB = DB::connect(_DSN);
|
|
if(DB::isError($res)){die($res->getMessage());}
|
|
|
|
$res = $_DB->query(" SET NAMES 'utf8' COLLATE 'utf8_general_ci' ");
|
|
if (DB::isError($res)) die($res->getMessage());
|
|
|
|
$res = $_DB->query(" SET CHARACTER SET utf8 ");
|
|
if (DB::isError($res)) die($res->getMessage());
|
|
|
|
$res = $_DB->query(" set character_set_server = 'utf8' ");
|
|
if (DB::isError($res)) die($res->getMessage());
|
|
|
|
$res = $_DB->query(" set character_set_client = 'utf8' ");
|
|
if (DB::isError($res)) die($res->getMessage());
|
|
|
|
$res = $_DB->query(" set character_set_results = 'utf8' ");
|
|
if (DB::isError($res)) die($res->getMessage());
|
|
|
|
$res = $_DB->query(" set character_set_connection = 'utf8' ");
|
|
if (DB::isError($res)) die($res->getMessage());
|
|
|
|
|
|
// 기본 Object 선언
|
|
$obj_User = new User($_DB); // 회원 class
|
|
$Obj_board = new Board($_DB); // 게시판 class
|
|
$Obj_contact = new Contact($_DB); // 문의 class
|
|
$Obj_popup = new Popup($_DB); // 팝업 class
|
|
$Obj_banner = new Banner($_DB);// 배너관리 class
|
|
$Obj_history = new History($_DB); // 회사연혁 class
|
|
|
|
// 설정 Object 선언
|
|
|
|
$user_info = $obj_User->get_status();
|
|
|
|
$query = "
|
|
select
|
|
*
|
|
from
|
|
basic
|
|
";
|
|
$res = $_basic = $_DB->getRow($query,DB_FETCHMODE_ASSOC);
|
|
if (DB::isError($res)) {
|
|
go_url("","서버 오류입니다.\\n[".$res->getMessage()."]");
|
|
exit;
|
|
}
|
|
|
|
define("_TITLE", $_basic['b_title']); # 타이틀바
|
|
define("_TITLE_EN", $_basic['b_title_en']); # 타이틀바
|
|
define("_DOCTYPE", $_basic['b_doctype']); # DOCTYPE
|
|
define("_CHARSET", $_basic['b_charset']); # charset
|
|
define("_MASTER_NAME", $_basic['b_title']); # 메일 발송자
|
|
define("_MASTER_EMAIL", $_basic['b_email']); # 대표이메일
|
|
define("_MASTER_EMAIL_BUSINESS", $_basic['b_email_business']); # 사업제휴
|
|
define("_MASTER_EMAIL_PRODUCT", $_basic['b_email_product']); # 제품문의
|
|
define("_MASTER_COMPANY", $_basic['b_company']); # 회사명
|
|
define("_MASTER_EMAIL_BRANCH", $_basic['b_email_branch']); # 지사 대표이메일
|
|
define("_MASTER_TEL", $_basic['b_tel']); # 대표 연락처
|
|
define("_MASTER_TEL_EN", $_basic['b_tel_en']); # 대표 연락처
|
|
define("_MASTER_TEL_BRANCH", $_basic['b_tel_branch']); # 지사 대표 연락처
|
|
define("_MASTER_TEL_BRANCH_EN", $_basic['b_tel_branch_en']); # 지사 대표 연락처
|
|
define("_MASTER_FAX", $_basic['b_fax']); # 대표 fax
|
|
define("_MASTER_FAX_EN", $_basic['b_fax_en']); # 대표 fax
|
|
define("_MASTER_FAX_BRANCH", $_basic['b_fax_branch']); # 지사 대표 fax
|
|
define("_MASTER_FAX_BRANCH_EN", $_basic['b_fax_branch_en']); # 지사 대표 fax
|
|
define("_MASTER_ADDR", $_basic['b_addr']); # 주소
|
|
define("_MASTER_ADDR_EN", $_basic['b_addr_en']); # 주소
|
|
define("_MASTER_ADDR_BRANCH", $_basic['b_addr_branch']); # 지사 주소
|
|
define("_MASTER_ADDR_BRANCH_EN", $_basic['b_addr_branch_en']); # 지사 주소
|
|
define("_MASTER_CRN", $_basic['b_crn']); # 사업자등록번호
|
|
define("_MASTER_PRESIDENT", $_basic['b_president']); # 대표이사
|
|
define("_MASTER_PRESIDENT_EN", $_basic['b_president_en']); # 대표이사
|
|
define("_DESCRIPTION", $_basic['b_description']); # DESCRIPTION
|
|
define("_DESCRIPTION_EN", $_basic['b_description_en']); # DESCRIPTION
|
|
|
|
# 문자왕국 설정값
|
|
$_SMS_ID = $_basic['b_sms_id'];
|
|
$_SMS_PW = $_basic['b_sms_pw'];
|
|
$_SMS_SENDER = $_basic['b_sms_sender'];
|
|
$_SMS_RECEIVERS = $_basic['b_sms_receivers'];
|
|
define("_SMS_ID", $_SMS_ID);
|
|
define("_SMS_PW", $_SMS_PW);
|
|
define("_SMS_SENDER", $_SMS_SENDER);
|
|
define("_SMS_RECEIVERS", $_SMS_RECEIVERS);
|
|
|
|
# SMTP 계정
|
|
$_b_smtp_host = explode("@",$_basic['b_smtp_id']);
|
|
$_SMTP_MAIL_HOST = "smtp.".$_b_smtp_host[1];
|
|
$_SMTP_MAIL_ID = $_basic['b_smtp_id'];
|
|
$_SMTP_MAIL_PW = $_basic['b_smtp_pwd'];
|
|
define("_SMTP_MAIL_HOST", $_SMTP_MAIL_HOST);
|
|
define("_SMTP_MAIL_ID", $_SMTP_MAIL_ID);
|
|
define("_SMTP_MAIL_PW", $_SMTP_MAIL_PW);
|
|
|
|
# 구글 리캡차
|
|
$_Site_Key = $_basic['google_Site_Key'];
|
|
$_Secret_Key = $_basic['google_Secret_Key'];
|
|
define("_SITE_KEY", $_Site_Key);
|
|
define("_SECRET_KEY", $_Secret_Key);
|
|
|
|
|
|
// 모든 변수 담기
|
|
if (isset ($_GET) && get_magic_quotes_gpc ()) array_walk ($_GET, "StripAllSlashes");
|
|
if (isset ($_POST) && get_magic_quotes_gpc ()) array_walk ($_POST, "StripAllSlashes");
|
|
$argu = array_merge($_GET, $_POST);
|
|
array_walk($argu, "trimvalues");
|
|
|
|
//모바일 체크
|
|
$chk_m = rtn_mobile_chk();
|
|
|
|
// LANGAUAGE
|
|
header('P3P: CP="NOI CURa ADMa DEVa TAIa OUR DELa BUS IND PHY ONL UNI COM NAV INT DEM PRE"');
|
|
|
|
header('Cache-control: private'); // IE 6 FIX
|
|
|
|
if(isSet($_GET['lang']))
|
|
{
|
|
$language = $_GET['lang'];
|
|
|
|
// register the session and set the cookie
|
|
$_COOKIE['lang'] = $language;
|
|
|
|
setcookie("lang", $language, time() + (3600 * 24 * 30));
|
|
}
|
|
else if(isSet($_COOKIE['lang']))
|
|
{
|
|
$language = $_COOKIE['lang'];
|
|
}
|
|
else if(isSet($_COOKIE['lang']))
|
|
{
|
|
$language = $_COOKIE['lang'];
|
|
}
|
|
else
|
|
{
|
|
$language = 'ko';
|
|
}
|
|
|
|
|
|
switch ($language) {
|
|
case 'ko':
|
|
$language_file = 'lang.ko.php';
|
|
$_DESCRIPTION = _DESCRIPTION;
|
|
$_MASTER_TEL = _MASTER_TEL;
|
|
$_MASTER_FAX = _MASTER_FAX;
|
|
$_MASTER_ADDR = _MASTER_ADDR;
|
|
break;
|
|
|
|
case 'en':
|
|
$language_file = 'lang.en.php';
|
|
$_DESCRIPTION = _DESCRIPTION_EN;
|
|
$_MASTER_TEL = _MASTER_TEL_EN;
|
|
$_MASTER_FAX = _MASTER_FAX_EN;
|
|
$_MASTER_ADDR = _MASTER_ADDR_EN;
|
|
break;
|
|
|
|
default:
|
|
$language_file = 'lang.ko.php';
|
|
$_DESCRIPTION = _DESCRIPTION;
|
|
$_MASTER_TEL = _MASTER_TEL;
|
|
$_MASTER_FAX = _MASTER_FAX;
|
|
$_MASTER_ADDR = _MASTER_ADDR;
|
|
}
|
|
|
|
$_lang_check = ($language != "ko") ? "_".$language : "";
|
|
|
|
include_once $_SERVER['DOCUMENT_ROOT'].'/language/'.$language_file;
|
|
?>
|