<?php // (2024.12.15, 차재복, Cha Jae Bok, http://www.ktword.co.kr)
# 상단 제목줄 (top section)
# 전달 변수 처리 : $title (타이틀명), $test_home
if (empty($test_home)) $test_home = "../";
# top_section style
echo "<style>
div#top_section { overflow:hidden; height:25px; margin:0; padding:0; border:0; }
#top_left { display:inline-block; line-height:25px; margin:0; padding:0; }
#top_right { display:inline-block; float:right; margin:0; padding:0; }
#top_section, #top_section a, #top_section h1, #top_section button { font-size:13px; }
</style>" . "\n";
// top_section div 시작
echo "<div id='top_section' style='display:flex;justify-content:space-between;'>";
echo "<div id='top_left'>";
// 사이트명 (홈페이지)
echo "[<a href='/test/index.php' style='text-decoration:none;'>정보통신기술용어해설</a>]";
echo " " . "\n";
echo "</div>";
echo "<div>";
// 현재 페이지 타이틀명 : $title (매개변수)
if (basename($_SERVER['SCRIPT_NAME'])=='top_section.php') $title = '(상단 타이틀 섹션)';
echo "<h1 style='display:inline; font-weight:bold;font-size:14px;'>{$title}</h1>";
echo " " . "\n";
// 현재의 사용 db, 사용자명 출력
if($_SESSION['user_type']=='종합관리자') {
echo "(";
$cur_db = ( empty($_SESSION['db_name']) ? '미확인' : $_SESSION['db_name'] );
$cur_user = ( empty($_SESSION['user_type']) ? '미확인' : $_SESSION['user_type'] );
echo "사용db : {$cur_db}, ";
echo "사용자 : {$cur_user}";
if ($cur_user == '종합관리자') {
$fullpath = $_SERVER['SCRIPT_NAME'];
$list = explode('/',$fullpath);
$temp_file = end($list);
$temp_dir = $list[count($list)-2];
echo " <a href='../login/editor_logout.php?dir={$temp_dir}&file={$temp_file}' title='Logout'>x</a> ";
}
echo ")" . "\n";
}
echo "</div>" ."\n";
/*
// 로그인 테스트 (테스트 편집자 로그인 위주)
$script_name = basename($_SERVER['SCRIPT_NAME']);
if (!empty($test_home) and $script_name == 'yoyak.php') {
echo " ";
if ( empty($_SESSION['user_name']) ) {
echo "<a href='{$test_home}/login/editor_login.php?file=yoyak'>편집자 로그인</a>";
} else {
echo "<a href='{$test_home}/login/editor_logout.php?file=yoyak'>로그아웃</a>";
}
}
echo PHP_EOL;
*/
// 일반 검색 form
echo "<form action='{$test_home}/search/srch.php' method='post' name='srch_form' id='top_right'>";
echo "<input type='text' name='m_search' size=12>";
// echo "<button type='submit'>검색</button>";
// (편집자)
if ($_SESSION['user_type']=='종합관리자') {
echo "<input type='submit' value='검색'>";
echo "<input type='submit' value='새창' formaction='{$test_home}/search/srch.php' formtarget='_blank'>";
// (일반 사용자)
} else {
echo "<button type='submit'>검색</button>";
}
echo "<input type='hidden' name='opt' value='search'>";
echo "<input type='hidden' name='m_text'>";
echo "</form>" ."\n";
// div 끝
echo "</div>" ."\n";
?>