'HTTPS', 'HTTP_X_SSL' => 'ON', 'HTTPS' => 'ON', 'SSL' => 'ON' ); $protocol = 'https://'; foreach($https as $q=>$w) { if(strtoupper($_SERVER[$q]) === $w) { $protocol = false; break; } } if($ssl === true) { $protocol = (false === $protocol) ? 'http://' : false; } if(false !== $protocol) { header('HTTP/1.0 301 Moved Permanently'); header('Location: ' . $protocol . $_SERVER['HTTP_HOST'] . "" . $_SERVER['REQUEST_URI']); die(); } } // http 사용자를 https 로 redirect 처리 예제 //https_redirect(); $_SESSION['REFERER'] = $_SERVER['QUERY_STRING']; $loginID = clean_char($_SESSION['loginID'],''); $hsKey = clean_char($_SESSION['loginIDhsKey'],''); $hscheck = HS_Encode($loginID); if( $hscheck != $hsKey && $hsKey != ''){ foreach($_SESSION as $key => $value){ $_SESSION[$key] = ''; } header('Location: index.html?pg_idx='.DB::queryFirstField("SELECT idx FROM DSoft_SubMenu WHERE mn_link='member/login'").'&code=needLogin&referer='.array_pop(explode("pg_idx=", $_SESSION['REFERER']))); exit; } $userinfo = getUserinfo(); $pg_idx = $_GET['pg_idx']; $pg_idx = $pg_idx ? intval($pg_idx) : 0; if(!$pg_idx){ $inc = 'index'; $mod = 'home'; }else{ $document = DB::queryFirstRow("SELECT * FROM DSoft_SubMenu WHERE idx=%i", $pg_idx); $dtype = $document['mn_bbs']; $dlvl = $document['mn_lvl']; if($dlvl > 0){ #로그인이 필요한 문서 if($userinfo['isLogin']){ if($userinfo['userlvl'] >= $dlvl || $userinfo['useradmin'] == 'Y'){ }else{ $err_msg = "권한이 부족하여 이용이 불가능 합니다."; } }else{ header('Location: index.html?pg_idx='.DB::queryFirstField("SELECT idx FROM DSoft_SubMenu WHERE mn_link='member/login'").'&code=needLogin&referer='.array_pop(explode("pg_idx=", $_SESSION['REFERER']))); exit; } } switch($dtype){ case "C" : $document_tab = DB::query("SELECT * FROM DSoft_SubMenu WHERE mn_tab=%i ORDER BY mn_sqnc", $document['idx']); $mod = 'inc/tpl'; if(!$document_tab){ $inc = 'tpl'; }else{ $inc = 'tpl_tab'; } $body_contetns = $document['mn_memo']; $subpage = 1; break; case "CP" : $mod = 'inc/tpl'; $inc = 'tpl_full'; $body_contetns = $document['mn_memo']; $subpage = 0; break; case "B" : $mod = 'board'; $inc = 'index'; $bidx = $document['mn_link']; $subpage = 1; break; case "M" : $mod = $document['mn_link']; $inc = 'index'; $subpage = 1; break; case "L" : header('Location: '.$document['mn_link']); break; default : $mod = 'error'; $inc = '404.php'; } write_log($document); } $inc_file = dirname(__FILE__) . "/module/" . $mod."/". $inc .".php"; include "./module/inc/top_header.php"; include "./module/inc/menu.php"; if( file_exists( $inc_file ) ){ if($subpage){ include "./module/inc/top_body.php"; } if($err_msg){ include "./module/error/err.php"; }else{ require_once($inc_file); } if($subpage){ include "./module/inc/foot_body.php"; } } else { require_once(dirname(__FILE__) ."/module/error/500.php"); } include "./module/inc/footer.php"; connection_log(); ?>