"; echo $_SERVER['PHP_SELF'].'//'.preg_match("/install/i",$_SERVER['PHP_SELF']); exit; } // MySQL 데이타 베이스에 접근 function dbconn($table = "") { global $connect, $HTTP_COOKIE_VARS; $f = @file("d_setting/set.php") or Error("set.php파일이 없습니다. DB설정을 먼저 하십시요!"); for($i=1; $i<= 4; $i++) $f[$i] = trim(str_replace("\n","",$f[$i])); if(!$connect) $connect = @MYDB_connect($f[1],$f[2],$f[3]) or Error("DB 접속시 에러가 발생했습니다"); if($table != "") { $f[4] = $table; } @MYDB_select_db($f[4], $connect) or Error("DB Select 에러가 발생했습니다",""); return $connect; } // 에러 메세지 출력 function Error($message, $url="") { global $setup, $connect, $dir, $config_dir; include "error.php"; if($connect) @MYDB_close($connect); exit; } // 게시판의 생성유무 검사 function isTable($connect, $str, $dbname='') { if(!$dbname) { $f=@file("d_setting/set.php") or Error("set.php파일이 없습니다. DB설정을 먼저 하십시요"); for($i=1;$i<=4;$i++) $f[$i]=str_replace("\n","",$f[$i]); $dbname=$f[4]; } $result = MYDB_list_tables($dbname, $connect) or Error(__LINE__." : list_table error : ".MYDB_error($connect),""); $cnt = MYDB_num_rows($result); for($i=0; $i < $cnt; $i++) { $tablename = MYDB_fetch_row($result); if($str == $tablename[0]) return 1; } return 0; } // 빈문자열 경우 1을 리턴 function isblank($str) { $temp=str_replace(" ","",$str); $temp=str_replace("\n","",$temp); $temp=strip_tags($temp); $temp=str_replace(" ","",$temp); $temp=str_replace(" ","",$temp); if(preg_match("/[^[:space:]]/i",$temp)) return 0; return 1; } function Debug($str) { echo ""; } function MessageBox($str) { echo ""; } function getmicrotime() { $microtimestmp = explode(' ', microtime()); return $microtimestmp[0] + $microtimestmp[1]; } function PrintElapsedTime() { global $_startTime; $_endTime = round(getMicroTime() - $_startTime, 3); echo "
경과시간 : {$_endTime}초
"; } function requireUserLevel($connect, $reqLevel=5){ if(isset($_SESSION['ownUserLevel']) && $_SESSION['ownUserLevel']>=$reqLevel){ return; } $p_id = isset($_SESSION['p_id'])?$_SESSION['p_id']:null; if(!$p_id){ $query = "select count(*) as cnt from general where userlevel < $reqLevel limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $cnt = MYDB_fetch_array($result); if($cnt['cnt'] == 0){ //아직 제대로된 계정이 생성되지 않았다면 넘어간다. //서버 리셋시 ~ 첫 유저 계정 생성시까지 취약점이 되지만, 구조상 어쩔 수 없다. return; } echo " 로그인 되지 않음 각 서버에 로그인이 되지 않아 유저 정보를 확인할 수 없습니다. 서버 접속을 수행해주세요.
"; exit(); } $query = "select userlevel from general where user_id='$p_id'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); if($me['userlevel'] < $reqLevel) { echo " 권한 부족 충분한 권한이 없습니다.
"; exit(); } $_SESSION['ownUserLevel'] = $reqLevel; } ?>