소스 파일 : /base_utils/top_section.php (2021-08-03)     소스 설명 : (공통) 페이지 상단 1줄짜리 제목줄   (Run)
001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
<?php // (2022.8.28, 차재복, 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'>";

    echo "<div id='top_left'>";
    	// 사이트명 (홈페이지)
	    echo "[<a href='/test/index.php' style='text-decoration:none;'>정보통신기술용어해설</a>]";
    	echo " &nbsp;&nbsp; " . "\n";

        // 현재 페이지 타이틀명 : $title
		if (basename($_SERVER['SCRIPT_NAME'])=='top_section.php') $title = '(상단 타이틀 섹션)';
	    echo "<h1 style='display:inline; font-weight:bold;font-size:14px;'>{$title}</h1>";
	    echo " &nbsp;&nbsp; " . "\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 "&nbsp; <a href='../login/editor_logout.php?dir={$temp_dir}&file={$temp_file}' title='Logout'>x</a> ";
		    	}
        	echo ")" . "\n";
        }

/*
        // 로그인 테스트 (테스트 편집자 로그인 위주)
    	$script_name = basename($_SERVER['SCRIPT_NAME']);
	    if (!empty($test_home) and $script_name == 'yoyak.php') { 
		    echo " &nbsp;&nbsp; ";
    		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;
*/

    echo "</div>" ."\n";

	// 일반 검색 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 (isset($_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";

?>


Copyrightⓒ written by 차재복 (Cha Jae Bok)               기술용어해설 후원
"본 웹사이트 내 모든 저작물은 원출처를 밝히는 한 자유롭게 사용(상업화포함) 가능합니다"