사용자단 따옴표 수정

This commit is contained in:
chicpro
2012-11-05 17:04:19 +09:00
parent 1288772680
commit 4c7eb0290b
24 changed files with 444 additions and 445 deletions

View File

@ -1,4 +1,4 @@
<?
$g4_path = "."; // common.php 의 상대 경로
include_once("$g4_path/common.php");
$g4_path = '.'; // common.php 의 상대 경로
include_once($g4_path.'/common.php');
?>

View File

@ -1,4 +1,4 @@
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
include_once("$g4[path]/head.php");
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
include_once($g4['path'].'/head.php');
?>

View File

@ -1,4 +1,4 @@
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
include_once("$g4[path]/tail.php");
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
include_once($g4['path'].'/tail.php');
?>

View File

@ -216,25 +216,25 @@ $g4 = array();
// php 인젝션 ( 임의로 변수조작으로 인한 리모트공격) 취약점에 대비한 코드
// prosper 님께서 알려주셨습니다.
if (!$g4_path || preg_match("/:\/\//", $g4_path))
die("<meta http-equiv='content-type' content='text/html; charset=$g4[charset]'><script type='text/javascript'> alert('잘못된 방법으로 변수가 정의되었습니다.'); </script>");
die("<meta http-equiv='content-type' content='text/html; charset={$g4['charset']}'><script type='text/javascript'> alert('잘못된 방법으로 변수가 정의되었습니다.'); </script>");
//if (!$g4_path) $g4_path = ".";
$g4['path'] = $g4_path;
// 경로의 오류를 없애기 위해 $g4_path 변수는 해제
unset($g4_path);
include_once("$g4[path]/lib/constant.php"); // 상수 정의
include_once("$g4[path]/config.php"); // 설정 파일
include_once("$g4[path]/lib/common.lib.php"); // 공통 라이브러리
include_once($g4['path'].'/lib/constant.php'); // 상수 정의
include_once($g4['path'].'/config.php'); // 설정 파일
include_once($g4['path'].'/lib/common.lib.php'); // 공통 라이브러리
// config.php 가 있는곳의 웹경로
if (!$g4['url'])
{
$g4['url'] = 'http://' . $_SERVER['HTTP_HOST'];
$dir = dirname($_SERVER["PHP_SELF"]);
if (!file_exists("config.php"))
$dir = dirname($_SERVER['PHP_SELF']);
if (!file_exists('config.php'))
$dir = dirname($dir);
$cnt = substr_count($g4['path'], "..");
$cnt = substr_count($g4['path'], '..');
for ($i=2; $i<=$cnt; $i++)
$dir = dirname($dir);
$g4['url'] .= $dir;
@ -248,20 +248,20 @@ $g4['url'] = preg_replace("/\/$/", "", $g4['url']);
// 공통
//==============================================================================
$dirname = dirname(__FILE__).'/';
$dbconfig_file = "data/dbconfig.php";
if (file_exists("$g4[path]/$dbconfig_file"))
$dbconfig_file = 'data/dbconfig.php';
if (file_exists($g4['path'].'/'.$dbconfig_file))
{
//if (is_dir("$g4[path]/install")) die("<meta http-equiv='content-type' content='text/html; charset=$g4[charset]'><script type='text/javascript'> alert('install 디렉토리를 삭제하여야 정상 실행됩니다.'); </script>");
include_once("$g4[path]/$dbconfig_file");
include_once($g4['path'].'/'.$dbconfig_file);
$connect_db = sql_connect($mysql_host, $mysql_user, $mysql_password);
$select_db = sql_select_db($mysql_db, $connect_db);
if (!$select_db)
die("<meta http-equiv='content-type' content='text/html; charset=$g4[charset]'><script type='text/javascript'> alert('DB 접속 오류'); </script>");
die("<meta http-equiv='content-type' content='text/html; charset={$g4['charset']}'><script type='text/javascript'> alert('DB 접속 오류'); </script>");
}
else
{
echo "<meta http-equiv='content-type' content='text/html; charset=$g4[charset]'>";
echo "<meta http-equiv='content-type' content='text/html; charset={$g4['charset']}'>";
echo <<<HEREDOC
<script type="text/javascript">
alert("DB 설정 파일이 존재하지 않습니다.\\n\\n프로그램 설치 후 실행하시기 바랍니다.");
@ -280,7 +280,7 @@ unset($my); // DB 설정값을 클리어 해줍니다.
ini_set("session.use_trans_sid", 0); // PHPSESSID를 자동으로 넘기지 않음
ini_set("url_rewriter.tags",""); // 링크에 PHPSESSID가 따라다니는것을 무력화함 (해뜰녘님께서 알려주셨습니다.)
session_save_path("{$g4['path']}/data/session");
session_save_path($g4['path'].'/data/session');
if (isset($SESSION_CACHE_LIMITER))
@session_cache_limiter($SESSION_CACHE_LIMITER);
@ -292,7 +292,7 @@ else
//==============================================================================
// 기본환경설정
// 기본적으로 사용하는 필드만 얻은 후 상황에 따라 필드를 추가로 얻음
$config = sql_fetch(" select * from $g4[config_table] ");
$config = sql_fetch(" select * from {$g4['config_table']} ");
ini_set("session.cache_expire", 180); // 세션 캐쉬 보관시간 (분)
ini_set("session.gc_maxlifetime", 10800); // session data의 garbage collection 존재 기간을 지정 (초)
@ -312,53 +312,53 @@ if (strpos($_SERVER[PHP_SELF], $g4['admin']) === false)
// 4.00.03 : [보안관련] PHPSESSID 가 틀리면 로그아웃한다.
if ($_REQUEST['PHPSESSID'] && $_REQUEST['PHPSESSID'] != session_id())
goto_url("{$g4['bbs_path']}/logout.php");
goto_url($g4['bbs_path'].'/logout.php');
// QUERY_STRING
$qstr = "";
$qstr = '';
/*
if (isset($bo_table)) $qstr .= 'bo_table=' . urlencode($bo_table);
if (isset($wr_id)) $qstr .= '&wr_id=' . urlencode($wr_id);
*/
if (isset($sca)) {
$sca = mysql_real_escape_string($sca);
$qstr .= '&sca=' . urlencode($sca);
$qstr .= '&amp;sca=' . urlencode($sca);
}
if (isset($sfl)) {
$sfl = mysql_real_escape_string($sfl);
//$sfl = preg_replace("/[^\w\,\|]+/", "", $sfl);
$qstr .= '&sfl=' . urlencode($sfl); // search field (검색 필드)
$qstr .= '&amp;sfl=' . urlencode($sfl); // search field (검색 필드)
}
if (isset($stx)) { // search text (검색어)
$stx = mysql_real_escape_string($stx);
$qstr .= '&stx=' . urlencode($stx);
$qstr .= '&amp;stx=' . urlencode($stx);
}
if (isset($sst)) {
$sst = mysql_real_escape_string($sst);
$qstr .= '&sst=' . urlencode($sst); // search sort (검색 정렬 필드)
$qstr .= '&amp;sst=' . urlencode($sst); // search sort (검색 정렬 필드)
}
if (isset($sod)) { // search order (검색 오름, 내림차순)
$sod = preg_match("/^(asc|desc)$/i", $sod) ? $sod : "";
$qstr .= '&sod=' . urlencode($sod);
$sod = preg_match("/^(asc|desc)$/i", $sod) ? $sod : '';
$qstr .= '&amp;sod=' . urlencode($sod);
}
if (isset($sop)) { // search operator (검색 or, and 오퍼레이터)
$sop = preg_match("/^(or|and)$/i", $sop) ? $sop : "";
$qstr .= '&sop=' . urlencode($sop);
$sop = preg_match("/^(or|and)$/i", $sop) ? $sop : '';
$qstr .= '&amp;sop=' . urlencode($sop);
}
if (isset($spt)) { // search part (검색 파트[구간])
$spt = (int)$spt;
$qstr .= '&spt=' . urlencode($spt);
$qstr .= '&amp;spt=' . urlencode($spt);
}
if (isset($page)) { // 리스트 페이지
$page = (int)$page;
$qstr .= '&page=' . urlencode($page);
$qstr .= '&amp;page=' . urlencode($page);
}
if ($wr_id) {
@ -366,7 +366,7 @@ if ($wr_id) {
}
if ($bo_table) {
$bo_table = preg_match("/^[a-zA-Z0-9_]+$/", $bo_table) ? $bo_table : "";
$bo_table = preg_match("/^[a-zA-Z0-9_]+$/", $bo_table) ? $bo_table : '';
}
// URL ENCODING
@ -376,7 +376,7 @@ if (isset($url)) {
else {
// 2008.01.25 Cross Site Scripting 때문에 수정
//$urlencode = $_SERVER['REQUEST_URI'];
$urlencode = urlencode($_SERVER[REQUEST_URI]);
$urlencode = urlencode($_SERVER['REQUEST_URI']);
}
//===================================
@ -402,7 +402,7 @@ else
{
// 자동로그인 ---------------------------------------
// 회원아이디가 쿠키에 저장되어 있다면 (3.27)
if ($tmp_mb_id = get_cookie("ck_mb_id"))
if ($tmp_mb_id = get_cookie('ck_mb_id'))
{
$tmp_mb_id = substr(preg_replace("/[^a-zA-Z0-9_]*/", "", $tmp_mb_id), 0, 20);
// 최고관리자는 자동로그인 금지
@ -412,16 +412,16 @@ else
$row = sql_fetch($sql);
$key = md5($_SERVER['SERVER_ADDR'] . $_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT'] . $row['mb_password']);
// 쿠키에 저장된 키와 같다면
$tmp_key = get_cookie("ck_auto");
$tmp_key = get_cookie('ck_auto');
if ($tmp_key == $key && $tmp_key)
{
// 차단, 탈퇴가 아니고 메일인증이 사용이면서 인증을 받았다면
if ($row['mb_intercept_date'] == "" &&
$row['mb_leave_date'] == "" &&
if ($row['mb_intercept_date'] == '' &&
$row['mb_leave_date'] == '' &&
(!$config['cf_use_email_certify'] || preg_match('/[1-9]/', $row['mb_email_certify'])) )
{
// 세션에 회원아이디를 저장하여 로그인으로 간주
set_session("ss_mb_id", $tmp_mb_id);
set_session('ss_mb_id', $tmp_mb_id);
// 페이지를 재실행
echo "<script type='text/javascript'> window.location.reload(); </script>";
@ -437,8 +437,8 @@ else
// 첫방문 쿠키
// 1년간 저장
if (!get_cookie("ck_first_call")) set_cookie("ck_first_call", $g4[server_time], 86400 * 365);
if (!get_cookie("ck_first_referer")) set_cookie("ck_first_referer", $_SERVER[HTTP_REFERER], 86400 * 365);
if (!get_cookie('ck_first_call')) set_cookie('ck_first_call', $g4['server_time'], 86400 * 365);
if (!get_cookie('ck_first_referer')) set_cookie('ck_first_referer', $_SERVER['HTTP_REFERER'], 86400 * 365);
// 회원이 아니라면 권한을 방문객 권한으로 함
if (!($member['mb_id']))
@ -448,7 +448,7 @@ else
//$member['mb_level_title'] = $g4['member_level'][$member['mb_level']]; // 권한명
$write_table = "";
$write_table = '';
if (isset($bo_table)) {
$board = sql_fetch(" select * from {$g4['board_table']} where bo_table = '$bo_table' ");
if ($board['bo_table']) {
@ -473,7 +473,7 @@ else
$is_admin = is_admin($member['mb_id']);
if ($is_admin != "super") {
if ($is_admin != 'super') {
// 접근가능 IP
$cf_possible_ip = trim($config['cf_possible_ip']);
if ($cf_possible_ip) {
@ -514,17 +514,17 @@ if ($is_admin != "super") {
// 스킨경로
$board_skin_path = '';
if (isset($board['bo_skin']))
$board_skin_path = "{$g4['path']}/skin/board/{$board['bo_skin']}"; // 게시판 스킨 경로
$board_skin_path = $g4['path'].'/skin/board/'.$board['bo_skin']; // 게시판 스킨 경로
// 방문자수의 접속을 남김
include_once("{$g4['bbs_path']}/visit_insert.inc.php");
include_once($g4['bbs_path'].'/visit_insert.inc.php');
// common.php 파일을 수정할 필요가 없도록 확장합니다.
$tmp = dir("$g4[path]/extend");
$tmp = dir($g4['path'].'/extend');
while ($entry = $tmp->read()) {
// php 파일만 include 함
if (preg_match("/(\.php)$/i", $entry))
include_once("$g4[path]/extend/$entry");
include_once($g4['path'].'/extend/'.$entry);
}
?>

View File

@ -6,24 +6,24 @@ if (function_exists("date_default_timezone_set"))
date_default_timezone_set("Asia/Seoul");
// 디렉토리
$g4['bbs'] = "bbs";
$g4['bbs_path'] = $g4['path'] . "/" . $g4['bbs'];
$g4['bbs_img'] = "img";
$g4['bbs_img_path'] = $g4['path'] . "/" . $g4['bbs'] . "/" . $g4['bbs_img'];
$g4['bbs'] = 'bbs';
$g4['bbs_path'] = $g4['path'] . '/' . $g4['bbs'];
$g4['bbs_img'] = 'img';
$g4['bbs_img_path'] = $g4['path'] . '/' . $g4['bbs'] . '/' . $g4['bbs_img'];
$g4['admin'] = "adm";
$g4['admin_path'] = $g4['path'] . "/" . $g4['admin'];
$g4['admin'] = 'adm';
$g4['admin_path'] = $g4['path'] . '/' . $g4['admin'];
$g4['editor'] = "cheditor";
$g4['editor_path'] = $g4['path'] . "/" . $g4['editor'];
$g4['editor'] = 'cheditor';
$g4['editor_path'] = $g4['path'] . '/' . $g4['editor'];
$g4['cheditor4'] = "cheditor4";
$g4['cheditor4_path'] = $g4['path'] . "/" . $g4['cheditor4'];
$g4['cheditor4'] = 'cheditor4';
$g4['cheditor4_path'] = $g4['path'] . '/' . $g4['cheditor4'];
$g4['is_cheditor5'] = true;
$g4['geditor'] = "geditor";
$g4['geditor_path'] = $g4['path'] . "/" . $g4['geditor'];
$g4['geditor'] = 'geditor';
$g4['geditor_path'] = $g4['path'] . '/' . $g4['geditor'];
// 자주 사용하는 값
// 서버의 시간과 실제 사용하는 시간이 틀린 경우 수정하세요.
@ -39,29 +39,29 @@ $g4['time_ymdhis'] = date("Y-m-d H:i:s", $g4['server_time']);
// 테이블 명
// (상수로 선언한것은 함수에서 global 선언을 하지 않아도 바로 사용할 수 있기 때문)
//
$g4['table_prefix'] = "g4_"; // 테이블명 접두사
$g4['write_prefix'] = $g4['table_prefix'] . "write_"; // 게시판 테이블명 접두사
$g4['table_prefix'] = 'g4_'; // 테이블명 접두사
$g4['write_prefix'] = $g4['table_prefix'] . 'write_'; // 게시판 테이블명 접두사
$g4['auth_table'] = $g4['table_prefix'] . "auth"; // 관리권한 설정 테이블
$g4['config_table'] = $g4['table_prefix'] . "config"; // 기본환경 설정 테이블
$g4['group_table'] = $g4['table_prefix'] . "group"; // 게시판 그룹 테이블
$g4['group_member_table'] = $g4['table_prefix'] . "group_member"; // 게시판 그룹+회원 테이블
$g4['board_table'] = $g4['table_prefix'] . "board"; // 게시판 설정 테이블
$g4['board_file_table'] = $g4['table_prefix'] . "board_file"; // 게시판 첨부파일 테이블
$g4['board_good_table'] = $g4['table_prefix'] . "board_good"; // 게시물 추천,비추천 테이블
$g4['board_new_table'] = $g4['table_prefix'] . "board_new"; // 게시판 새글 테이블
$g4['login_table'] = $g4['table_prefix'] . "login"; // 로그인 테이블 (접속자수)
$g4['mail_table'] = $g4['table_prefix'] . "mail"; // 회원메일 테이블
$g4['member_table'] = $g4['table_prefix'] . "member"; // 회원 테이블
$g4['memo_table'] = $g4['table_prefix'] . "memo"; // 메모 테이블
$g4['poll_table'] = $g4['table_prefix'] . "poll"; // 투표 테이블
$g4['poll_etc_table'] = $g4['table_prefix'] . "poll_etc"; // 투표 기타의견 테이블
$g4['point_table'] = $g4['table_prefix'] . "point"; // 포인트 테이블
$g4['popular_table'] = $g4['table_prefix'] . "popular"; // 인기검색어 테이블
$g4['scrap_table'] = $g4['table_prefix'] . "scrap"; // 게시글 스크랩 테이블
$g4['visit_table'] = $g4['table_prefix'] . "visit"; // 방문자 테이블
$g4['visit_sum_table'] = $g4['table_prefix'] . "visit_sum"; // 방문자 합계 테이블
$g4['token_table'] = $g4['table_prefix'] . "token"; // 토큰 테이블
$g4['auth_table'] = $g4['table_prefix'] . 'auth'; // 관리권한 설정 테이블
$g4['config_table'] = $g4['table_prefix'] . 'config'; // 기본환경 설정 테이블
$g4['group_table'] = $g4['table_prefix'] . 'group'; // 게시판 그룹 테이블
$g4['group_member_table'] = $g4['table_prefix'] . 'group_member'; // 게시판 그룹+회원 테이블
$g4['board_table'] = $g4['table_prefix'] . 'board'; // 게시판 설정 테이블
$g4['board_file_table'] = $g4['table_prefix'] . 'board_file'; // 게시판 첨부파일 테이블
$g4['board_good_table'] = $g4['table_prefix'] . 'board_good'; // 게시물 추천,비추천 테이블
$g4['board_new_table'] = $g4['table_prefix'] . 'board_new'; // 게시판 새글 테이블
$g4['login_table'] = $g4['table_prefix'] . 'login'; // 로그인 테이블 (접속자수)
$g4['mail_table'] = $g4['table_prefix'] . 'mail'; // 회원메일 테이블
$g4['member_table'] = $g4['table_prefix'] . 'member'; // 회원 테이블
$g4['memo_table'] = $g4['table_prefix'] . 'memo'; // 메모 테이블
$g4['poll_table'] = $g4['table_prefix'] . 'poll'; // 투표 테이블
$g4['poll_etc_table'] = $g4['table_prefix'] . 'poll_etc'; // 투표 기타의견 테이블
$g4['point_table'] = $g4['table_prefix'] . 'point'; // 포인트 테이블
$g4['popular_table'] = $g4['table_prefix'] . 'popular'; // 인기검색어 테이블
$g4['scrap_table'] = $g4['table_prefix'] . 'scrap'; // 게시글 스크랩 테이블
$g4['visit_table'] = $g4['table_prefix'] . 'visit'; // 방문자 테이블
$g4['visit_sum_table'] = $g4['table_prefix'] . 'visit_sum'; // 방문자 합계 테이블
$g4['token_table'] = $g4['table_prefix'] . 'token'; // 토큰 테이블
//
// 기타
@ -69,25 +69,25 @@ $g4['token_table'] = $g4['table_prefix'] . "token"; // 토큰
// www.sir.co.kr 과 sir.co.kr 도메인은 서로 다른 도메인으로 인식합니다. 쿠키를 공유하려면 .sir.co.kr 과 같이 입력하세요.
// 이곳에 입력이 없다면 www 붙은 도메인과 그렇지 않은 도메인은 쿠키를 공유하지 않으므로 로그인이 풀릴 수 있습니다.
$g4['cookie_domain'] = "";
$g4['cookie_domain'] = '';
// 게시판에서 링크의 기본갯수를 말합니다.
// 필드를 추가하면 이 숫자를 필드수에 맞게 늘려주십시오.
$g4['link_count'] = 2;
$g4['charset'] = "utf-8";
$g4['charset'] = 'utf-8';
$g4['phpmyadmin_dir'] = $g4['admin'] . "/phpMyAdmin/";
$g4['phpmyadmin_dir'] = $g4['admin'] . '/phpMyAdmin/';
$g4['token_time'] = 3; // 토큰 유효시간
// config.php 가 있는곳의 웹경로. 뒤에 / 를 붙이지 마세요.
// 예) http://g4.sir.co.kr
$g4['url'] = "";
$g4['https_url'] = "";
$g4['url'] = '';
$g4['https_url'] = '';
// 입력예
//$g4['url'] = "http://www.sir.co.kr";
//$g4['https_url'] = "https://www.sir.co.kr";
$g4['dbconfig'] = "data/dbconfig.php";
$g4['dbconfig'] = 'data/dbconfig.php';
?>

View File

@ -1,12 +1,12 @@
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
include_once("$g4[path]/head.sub.php");
include_once("$g4[path]/lib/outlogin.lib.php");
include_once("$g4[path]/lib/poll.lib.php");
include_once("$g4[path]/lib/visit.lib.php");
include_once("$g4[path]/lib/connect.lib.php");
include_once("$g4[path]/lib/popular.lib.php");
include_once($g4['path'].'/head.sub.php');
include_once($g4['path'].'/lib/outlogin.lib.php');
include_once($g4['path'].'/lib/poll.lib.php');
include_once($g4['path'].'/lib/visit.lib.php');
include_once($g4['path'].'/lib/connect.lib.php');
include_once($g4['path'].'/lib/popular.lib.php');
//print_r2(get_defined_constants());
@ -141,15 +141,15 @@ function fsearchbox_submit(f)
<td width=43></td>
<!-- 왼쪽 메뉴 -->
<td width=220 valign=top>
<?=outlogin("basic"); // 외부 로그인 ?>
<?=outlogin('basic'); // 외부 로그인 ?>
<div style='height:10px;'></div>
<?=poll("basic"); // 설문조사 ?>
<?=poll('basic'); // 설문조사 ?>
<div style='height:10px;'></div>
<?=visit("basic"); // 방문자수 ?>
<?=visit('basic'); // 방문자수 ?>
<div style='height:10px;'></div>

View File

@ -9,10 +9,10 @@ if (!$g4['title'])
// 쪽지를 받았나?
if ($member['mb_memo_call']) {
$mb = get_member($member[mb_memo_call], "mb_nick");
sql_query(" update {$g4[member_table]} set mb_memo_call = '' where mb_id = '$member[mb_id]' ");
$mb = get_member($member['mb_memo_call'], "mb_nick");
sql_query(" update {$g4['member_table']} set mb_memo_call = '' where mb_id = '{$member['mb_id']}' ");
alert($mb[mb_nick]."님으로부터 쪽지가 전달되었습니다.", $_SERVER[REQUEST_URI]);
alert($mb['mb_nick'].'님으로부터 쪽지가 전달되었습니다.', $_SERVER['REQUEST_URI']);
}
@ -25,7 +25,7 @@ if (!$lo_location)
$lo_location = $_SERVER['REQUEST_URI'];
//$lo_url = $g4[url] . $_SERVER['REQUEST_URI'];
$lo_url = $_SERVER['REQUEST_URI'];
if (strstr($lo_url, "/$g4[admin]/") || $is_admin == "super") $lo_url = "";
if (strstr($lo_url, "/$g4[admin]/") || $is_admin == 'super') $lo_url = '';
// 자바스크립트에서 go(-1) 함수를 쓰면 폼값이 사라질때 해당 폼의 상단에 사용하면
// 캐쉬의 내용을 가져옴. 완전한지는 검증되지 않음

View File

@ -1,9 +1,9 @@
<?
include_once("./_common.php");
include_once("$g4[path]/lib/latest.lib.php");
include_once('./_common.php');
include_once($g4['path'].'/lib/latest.lib.php');
$g4['title'] = "";
include_once("./_head.php");
$g4['title'] = '';
include_once('./_head.php');
?>
강좌홈페이지 작업 중입니다.<br>
@ -12,5 +12,5 @@ chicpro 님도 참가합니다.<br>
반갑습니다.
<?
include_once("./_tail.php");
include_once('./_tail.php');
?>

View File

@ -1,10 +1,10 @@
<?
include_once ("../config.php");
include_once ("./install.inc.php");
include_once ('../config.php');
include_once ('./install.inc.php');
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=<?=$g4[charset]?>">
<meta http-equiv="content-type" content="text/html; charset=<?=$g4['charset']?>">
<title>그누보드4 설치 (1/3) - 라이센스(License)</title>
<style type="text/css">
<!--
@ -27,43 +27,43 @@ include_once ("./install.inc.php");
<p>&nbsp;</p>
<p>&nbsp;</p>
<table width="587" border="0" cellspacing="0" cellpadding="0" align=center>
<tr>
<tr>
<td colspan="3"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="587" height="22">
<param name="movie" value="img/top.swf">
<param name="quality" value="high">
<embed src="img/top.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="587" height="22"></embed></object></td>
</tr>
<tr>
<tr>
<td width="3"><img src="img/box_left.gif" width="3" height="340"></td>
<td width="581" valign="top" bgcolor="#FCFCFC">
<table width="581" border="0" cellspacing="0" cellpadding="0">
<tr>
<tr>
<td><img src="img/box_title.gif" width="581" height="56"></td>
</tr>
</table>
<table width="541" border="0" align="center" cellpadding="0" cellspacing="0" class="body">
<tr>
<tr>
<td height="10"></td>
</tr>
<tr>
<tr>
<td>라이센스(License) 내용을 반드시 확인하십시오.</td>
</tr>
<tr>
<tr>
<td height="10"></td>
</tr>
<tr>
<tr>
<td align="center">
<textarea name="textarea" style='width:99%' rows="9" class="box" readonly>
<?=implode("", file("../LICENSE"));?>
</textarea>
<?=implode('', file('../LICENSE'));?>
</textarea>
</td>
</tr>
<tr>
<td height=10></td>
</tr>
<tr>
<tr>
<td>설치를 원하시면 위 내용에 동의하셔야 합니다.<br>
동의를 원하시면 &lt;예, 동의합니다&gt; 버튼을 클릭해 주세요.</td>
</tr>
@ -74,8 +74,8 @@ include_once ("./install.inc.php");
</tr>
</table>
<table width="551" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="right">
<tr>
<td align="right">
<form name=frm method=post onsubmit="return frm_submit(document.frm);">
<input type="hidden" name="agree" value="동의함">
<input type="submit" name="btn_submit" value="예, 동의합니다 ">
@ -86,7 +86,7 @@ include_once ("./install.inc.php");
</td>
<td width="3"><img src="img/box_right.gif" width="3" height="340"></td>
</tr>
<tr>
<tr>
<td colspan="3"><img src="img/box_bottom.gif" width="587" height="3"></td>
</tr>
</table>

View File

@ -1,26 +1,26 @@
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// 파일이 존재한다면 설치할 수 없다.
if (file_exists("../{$g4['dbconfig']}")) {
echo "<meta http-equiv='content-type' content='text/html; charset=$g4[charset]'>";
if (file_exists($g4['dbconfig'])) {
echo "<meta http-equiv='content-type' content='text/html; charset={$g4['charset']}'>";
echo "<p>프로그램이 이미 설치되어 있습니다.<br />새로 설치하시려면 dbconfig 파일을 삭제후 설치하시기 바랍니다.</p>";
exit;
}
// data 디렉토리가 있는가?
if (!is_dir("../data"))
if (!is_dir('../data'))
{
echo "<meta http-equiv='content-type' content='text/html; charset=$g4[charset]'>";
echo "<p>루트 디렉토리에 아래로 data 디렉토리를 생성하여 주십시오.<br />(common.php 파일이 있는곳이 루트 디렉토리 입니다.)<br /><br />$> mkdir data<br /><br />위 명령 실행후 다시 설치하여 주십시오.</p>";
echo "<meta http-equiv='content-type' content='text/html; charset={$g4['charset']}'>";
echo "<p>루트 디렉토리에 아래로 data 디렉토리를 생성하여 주십시오.<br />(common.php 파일이 있는곳이 루트 디렉토리 입니다.)<br /><br />$> mkdir data<br /><br />위 명령 실행후 다시 설치하여 주십시오.</p>";
exit;
}
// data 디렉토리에 파일 생성 가능한지 검사.
if (!(is_readable("../data") && is_writeable("../data") && is_executable("../data")))
if (!(is_readable('../data') && is_writeable('../data') && is_executable('../data')))
{
echo "<meta http-equiv='content-type' content='text/html; charset=$g4[charset]'>";
echo "<p>data 디렉토리의 퍼미션을 707로 변경하여 주십시오.<br /><br />$> chmod 707 data 또는 chmod uo+rwx data<br /><br />위 명령 실행후 다시 설치하여 주십시오.</p>";
echo "<meta http-equiv='content-type' content='text/html; charset={$g4['charset']}'>";
echo "<p>data 디렉토리의 퍼미션을 707로 변경하여 주십시오.<br /><br />$> chmod 707 data 또는 chmod uo+rwx data<br /><br />위 명령 실행후 다시 설치하여 주십시오.</p>";
exit;
}
?>

View File

@ -1,6 +1,6 @@
<?
include_once ("../config.php");
include_once ("./install.inc.php");
include_once ('../config.php');
include_once ('./install.inc.php');
$gmnow = gmdate("D, d M Y H:i:s") . " GMT";
header("Expires: 0"); // rfc2616 - Section 14.21
@ -9,8 +9,8 @@ header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: pre-check=0, post-check=0, max-age=0"); // HTTP/1.1
header("Pragma: no-cache"); // HTTP/1.0
if ($_POST["agree"] != "동의함") {
echo "<meta http-equiv='content-type' content='text/html; charset=$g4[charset]'>";
if ($_POST['agree'] != "동의함") {
echo "<meta http-equiv='content-type' content='text/html; charset={$g4['charset']}'>";
echo <<<HEREDOC
<script language="JavaScript">
alert("라이센스(License) 내용에 동의하셔야 설치를 계속하실 수 있습니다.");
@ -22,7 +22,7 @@ HEREDOC;
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=<?=$g4[charset]?>">
<meta http-equiv="content-type" content="text/html; charset=<?=$g4['charset']?>">
<title>그누보드4 설치 (2/3) - 설정</title>
<style type="text/css">
.body {
@ -45,38 +45,38 @@ HEREDOC;
<p>&nbsp;</p>
<table width="587" border="0" cellspacing="0" cellpadding="0">
<form name=frm method=post action="javascript:frm_submit(document.frm)" autocomplete="off">
<tr>
<tr>
<td colspan="3"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="587" height="22">
<param name="movie" value="img/top.swf">
<param name="quality" value="high">
<embed src="img/top.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="587" height="22"></embed></object></td>
</tr>
<tr>
<tr>
<td width="3"><img src="img/box_left.gif" width="3" height="340"></td>
<td width="581" valign="top" bgcolor="#FCFCFC"><table width="581" border="0" cellspacing="0" cellpadding="0">
<tr>
<tr>
<td><img src="img/box_title.gif" width="581" height="56"></td>
</tr>
</table>
<br>
<table width="540" border="0" align="center" cellpadding="0" cellspacing="0" class="body">
<tr>
<tr>
<td width="270" height="16"><strong>MySQL 정보입력 </strong><br>
<br>
<table width="270" border="0" cellpadding="0" cellspacing="0" class="body">
<tr>
<tr>
<td width="80" align="right" height=30>Host :&nbsp;</td>
<td><input name="mysql_host" type="text" class="box" value="localhost"></td>
</tr>
<tr>
<tr>
<td width="80" align="right" height=30>User :&nbsp;</td>
<td><input name="mysql_user" type="text" class="box"></td>
</tr>
<tr>
<tr>
<td width="80" align="right" height=30>Password :&nbsp;</td>
<td><input name="mysql_pass" type="text" class="box"></td>
</tr>
<tr>
<tr>
<td width="80" align="right" height=30>DB :&nbsp;</td>
<td><input name="mysql_db" type="text" class="box"></td>
</tr>
@ -84,19 +84,19 @@ HEREDOC;
<td><strong>최고관리자 정보입력</strong> <br>
<br>
<table width="270" border="0" cellpadding="0" cellspacing="0" class="body">
<tr>
<tr>
<td width="80" align="right" height=30>ID :&nbsp;</td>
<td><input name="admin_id" type="text" class="box" value="admin" onkeypress="only_alpha();"></td>
</tr>
<tr>
<tr>
<td width="80" align="right" height=30>Password :&nbsp;</td>
<td><input name="admin_pass" type="text" class="box"></td>
</tr>
<tr>
<tr>
<td width="80" align="right" height=30>Name :&nbsp;</td>
<td><input name="admin_name" type="text" class="box" value="최고관리자"></td>
</tr>
<tr>
<tr>
<td width="80" align="right" height=30>E-mail :&nbsp;</td>
<td><input name="admin_email" type="text" class="box" value="admin@domain"></td>
</tr>
@ -104,27 +104,27 @@ HEREDOC;
</tr>
</table>
<table width="562" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<tr>
<td height=15><img src="img/box_line.gif" width="562" height="2"></td>
</tr>
<tr>
<tr>
<td class=body align=right height=35><font color=crimson>이미 그누보드4가 존재한다면 DB 자료가 망실되므로 주의하십시오.</font></td>
</tr>
<tr>
<tr>
<td height=15><img src="img/box_line.gif" width="562" height="2"></td>
</tr>
</table>
<br>
<table width="551" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="right">
<tr>
<td align="right">
<input type="submit" name="Submit2" value=" 다 음 ">
</td>
</tr>
</table></td>
<td width="3"><img src="img/box_right.gif" width="3" height="340"></td>
</tr>
<tr>
<tr>
<td colspan="3"><img src="img/box_bottom.gif" width="587" height="3"></td>
</tr>
</form>
@ -136,32 +136,32 @@ HEREDOC;
function frm_submit(f)
{
if (f.mysql_host.value == "")
{
alert("MySQL Host 를 입력하십시오."); f.mysql_host.focus(); return;
{
alert("MySQL Host 를 입력하십시오."); f.mysql_host.focus(); return;
}
else if (f.mysql_user.value == "")
{
alert("MySQL User 를 입력하십시오."); f.mysql_user.focus(); return;
alert("MySQL User 를 입력하십시오."); f.mysql_user.focus(); return;
}
else if (f.mysql_db.value == "")
{
alert("MySQL DB 를 입력하십시오."); f.mysql_db.focus(); return;
alert("MySQL DB 를 입력하십시오."); f.mysql_db.focus(); return;
}
else if (f.admin_id.value == "")
{
alert("최고관리자 ID 를 입력하십시오."); f.admin_id.focus(); return;
alert("최고관리자 ID 를 입력하십시오."); f.admin_id.focus(); return;
}
else if (f.admin_pass.value == "")
{
alert("최고관리자 패스워드를 입력하십시오."); f.admin_pass.focus(); return;
alert("최고관리자 패스워드를 입력하십시오."); f.admin_pass.focus(); return;
}
else if (f.admin_name.value == "")
{
alert("최고관리자 이름을 입력하십시오."); f.admin_name.focus(); return;
alert("최고관리자 이름을 입력하십시오."); f.admin_name.focus(); return;
}
else if (f.admin_email.value == "")
{
alert("최고관리자 E-mail 을 입력하십시오."); f.admin_email.focus(); return;
alert("최고관리자 E-mail 을 입력하십시오."); f.admin_email.focus(); return;
}
@ -176,8 +176,8 @@ function frm_submit(f)
return true;
}
// 영문자만 입력 가능
function only_alpha()
// 영문자만 입력 가능
function only_alpha()
{
var c = event.keyCode;
if (!(c >= 65 && c <= 90 || c >= 97 && c <= 122)) {

View File

@ -1,8 +1,8 @@
<?
set_time_limit(0);
include_once ("../config.php");
include_once ("./install.inc.php");
include_once ('../config.php');
include_once ('./install.inc.php');
$gmnow = gmdate("D, d M Y H:i:s") . " GMT";
header("Expires: 0"); // rfc2616 - Section 14.21
@ -11,36 +11,36 @@ header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: pre-check=0, post-check=0, max-age=0"); // HTTP/1.1
header("Pragma: no-cache"); // HTTP/1.0
$mysql_host = $_POST[mysql_host];
$mysql_user = $_POST[mysql_user];
$mysql_pass = $_POST[mysql_pass];
$mysql_db = $_POST[mysql_db];
$admin_id = $_POST[admin_id];
$admin_pass = $_POST[admin_pass];
$admin_name = $_POST[admin_name];
$admin_email = $_POST[admin_email];
$mysql_host = $_POST['mysql_host'];
$mysql_user = $_POST['mysql_user'];
$mysql_pass = $_POST['mysql_pass'];
$mysql_db = $_POST['mysql_db'];
$admin_id = $_POST['admin_id'];
$admin_pass = $_POST['admin_pass'];
$admin_name = $_POST['admin_name'];
$admin_email = $_POST['admin_email'];
if (strtolower($g4[charset]) == 'utf-8') @mysql_query("set names utf8");
else if (strtolower($g4[charset]) == 'euc-kr') @mysql_query("set names euckr");
if (strtolower($g4['charset']) == 'utf-8') @mysql_query("set names utf8");
else if (strtolower($g4['charset']) == 'euc-kr') @mysql_query("set names euckr");
$dblink = @mysql_connect($mysql_host, $mysql_user, $mysql_pass);
if (!$dblink) {
echo "<meta http-equiv='content-type' content='text/html; charset=$g4[charset]'>";
echo "<script language='JavaScript'>alert('MySQL Host, User, Password 를 확인해 주십시오.');history.back();</script>";
echo "<meta http-equiv='content-type' content='text/html; charset={$g4['charset']}'>";
echo "<script language='JavaScript'>alert('MySQL Host, User, Password 를 확인해 주십시오.');history.back();</script>";
exit;
}
if (strtolower($g4[charset]) == 'utf-8') @mysql_query("set names utf8");
else if (strtolower($g4[charset]) == 'euc-kr') @mysql_query("set names euckr");
if (strtolower($g4['charset']) == 'utf-8') @mysql_query("set names utf8");
else if (strtolower($g4['charset']) == 'euc-kr') @mysql_query("set names euckr");
$select_db = @mysql_select_db($mysql_db, $dblink);
if (!$select_db) {
echo "<meta http-equiv='content-type' content='text/html; charset=$g4[charset]'>";
echo "<script language='JavaScript'>alert('MySQL DB 를 확인해 주십시오.');history.back();</script>";
echo "<meta http-equiv='content-type' content='text/html; charset={$g4['charset']}'>";
echo "<script language='JavaScript'>alert('MySQL DB 를 확인해 주십시오.');history.back();</script>";
exit;
}
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=<?=$g4[charset]?>">
<meta http-equiv="content-type" content="text/html; charset=<?=$g4['charset']?>">
<title>그누보드4 설치 (3/3) - DB</title>
<style type="text/css">
.body {
@ -70,51 +70,51 @@ if (!$select_db) {
<p>&nbsp;</p>
<table width="587" border="0" cellspacing="0" cellpadding="0">
<form name=frminstall2>
<tr>
<tr>
<td colspan="3"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="587" height="22">
<param name="movie" value="../install/img/top.swf">
<param name="quality" value="high">
<embed src="../install/img/top.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="587" height="22"></embed></object></td>
</tr>
<tr>
<tr>
<td width="3"><img src="../install/img/box_left.gif" width="3" height="340"></td>
<td width="581" valign="top" bgcolor="#FCFCFC"><table width="581" border="0" cellspacing="0" cellpadding="0">
<tr>
<tr>
<td><img src="../install/img/box_title.gif" width="581" height="56"></td>
</tr>
</table>
<br>
<table width="541" border="0" align="center" cellpadding="0" cellspacing="0" class="body">
<tr>
<tr>
<td>설치를 시작합니다. <font color="#CC0000">설치중 작업을 중단하지 마십시오. </font></td>
</tr>
<tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<tr>
<td><div align="left">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="status_bar" type="text" class="box" size="76" readonly></div></td>
</tr>
<tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<tr>
<td><table width="350" border="0" align="center" cellpadding="5" cellspacing="0" class="body">
<tr>
<tr>
<td width="50"> </td>
<td width="300"><input type=text name=job1 class=nobox size=80 readonly></td>
</tr>
<tr>
<tr>
<td width="50"> </td>
<td width="300"><input type=text name=job2 class=nobox size=80 readonly></td>
</tr>
<tr>
<tr>
<td width="50"> </td>
<td width="300"><input type=text name=job3 class=nobox size=80 readonly></td>
</tr>
<tr>
<td width="50">
<tr>
<td width="50">
<div align="center"></div></td>
<td width="300"><input type=text name=job4 class=nobox size=80 readonly></td>
</tr>
@ -123,7 +123,7 @@ if (!$select_db) {
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<tr>
<td><input type=text name=job5 class=nobox size=90 readonly></td>
</tr>
</table>
@ -133,46 +133,46 @@ if (!$select_db) {
</tr>
</table>
<table width="551" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="right">
<tr>
<td align="right">
<input type="button" name="btn_next" disabled value="메인화면" onclick="location.href='../';">
</td>
</tr>
</table></td>
<td width="3"><img src="../install/img/box_right.gif" width="3" height="340"></td>
</tr>
<tr>
<tr>
<td colspan="3"><img src="../install/img/box_bottom.gif" width="587" height="3"></td>
</tr>
</form>
</table>
</div>
<?
flush(); usleep(50000);
flush(); usleep(50000);
// 테이블 생성 ------------------------------------
$file = implode("", file("./sql_gnuboard4.sql"));
$file = implode('', file('./sql_gnuboard4.sql'));
eval("\$file = \"$file\";");
$f = explode(";", $file);
$f = explode(';', $file);
for ($i=0; $i<count($f); $i++) {
if (trim($f[$i]) == "") continue;
if (trim($f[$i]) == '') continue;
mysql_query($f[$i]) or die(mysql_error());
}
// 테이블 생성 ------------------------------------
echo "<script>document.frminstall2.job1.value='전체 테이블 생성중';</script>";
flush(); usleep(50000);
flush(); usleep(50000);
for ($i=0; $i<45; $i++)
{
echo "<script language='JavaScript'>document.frminstall2.status_bar.value += '■';</script>\n";
flush();
usleep(500);
usleep(500);
}
echo "<script>document.frminstall2.job1.value='전체 테이블 생성 완료';</script>";
flush(); usleep(50000);
flush(); usleep(50000);
$read_point = -1;
$write_point = 5;
@ -181,7 +181,7 @@ $download_point = -20;
//-------------------------------------------------------------------------------------------------
// config 테이블 설정
$sql = " insert into $g4[config_table]
$sql = " insert into {$g4['config_table']}
set cf_title = '그누보드4',
cf_admin = '$admin_id',
cf_use_point = '1',
@ -236,28 +236,27 @@ $sql = " insert into $g4[config_table]
mysql_query($sql) or die(mysql_error() . "<p>" . $sql);
// 운영자 회원가입
$sql = " insert into $g4[member_table]
$sql = " insert into {$g4['member_table']}
set mb_id = '$admin_id',
mb_password = PASSWORD('$admin_pass'),
mb_name = '$admin_name',
mb_nick = '$admin_name',
mb_email = '$admin_email',
mb_jumin = PASSWORD('1111111111118'),
mb_level = '10',
mb_mailling = '1',
mb_open = '1',
mb_email_certify = '$g4[time_ymdhis]',
mb_datetime = '$g4[time_ymdhis]',
mb_ip = '$_SERVER[REMOTE_ADDR]'
mb_email_certify = '{$g4['time_ymdhis']}',
mb_datetime = '{$g4['time_ymdhis']}',
mb_ip = '$_SERVER[REMOTE_ADDR]'
";
@mysql_query($sql);
echo "<script>document.frminstall2.job2.value='DB설정 완료';</script>";
flush(); usleep(50000);
flush(); usleep(50000);
//-------------------------------------------------------------------------------------------------
// DB 설정 파일 생성
$file = "../data/dbconfig.php";
$file = '../data/dbconfig.php';
$f = @fopen($file, "w");
fwrite($f, "<?\n");
@ -271,7 +270,7 @@ fclose($f);
@chmod($file, 0606);
echo "<script>document.frminstall2.job3.value='DB설정 파일 생성 완료';</script>";
flush(); usleep(50000);
flush(); usleep(50000);
// 1.00.09 - data/log 삽입
@ -283,7 +282,7 @@ $dir_arr = array ("../data",
"../data/session",
"../data/$g4[cheditor4]",
"../data/$g4[editor]");
for ($i=0; $i<count($dir_arr); $i++)
for ($i=0; $i<count($dir_arr); $i++)
{
@mkdir($dir_arr[$i], 0707);
@chmod($dir_arr[$i], 0707);
@ -293,7 +292,7 @@ for ($i=0; $i<count($dir_arr); $i++)
$f = fopen("../data/.htaccess", "w");
$str = <<<EOD
<FilesMatch "\.(htaccess|htpasswd|[Pp][Hh][Pp]|[Pp]?[Hh][Tt][Mm][Ll]?|[Ii][Nn][Cc]|[Cc][Gg][Ii]|[Pp][Ll])">
Order allow,deny
Order allow,deny
Deny from all
</FilesMatch>
EOD;
@ -309,7 +308,7 @@ sleep(1);
echo "<script>document.frminstall2.job4.value='필요한 Table, File, 디렉토리 생성을 모두 완료 하였습니다.';</script>";
echo "<script>document.frminstall2.job5.value='* 메인화면에서 운영자 로그인을 한 후 운영자 화면으로 이동하여 환경설정을 변경해 주십시오.';</script>";
flush(); usleep(50000);
flush(); usleep(50000);
?>
<script>document.frminstall2.btn_next.disabled = false;</script>

View File

@ -1,10 +1,10 @@
<?
if (!defined('_GNUBOARD_')) exit;
if ($g4['is_cheditor5'])
if ($g4['is_cheditor5'])
{
$g4['cheditor4'] = "cheditor5";
$g4['cheditor4_path'] = $g4['path'] . "/" . $g4['cheditor4'];
$g4['cheditor4'] = 'cheditor5';
$g4['cheditor4_path'] = $g4['path'] . '/' . $g4['cheditor4'];
function cheditor1($id, $width='100%', $height='250')
{
@ -19,7 +19,7 @@ if ($g4['is_cheditor5'])
</script>";
}
}
else
else
{
function cheditor1($id, $width='100%', $height='250')
{
@ -48,7 +48,7 @@ function cheditor2($id, $content='')
ed_{$id}.run();
</script>";
}
function cheditor3($id)
{
return "document.getElementById('tx_{$id}').value = ed_{$id}.outputBodyHTML();";

View File

@ -95,7 +95,7 @@ function set_cookie($cookie_name, $value, $expire)
{
global $g4;
setcookie(md5($cookie_name), base64_encode($value), $g4[server_time] + $expire, '/', $g4[cookie_domain]);
setcookie(md5($cookie_name), base64_encode($value), $g4['server_time'] + $expire, '/', $g4['cookie_domain']);
}
@ -114,7 +114,7 @@ function alert($msg='', $url='')
if (!$msg) $msg = '올바른 방법으로 이용해 주십시오.';
//header("Content-Type: text/html; charset=$g4[charset]");
echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=$g4[charset]\">";
echo "<meta http-equiv=\"content-type\" content=\"text/html; charset={$g4['charset']}\">";
echo "<script type='text/javascript'>alert('$msg');";
if (!$url)
echo "history.go(-1);";
@ -132,7 +132,7 @@ function alert_close($msg)
{
global $g4;
echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=$g4[charset]\">";
echo "<meta http-equiv=\"content-type\" content=\"text/html; charset={$g4['charset']}\">";
echo "<script type='text/javascript'> alert('$msg'); window.close(); </script>";
exit;
}
@ -150,14 +150,14 @@ function url_auto_link($str)
$str = preg_replace("/&amp;/", "&", $str);
$str = preg_replace("/&quot;/", "\"", $str);
$str = preg_replace("/&nbsp;/", "\t_nbsp_\t", $str);
$str = preg_replace("/([^(http:\/\/)]|\(|^)(www\.[^[:space:]]+)/i", "\\1<A HREF=\"http://\\2\" TARGET='$config[cf_link_target]'>\\2</A>", $str);
$str = preg_replace("/([^(http:\/\/)]|\(|^)(www\.[^[:space:]]+)/i", "\\1<A HREF=\"http://\\2\" TARGET='{$config['cf_link_target']}'>\\2</A>", $str);
//$str = preg_replace("/([^(HREF=\"?'?)|(SRC=\"?'?)]|\(|^)((http|https|ftp|telnet|news|mms):\/\/[a-zA-Z0-9\.-]+\.[\xA1-\xFEa-zA-Z0-9\.:&#=_\?\/~\+%@;\-\|\,]+)/i", "\\1<A HREF=\"\\2\" TARGET='$config[cf_link_target]'>\\2</A>", $str);
// 100825 : () 추가
// 120315 : CHARSET 에 따라 링크시 글자 잘림 현상이 있어 수정
if (strtoupper($g4['charset']) == 'UTF-8') {
$str = preg_replace("/([^(HREF=\"?'?)|(SRC=\"?'?)]|\(|^)((http|https|ftp|telnet|news|mms):\/\/[a-zA-Z0-9\.-]+\.[가-힣\xA1-\xFEa-zA-Z0-9\.:&#=_\?\/~\+%@;\-\|\,\(\)]+)/i", "\\1<A HREF=\"\\2\" TARGET='$config[cf_link_target]'>\\2</A>", $str);
$str = preg_replace("/([^(HREF=\"?'?)|(SRC=\"?'?)]|\(|^)((http|https|ftp|telnet|news|mms):\/\/[a-zA-Z0-9\.-]+\.[가-힣\xA1-\xFEa-zA-Z0-9\.:&#=_\?\/~\+%@;\-\|\,\(\)]+)/i", "\\1<A HREF=\"\\2\" TARGET='{$config['cf_link_target']}'>\\2</A>", $str);
} else {
$str = preg_replace("/([^(HREF=\"?'?)|(SRC=\"?'?)]|\(|^)((http|https|ftp|telnet|news|mms):\/\/[a-zA-Z0-9\.-]+\.[\xA1-\xFEa-zA-Z0-9\.:&#=_\?\/~\+%@;\-\|\,\(\)]+)/i", "\\1<A HREF=\"\\2\" TARGET='$config[cf_link_target]'>\\2</A>", $str);
$str = preg_replace("/([^(HREF=\"?'?)|(SRC=\"?'?)]|\(|^)((http|https|ftp|telnet|news|mms):\/\/[a-zA-Z0-9\.-]+\.[\xA1-\xFEa-zA-Z0-9\.:&#=_\?\/~\+%@;\-\|\,\(\)]+)/i", "\\1<A HREF=\"\\2\" TARGET='{$config['cf_link_target']}'>\\2</A>", $str);
}
// 이메일 정규표현식 수정 061004
//$str = preg_replace("/(([a-z0-9_]|\-|\.)+@([^[:space:]]*)([[:alnum:]-]))/i", "<a href='mailto:\\1'>\\1</a>", $str);
@ -203,32 +203,32 @@ function get_file($bo_table, $wr_id)
{
global $g4, $qstr;
$file["count"] = 0;
$sql = " select * from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' order by bf_no ";
$file['count'] = 0;
$sql = " select * from {$g4['board_file_table']} where bo_table = '$bo_table' and wr_id = '$wr_id' order by bf_no ";
$result = sql_query($sql);
while ($row = sql_fetch_array($result))
{
$no = $row[bf_no];
$file[$no][href] = "./download.php?bo_table=$bo_table&wr_id=$wr_id&no=$no" . $qstr;
$file[$no][download] = $row[bf_download];
$no = $row['bf_no'];
$file[$no]['href'] = "./download.php?bo_table=$bo_table&wr_id=$wr_id&no=$no" . $qstr;
$file[$no]['download'] = $row['bf_download'];
// 4.00.11 - 파일 path 추가
$file[$no][path] = "$g4[path]/data/file/$bo_table";
$file[$no]['path'] = $g4['path'].'/data/file/'.$bo_table;
//$file[$no][size] = get_filesize("{$file[$no][path]}/$row[bf_file]");
$file[$no][size] = get_filesize($row[bf_filesize]);
$file[$no]['size'] = get_filesize($row['bf_filesize']);
//$file[$no][datetime] = date("Y-m-d H:i:s", @filemtime("$g4[path]/data/file/$bo_table/$row[bf_file]"));
$file[$no][datetime] = $row[bf_datetime];
$file[$no][source] = addslashes($row[bf_source]);
$file[$no][bf_content] = $row[bf_content];
$file[$no][content] = get_text($row[bf_content]);
$file[$no]['datetime'] = $row['bf_datetime'];
$file[$no]['source'] = addslashes($row['bf_source']);
$file[$no]['bf_content'] = $row['bf_content'];
$file[$no]['content'] = get_text($row['bf_content']);
//$file[$no][view] = view_file_link($row[bf_file], $file[$no][content]);
$file[$no][view] = view_file_link($row[bf_file], $row[bf_width], $row[bf_height], $file[$no][content]);
$file[$no][file] = $row[bf_file];
$file[$no]['view'] = view_file_link($row['bf_file'], $row['bf_width'], $row['bf_height'], $file[$no]['content']);
$file[$no]['file'] = $row['bf_file'];
// prosper 님 제안
//$file[$no][imgsize] = @getimagesize("{$file[$no][path]}/$row[bf_file]");
$file[$no][image_width] = $row[bf_width] ? $row[bf_width] : 640;
$file[$no][image_height] = $row[bf_height] ? $row[bf_height] : 480;
$file[$no][image_type] = $row[bf_type];
$file["count"]++;
$file[$no]['image_width'] = $row['bf_width'] ? $row['bf_width'] : 640;
$file[$no]['image_height'] = $row['bf_height'] ? $row['bf_height'] : 480;
$file[$no]['image_type'] = $row['bf_type'];
$file['count']++;
}
return $file;
@ -241,8 +241,8 @@ function get_dirsize($dir)
$size = 0;
$d = dir($dir);
while ($entry = $d->read()) {
if ($entry != "." && $entry != "..") {
$size += filesize("$dir/$entry");
if ($entry != '.' && $entry != '..') {
$size += filesize($dir.'/'.$entry);
}
}
$d->close();
@ -272,25 +272,25 @@ function get_list($write_row, $board, $skin_path, $subject_len=40)
$list['is_notice'] = preg_match("/[^0-9]{0,1}{$list['wr_id']}[\r]{0,1}/",$board['bo_notice']);
if ($subject_len)
$list['subject'] = conv_subject($list['wr_subject'], $subject_len, "");
$list['subject'] = conv_subject($list['wr_subject'], $subject_len, '…');
else
$list['subject'] = conv_subject($list['wr_subject'], $board['bo_subject_len'], "");
$list['subject'] = conv_subject($list['wr_subject'], $board['bo_subject_len'], '…');
// 목록에서 내용 미리보기 사용한 게시판만 내용을 변환함 (속도 향상) : kkal3(커피)님께서 알려주셨습니다.
if ($board['bo_use_list_content'])
{
$html = 0;
if (strstr($list['wr_option'], "html1"))
if (strstr($list['wr_option'], 'html1'))
$html = 1;
else if (strstr($list['wr_option'], "html2"))
else if (strstr($list['wr_option'], 'html2'))
$html = 2;
$list['content'] = conv_content($list['wr_content'], $html);
}
$list['comment_cnt'] = "";
$list['comment_cnt'] = '';
if ($list['wr_comment'])
$list['comment_cnt'] = "($list[wr_comment])";
$list['comment_cnt'] = '('.$list['wr_comment'].')';
// 당일인 경우 시간으로 표시함
$list['datetime'] = substr($list['wr_datetime'],0,10);
@ -313,52 +313,52 @@ function get_list($write_row, $board, $skin_path, $subject_len=40)
if ($board['bo_use_sideview'])
$list['name'] = get_sideview($list['mb_id'], $tmp_name, $list['wr_email'], $list['wr_homepage']);
else
$list['name'] = "<span class='".($list['mb_id']?'member':'guest')."'>$tmp_name</span>";
$list['name'] = '<span class="'.($list['mb_id']?'member':'guest').'">'.$tmp_name.'</span>';
$reply = $list['wr_reply'];
$list['reply'] = "";
$list['reply'] = '';
if (strlen($reply) > 0)
{
for ($k=0; $k<strlen($reply); $k++)
$list['reply'] .= ' &nbsp;&nbsp; ';
}
$list['icon_reply'] = "";
$list['icon_reply'] = '';
if ($list['reply'])
$list['icon_reply'] = "<img src='$skin_path/img/icon_reply.gif' align='absmiddle'>";
$list['icon_reply'] = '<img src="'.$skin_path.'/img/icon_reply.gif" align="absmiddle">';
$list['icon_link'] = "";
$list['icon_link'] = '';
if ($list['wr_link1'] || $list['wr_link2'])
$list['icon_link'] = "<img src='$skin_path/img/icon_link.gif' align='absmiddle'>";
$list['icon_link'] = '<img src="'.$skin_path.'/img/icon_link.gif" align="absmiddle">';
// 분류명 링크
$list['ca_name_href'] = "$g4[bbs_path]/board.php?bo_table=$board[bo_table]&sca=".urlencode($list['ca_name']);
$list['ca_name_href'] = $g4['bbs_path'].'/board.php?bo_table='.$board['bo_table'].'&amp;sca='.urlencode($list['ca_name']);
$list['href'] = "$g4[bbs_path]/board.php?bo_table=$board[bo_table]&wr_id=$list[wr_id]" . $qstr;
$list['href'] = $g4['bbs_path'].'/board.php?bo_table='.$board['bo_table'].'&amp;wr_id='.$list['wr_id'].$qstr;
//$list['href'] = "$g4[bbs_path]/board.php?bo_table=$board[bo_table]&wr_id=$list[wr_id]";
if ($board['bo_use_comment'])
$list['comment_href'] = "javascript:win_comment('$g4[bbs_path]/board.php?bo_table=$board[bo_table]&wr_id=$list[wr_id]&cwin=1');";
$list['comment_href'] = "javascript:win_comment('$g4[bbs_path]/board.php?bo_table=$board[bo_table]&amp;wr_id={$list['wr_id']}&amp;cwin=1');";
else
$list['comment_href'] = $list['href'];
$list['icon_new'] = "";
$list['icon_new'] = '';
if ($list['wr_datetime'] >= date("Y-m-d H:i:s", $g4['server_time'] - ($board['bo_new'] * 3600)))
$list['icon_new'] = "<img src='$skin_path/img/icon_new.gif' align='absmiddle'>";
$list['icon_new'] = '<img src="'.$skin_path.'/img/icon_new.gif" align="absmiddle">';
$list['icon_hot'] = "";
$list['icon_hot'] = '';
if ($list['wr_hit'] >= $board['bo_hot'])
$list['icon_hot'] = "<img src='$skin_path/img/icon_hot.gif' align='absmiddle'>";
$list['icon_hot'] = '<img src="'.$skin_path.'/img/icon_hot.gif" align="absmiddle">';
$list['icon_secret'] = "";
if (strstr($list['wr_option'], "secret"))
$list['icon_secret'] = "<img src='$skin_path/img/icon_secret.gif' align='absmiddle'>";
$list['icon_secret'] = '';
if (strstr($list['wr_option'], 'secret'))
$list['icon_secret'] = '<img src="'.$skin_path.'/img/icon_secret.gif" align="absmiddle">';
// 링크
for ($i=1; $i<=$g4['link_count']; $i++)
{
$list['link'][$i] = set_http(get_text($list["wr_link{$i}"]));
$list['link_href'][$i] = "$g4[bbs_path]/link.php?bo_table=$board[bo_table]&wr_id=$list[wr_id]&no=$i" . $qstr;
$list['link_href'][$i] = $g4['bbs_path'].'/link.php?bo_table='.$board['bo_table'].'&amp;wr_id='.$list['wr_id'].'&amp;no='.$i.$qstr;
$list['link_hit'][$i] = (int)$list["wr_link{$i}_hit"];
}
@ -366,7 +366,7 @@ function get_list($write_row, $board, $skin_path, $subject_len=40)
$list['file'] = get_file($board['bo_table'], $list['wr_id']);
if ($list['file']['count'])
$list['icon_file'] = "<img src='$skin_path/img/icon_file.gif' align='absmiddle'>";
$list['icon_file'] = '<img src="'.$skin_path.'/img/icon_file.gif" align="absmiddle">';
return $list;
}
@ -384,19 +384,19 @@ function search_font($stx, $str)
global $config;
// 문자앞에 \ 를 붙입니다.
$src = array("/", "|");
$dst = array("\/", "\|");
$src = array('/', '|');
$dst = array('\/', '\|');
if (!trim($stx)) return $str;
// 검색어 전체를 공란으로 나눈다
$s = explode(" ", $stx);
$s = explode(' ', $stx);
// "/(검색1|검색2)/i" 와 같은 패턴을 만듬
$pattern = "";
$bar = "";
$pattern = '';
$bar = '';
for ($m=0; $m<count($s); $m++) {
if (trim($s[$m]) == "") continue;
if (trim($s[$m]) == '') continue;
// 태그는 포함하지 않아야 하는데 잘 안되는군. ㅡㅡa
//$pattern .= $bar . '([^<])(' . quotemeta($s[$m]) . ')';
//$pattern .= $bar . quotemeta($s[$m]);
@ -408,14 +408,14 @@ function search_font($stx, $str)
}
// 지정된 검색 폰트의 색상, 배경색상으로 대체
$replace = "<span style='background-color:$config[cf_search_bgcolor]; color:$config[cf_search_color];'>\\1</span>";
$replace = "<span style='background-color:{$config['cf_search_bgcolor']}; color:{$config['cf_search_color']};'>\\1</span>";
return preg_replace("/($pattern)/i", $replace, $str);
}
// 제목을 변환
function conv_subject($subject, $len, $suffix="")
function conv_subject($subject, $len, $suffix='')
{
return cut_str(get_text($subject), $len, $suffix);
}
@ -464,7 +464,7 @@ function conv_content($content, $html)
// XSS (Cross Site Script) 막기
// 완벽한 XSS 방지는 없다.
// 이런 경우를 방지함 <IMG STYLE="xss:expr/*XSS*/ession(alert('XSS'))">
$content = preg_replace("#\/\*.*\*\/#iU", "", $content);
@ -563,7 +563,7 @@ function get_sql_search($search_ca_name, $search_field, $search_text, $search_op
if ($search_str == "") continue;
// 인기검색어
$sql = " insert into $g4[popular_table] set pp_word = '$search_str', pp_date = '$g4[time_ymd]', pp_ip = '$_SERVER[REMOTE_ADDR]' ";
$sql = " insert into {$g4['popular_table']} set pp_word = '$search_str', pp_date = '{$g4['time_ymd']}', pp_ip = '{$_SERVER['REMOTE_ADDR']}' ";
sql_query($sql, FALSE);
$str .= $op1;
@ -631,7 +631,7 @@ function get_next_num($table)
$sql = " select min(wr_num) as min_wr_num from $table ";
$row = sql_fetch($sql);
// 가장 작은 번호에 1을 빼서 넘겨줌
return (int)($row[min_wr_num] - 1);
return (int)($row['min_wr_num'] - 1);
}
@ -640,7 +640,7 @@ function get_group($gr_id)
{
global $g4;
return sql_fetch(" select * from $g4[group_table] where gr_id = '$gr_id' ");
return sql_fetch(" select * from {$g4['group_table']} where gr_id = '$gr_id' ");
}
@ -649,7 +649,7 @@ function get_member($mb_id, $fields='*')
{
global $g4;
return sql_fetch(" select $fields from $g4[member_table] where mb_id = TRIM('$mb_id') ");
return sql_fetch(" select $fields from {$g4['member_table']} where mb_id = TRIM('$mb_id') ");
}
@ -696,17 +696,17 @@ function get_admin($admin='super')
$is = false;
if ($admin == 'board') {
$mb = sql_fetch("select * from $g4[member_table] where mb_id in ('$board[bo_admin]') limit 1 ");
$mb = sql_fetch("select * from {$g4['member_table']} where mb_id in ('$board[bo_admin]') limit 1 ");
$is = true;
}
if (($is && !$mb[mb_id]) || $admin == 'group') {
$mb = sql_fetch("select * from $g4[member_table] where mb_id in ('$group[gr_admin]') limit 1 ");
if (($is && !$mb['mb_id']) || $admin == 'group') {
$mb = sql_fetch("select * from {$g4['member_table']} where mb_id in ('{$group['gr_admin']}') limit 1 ");
$is = true;
}
if (($is && !$mb[mb_id]) || $admin == 'super') {
$mb = sql_fetch("select * from $g4[member_table] where mb_id in ('$config[cf_admin]') limit 1 ");
if (($is && !$mb['mb_id']) || $admin == 'super') {
$mb = sql_fetch("select * from {$g4['member_table']} where mb_id in ('{$config['cf_admin']}') limit 1 ");
}
return $mb;
@ -753,10 +753,10 @@ function get_group_select($name, $selected='', $event='')
{
global $g4, $is_admin, $member;
$sql = " select gr_id, gr_subject from $g4[group_table] a ";
$sql = " select gr_id, gr_subject from {$g4['group_table']} a ";
if ($is_admin == "group") {
$sql .= " left join $g4[member_table] b on (b.mb_id = a.gr_admin)
where b.mb_id = '$member[mb_id]' ";
$sql .= " left join {$g4['member_table']} b on (b.mb_id = a.gr_admin)
where b.mb_id = '{$member['mb_id']}' ";
}
$sql .= " order by a.gr_id ";
@ -764,9 +764,9 @@ function get_group_select($name, $selected='', $event='')
$str = "<select name='$name' $event>";
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$str .= "<option value='$row[gr_id]'";
$str .= "<option value='{$row['gr_id']}'";
if ($row[gr_id] == $selected) $str .= " selected";
$str .= ">$row[gr_subject]</option>";
$str .= ">{$row['gr_subject']}</option>";
}
$str .= "</select>";
return $str;
@ -797,20 +797,20 @@ function insert_point($mb_id, $point, $content='', $rel_table='', $rel_id='', $r
global $is_admin;
// 포인트 사용을 하지 않는다면 return
if (!$config[cf_use_point]) { return 0; }
if (!$config['cf_use_point']) { return 0; }
// 포인트가 없다면 업데이트 할 필요 없음
if ($point == 0) { return 0; }
// 회원아이디가 없다면 업데이트 할 필요 없음
if ($mb_id == "") { return 0; }
$mb = sql_fetch(" select mb_id from $g4[member_table] where mb_id = '$mb_id' ");
if ($mb_id == '') { return 0; }
$mb = sql_fetch(" select mb_id from {$g4['member_table']} where mb_id = '$mb_id' ");
if (!$mb[mb_id]) { return 0; }
// 이미 등록된 내역이라면 건너뜀
if ($rel_table || $rel_id || $rel_action)
{
$sql = " select count(*) as cnt from $g4[point_table]
$sql = " select count(*) as cnt from {$g4['point_table']}
where mb_id = '$mb_id'
and po_rel_table = '$rel_table'
and po_rel_id = '$rel_id'
@ -821,9 +821,9 @@ function insert_point($mb_id, $point, $content='', $rel_table='', $rel_id='', $r
}
// 포인트 건별 생성
$sql = " insert into $g4[point_table]
$sql = " insert into {$g4['point_table']}
set mb_id = '$mb_id',
po_datetime = '$g4[time_ymdhis]',
po_datetime = '{$g4['time_ymdhis']}',
po_content = '".addslashes($content)."',
po_point = '$point',
po_rel_table = '$rel_table',
@ -832,12 +832,12 @@ function insert_point($mb_id, $point, $content='', $rel_table='', $rel_id='', $r
sql_query($sql);
// 포인트 내역의 합을 구하고
$sql = " select sum(po_point) as sum_po_point from $g4[point_table] where mb_id = '$mb_id' ";
$sql = " select sum(po_point) as sum_po_point from {$g4['point_table']} where mb_id = '$mb_id' ";
$row = sql_fetch($sql);
$sum_point = $row[sum_po_point];
$sum_point = $row['sum_po_point'];
// 포인트 UPDATE
$sql = " update $g4[member_table] set mb_point = '$sum_point' where mb_id = '$mb_id' ";
$sql = " update {$g4['member_table']} set mb_point = '$sum_point' where mb_id = '$mb_id' ";
sql_query($sql);
return 1;
@ -851,19 +851,19 @@ function delete_point($mb_id, $rel_table, $rel_id, $rel_action)
$result = false;
if ($rel_table || $rel_id || $rel_action)
{
$result = sql_query(" delete from $g4[point_table]
$result = sql_query(" delete from {$g4['point_table']}
where mb_id = '$mb_id'
and po_rel_table = '$rel_table'
and po_rel_id = '$rel_id'
and po_rel_action = '$rel_action' ", false);
// 포인트 내역의 합을 구하고
$sql = " select sum(po_point) as sum_po_point from $g4[point_table] where mb_id = '$mb_id' ";
$sql = " select sum(po_point) as sum_po_point from {$g4['point_table']} where mb_id = '$mb_id' ";
$row = sql_fetch($sql);
$sum_point = $row[sum_po_point];
$sum_point = $row['sum_po_point'];
// 포인트 UPDATE
$sql = " update $g4[member_table] set mb_point = '$sum_point' where mb_id = '$mb_id' ";
$sql = " update {$g4['member_table']} set mb_point = '$sum_point' where mb_id = '$mb_id' ";
$result = sql_query($sql);
}
@ -871,7 +871,7 @@ function delete_point($mb_id, $rel_table, $rel_id, $rel_action)
}
// 회원 레이어
function get_sideview($mb_id, $name="", $email="", $homepage="")
function get_sideview($mb_id, $name='', $email='', $homepage='')
{
global $config;
global $g4;
@ -889,7 +889,7 @@ function get_sideview($mb_id, $name="", $email="", $homepage="")
if ($config['cf_use_member_icon']) {
$mb_dir = substr($mb_id,0,2);
$icon_file = "$g4[path]/data/member/$mb_dir/$mb_id.gif";
$icon_file = $g4['path'].'/data/member/'.$mb_dir.'/'.$mb_id.'.gif';
//if (file_exists($icon_file) && is_file($icon_file)) {
if (file_exists($icon_file)) {
@ -898,16 +898,16 @@ function get_sideview($mb_id, $name="", $email="", $homepage="")
//$height = $size[1];
$width = $config['cf_member_icon_width'];
$height = $config['cf_member_icon_height'];
$tmp_name = "<img src='$icon_file' width='$width' height='$height' align='absmiddle' border='0'>";
$tmp_name = '<img src="'.$icon_file.'" width="'.$width.'" height="'.$height.'" align="absmiddle" border="0">';
if ($config['cf_use_member_icon'] == 2) // 회원아이콘+이름
$tmp_name = $tmp_name . " <span class='member'>$name</span>";
$tmp_name = $tmp_name . ' <span class="member">'.$name.'</span>';
}
}
$title_mb_id = "[$mb_id]";
$title_mb_id = '['.$mb_id.']';
} else {
$tmp_name = "<span class='guest'>$name</span>";
$title_mb_id = "[비회원]";
$tmp_name = '<span class="guest">'.$name.'</span>';
$title_mb_id = '[비회원]';
}
$name = get_text($name);
@ -919,7 +919,7 @@ function get_sideview($mb_id, $name="", $email="", $homepage="")
// 파일을 보이게 하는 링크 (이미지, 플래쉬, 동영상)
function view_file_link($file, $width, $height, $content="")
function view_file_link($file, $width, $height, $content='')
{
global $config, $board;
global $g4;
@ -930,23 +930,23 @@ function view_file_link($file, $width, $height, $content="")
$ids++;
// 파일의 폭이 게시판설정의 이미지폭 보다 크다면 게시판설정 폭으로 맞추고 비율에 따라 높이를 계산
if ($width > $board[bo_image_width] && $board[bo_image_width])
if ($width > $board['bo_image_width'] && $board['bo_image_width'])
{
$rate = $board[bo_image_width] / $width;
$width = $board[bo_image_width];
$rate = $board['bo_image_width'] / $width;
$width = $board['bo_image_width'];
$height = (int)($height * $rate);
}
// 폭이 있는 경우 폭과 높이의 속성을 주고, 없으면 자동 계산되도록 코드를 만들지 않는다.
if ($width)
$attr = " width='$width' height='$height' ";
$attr = ' width="'.$width.'" height="'.$height.'" ';
else
$attr = "";
$attr = '';
if (preg_match("/\.($config[cf_image_extension])$/i", $file))
if (preg_match("/\.({$config['cf_image_extension']})$/i", $file))
// 이미지에 속성을 주지 않는 이유는 이미지 클릭시 원본 이미지를 보여주기 위한것임
// 게시판설정 이미지보다 크다면 스킨의 자바스크립트에서 이미지를 줄여준다
return "<img src='$g4[path]/data/file/$board[bo_table]/".urlencode($file)."' name='target_resize_image[]' onclick='image_window(this);' style='cursor:pointer;' title='$content'>";
return "<img src='{$g4['path']}/data/file/{$board['bo_table']}/".urlencode($file)."' name='target_resize_image[]' onclick='image_window(this);' style='cursor:pointer;' title='$content'>";
/*
// 110106 : FLASH XSS 공격으로 인하여 코드 자체를 막음
else if (preg_match("/\.($config[cf_flash_extension])$/i", $file))
@ -1002,10 +1002,10 @@ function cut_str($str, $len, $suffix="…")
global $g4;
if (strtoupper($g4['charset']) == 'UTF-8') {
$c = substr(str_pad(decbin(ord($str{$len})),8,'0',STR_PAD_LEFT),0,2);
if ($c == '10')
for (;$c != '11' && $c{0} == 1;$c = substr(str_pad(decbin(ord($str{--$len})),8,'0',STR_PAD_LEFT),0,2));
return substr($str,0,$len) . (strlen($str)-strlen($suffix) >= $len ? $suffix : '');
$c = substr(str_pad(decbin(ord($str{$len})),8,'0',STR_PAD_LEFT),0,2);
if ($c == '10')
for (;$c != '11' && $c{0} == 1;$c = substr(str_pad(decbin(ord($str{--$len})),8,'0',STR_PAD_LEFT),0,2));
return substr($str,0,$len) . (strlen($str)-strlen($suffix) >= $len ? $suffix : '');
} else {
$s = substr($str, 0, $len);
$cnt = 0;
@ -1101,7 +1101,7 @@ function sql_select_db($db, $connect)
function sql_query($sql, $error=TRUE)
{
if ($error)
$result = @mysql_query($sql) or die("<p>$sql<p>" . mysql_errno() . " : " . mysql_error() . "<p>error file : $_SERVER[PHP_SELF]");
$result = @mysql_query($sql) or die("<p>$sql<p>" . mysql_errno() . " : " . mysql_error() . "<p>error file : {$_SERVER['PHP_SELF']}");
else
$result = @mysql_query($sql);
return $result;
@ -1214,7 +1214,7 @@ function get_table_define($table, $crlf="\n")
$schema_create .= implode($columns, ', ') . ')';
} // end while
if (strtolower($g4['charset']) == "utf-8")
if (strtolower($g4['charset']) == 'utf-8')
$schema_create .= $crlf . ') DEFAULT CHARSET=utf8';
else
$schema_create .= $crlf . ')';
@ -1224,7 +1224,7 @@ function get_table_define($table, $crlf="\n")
// 리퍼러 체크
function referer_check($url="")
function referer_check($url='')
{
/*
// 제대로 체크를 하지 못하여 주석 처리함
@ -1242,25 +1242,25 @@ function referer_check($url="")
// 한글 요일
function get_yoil($date, $full=0)
{
$arr_yoil = array ("", "", "", "", "", "", "");
$arr_yoil = array ('일', '월', '화', '수', '목', '금', '토');
$yoil = date("w", strtotime($date));
$str = $arr_yoil[$yoil];
if ($full) {
$str .= "요일";
$str .= '요일';
}
return $str;
}
// 날짜를 select 박스 형식으로 얻는다
function date_select($date, $name="")
function date_select($date, $name='')
{
global $g4;
$s = "";
$s = '';
if (substr($date, 0, 4) == "0000") {
$date = $g4[time_ymdhis];
$date = $g4['time_ymdhis'];
}
preg_match("/([0-9]{4})-([0-9]{2})-([0-9]{2})/", $date, $m);
@ -1349,8 +1349,8 @@ function time_select($time, $name="")
function check_demo()
{
global $g4;
if (file_exists("$g4[path]/DEMO"))
alert("데모 화면에서는 하실(보실) 수 없는 작업입니다.");
if (file_exists($g4['path'].'/DEMO'))
alert('데모 화면에서는 하실(보실) 수 없는 작업입니다.');
}
@ -1459,7 +1459,7 @@ function bad_tag_convert($code)
global $view;
global $member, $is_admin;
if ($is_admin && $member[mb_id] != $view[mb_id]) {
if ($is_admin && $member['mb_id'] != $view['mb_id']) {
//$code = preg_replace_callback("#(\<(embed|object)[^\>]*)\>(\<\/(embed|object)\>)?#i",
// embed 또는 object 태그를 막지 않는 경우 필터링이 되도록 수정
$code = preg_replace_callback("#(\<(embed|object)[^\>]*)\>?(\<\/(embed|object)\>)?#i",
@ -1477,7 +1477,7 @@ function bad_tag_convert($code)
function get_token()
{
$token = md5(uniqid(rand(), true));
set_session("ss_token", $token);
set_session('ss_token', $token);
return $token;
}
@ -1493,26 +1493,26 @@ function check_token()
// 문자열에 utf8 문자가 들어 있는지 검사하는 함수
// 코드 : http://in2.php.net/manual/en/function.mb-check-encoding.php#95289
function is_utf8($str)
{
$len = strlen($str);
function is_utf8($str)
{
$len = strlen($str);
for($i = 0; $i < $len; $i++) {
$c = ord($str[$i]);
if ($c > 128) {
if (($c > 247)) return false;
elseif ($c > 239) $bytes = 4;
elseif ($c > 223) $bytes = 3;
elseif ($c > 191) $bytes = 2;
else return false;
if (($i + $bytes) > $len) return false;
while ($bytes > 1) {
$i++;
$b = ord($str[$i]);
if ($b < 128 || $b > 191) return false;
$bytes--;
}
}
}
return true;
$c = ord($str[$i]);
if ($c > 128) {
if (($c > 247)) return false;
elseif ($c > 239) $bytes = 4;
elseif ($c > 223) $bytes = 3;
elseif ($c > 191) $bytes = 2;
else return false;
if (($i + $bytes) > $len) return false;
while ($bytes > 1) {
$i++;
$b = ord($str[$i]);
if ($b < 128 || $b > 191) return false;
$bytes--;
}
}
}
return true;
}
?>

View File

@ -2,21 +2,21 @@
if (!defined('_GNUBOARD_')) exit;
// 현재 접속자수 출력
function connect($skin_dir="")
function connect($skin_dir='')
{
global $config, $g4;
// 회원, 방문객 카운트
$sql = " select sum(IF(mb_id<>'',1,0)) as mb_cnt, count(*) as total_cnt from $g4[login_table] where mb_id <> '$config[cf_admin]' ";
$sql = " select sum(IF(mb_id<>'',1,0)) as mb_cnt, count(*) as total_cnt from {$g4['login_table']} where mb_id <> '{$config['cf_admin']}' ";
$row = sql_fetch($sql);
if ($skin_dir)
$connect_skin_path = "$g4[path]/skin/connect/$skin_dir";
$connect_skin_path = $g4['path'].'/skin/connect/'.$skin_dir;
else
$connect_skin_path = "$g4[path]/skin/connect/$config[cf_connect_skin]";
$connect_skin_path = $g4['path'].'/skin/connect/'.$config['cf_connect_skin'];
ob_start();
include_once ("$connect_skin_path/connect.skin.php");
include_once ($connect_skin_path.'/connect.skin.php');
$content = ob_get_contents();
ob_end_clean();

View File

@ -2,18 +2,18 @@
if (!defined('_GNUBOARD_')) exit;
// 최신글 추출
function latest($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")
function latest($skin_dir='', $bo_table, $rows=10, $subject_len=40, $options='')
{
global $g4;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
$latest_skin_path = $g4['path'].'/skin/latest/'.$skin_dir;
else
$latest_skin_path = "$g4[path]/skin/latest/basic";
$latest_skin_path = $g4['path'].'/skin/latest/basic';
$list = array();
$sql = " select * from $g4[board_table] where bo_table = '$bo_table'";
$sql = " select * from {$g4['board_table']} where bo_table = '$bo_table'";
$board = sql_fetch($sql);
$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
@ -22,14 +22,14 @@ function latest($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")
$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_num limit 0, $rows ";
//explain($sql);
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++)
for ($i=0; $row = sql_fetch_array($result); $i++)
$list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);
ob_start();
include "$latest_skin_path/latest.skin.php";
include $latest_skin_path.'/latest.skin.php';
$content = ob_get_contents();
ob_end_clean();
return $content;
}
}
?>

View File

@ -1,9 +1,9 @@
<?
if (!defined("_GNUBOARD_")) exit;
if (!defined('_GNUBOARD_')) exit;
// 메일 보내기 (파일 여러개 첨부 가능)
// type : text=0, html=1, text+html=2
function mailer($fname, $fmail, $to, $subject, $content, $type=0, $file="", $cc="", $bcc="")
function mailer($fname, $fmail, $to, $subject, $content, $type=0, $file='', $cc='', $bcc='')
{
global $config;
global $g4;
@ -23,10 +23,10 @@ function mailer($fname, $fmail, $to, $subject, $content, $type=0, $file="", $cc=
$header .= "MIME-Version: 1.0\n";
//$header .= "X-Mailer: SIR Mailer 0.91 (sir.co.kr) : $_SERVER[SERVER_ADDR] : $_SERVER[REMOTE_ADDR] : $g4[url] : $_SERVER[PHP_SELF] : $_SERVER[HTTP_REFERER] \n";
// UTF-8 관련 수정
$header .= "X-Mailer: SIR Mailer 0.92 (sir.co.kr) : $_SERVER[SERVER_ADDR] : $_SERVER[REMOTE_ADDR] : $g4[url] : $_SERVER[PHP_SELF] : $_SERVER[HTTP_REFERER] \n";
$header .= "X-Mailer: SIR Mailer 0.92 (sir.co.kr) : {$_SERVER['SERVER_ADDR']} : {$_SERVER['REMOTE_ADDR']} : {$g4['url']} : {$_SERVER['PHP_SELF']} : {$_SERVER['HTTP_REFERER']} \n";
if ($file != "") {
$boundary = uniqid("http://sir.co.kr/");
if ($file != '') {
$boundary = uniqid('http://sir.co.kr/');
$header .= "Content-type: MULTIPART/MIXED; BOUNDARY=\"$boundary\"\n\n";
$header .= "--$boundary\n";
@ -43,15 +43,15 @@ function mailer($fname, $fmail, $to, $subject, $content, $type=0, $file="", $cc=
$header .= "Content-Transfer-Encoding: BASE64\n\n";
$header .= chunk_split(base64_encode($content)) . "\n";
if ($file != "") {
if ($file != '') {
foreach ($file as $f) {
$header .= "\n--$boundary\n";
$header .= "Content-Type: APPLICATION/OCTET-STREAM; name=\"$f[name]\"\n";
$header .= "Content-Type: APPLICATION/OCTET-STREAM; name=\"{$f['name']}\"\n";
$header .= "Content-Transfer-Encoding: BASE64\n";
$header .= "Content-Disposition: inline; filename=\"$f[name]\"\n";
$header .= "Content-Disposition: inline; filename=\"{$f['name']}\"\n";
$header .= "\n";
$header .= chunk_split(base64_encode($f[data]));
$header .= chunk_split(base64_encode($f['data']));
$header .= "\n";
}
$header .= "--$boundary--\n";
@ -94,7 +94,7 @@ function verify_email($address, &$error)
if (checkdnsrr($domain, "MX")) {
// 메일 교환기 레코드들을 얻는다
if (!getmxrr($domain, $mxhost, $mxweight)) {
$error = "메일 교환기를 회수할 수 없음";
$error = '메일 교환기를 회수할 수 없음';
return false;
}
} else {
@ -116,20 +116,20 @@ function verify_email($address, &$error)
// 220 메세지들은 건너뜀
// 3초가 지나도 응답이 없으면 포기
socket_set_blocking($fp, false);
$stoptime = $g4[server_time] + $WAIT_SECOND;
$stoptime = $g4['server_time'] + $WAIT_SECOND;
$gotresponse = false;
while (true) {
// 메일서버로부터 한줄 얻음
$line = fgets($fp, 1024);
if (substr($line, 0, 3) == "220") {
if (substr($line, 0, 3) == '220') {
// 타이머를 초기화
$stoptime = $g4[server_time] + $WAIT_SECOND;
$stoptime = $g4['server_time'] + $WAIT_SECOND;
$gotresponse = true;
} else if ($line == "" && $gotresponse)
} else if ($line == '' && $gotresponse)
break;
else if ($g4[server_time] > $stoptime)
else if ($g4['server_time'] > $stoptime)
break;
}
@ -139,8 +139,8 @@ function verify_email($address, &$error)
socket_set_blocking($fp, true);
// SMTP 서버와의 대화를 시작
fputs($fp, "HELO $_SERVER[SERVER_NAME]\r\n");
echo "HELO $_SERVER[SERVER_NAME]\r\n";
fputs($fp, "HELO {$_SERVER['SERVER_NAME']}\r\n");
echo "HELO {$_SERVER['SERVER_NAME']}\r\n";
fgets($fp, 1024);
// From을 설정
@ -157,7 +157,7 @@ function verify_email($address, &$error)
fputs($fp, "QUIT\r\n");
fclose($fp);
if (substr($line, 0, 3) != "250") {
if (substr($line, 0, 3) != '250') {
// SMTP 서버가 이 주소를 인식하지 못하므로 잘못된 주소임
$error = $line;
return false;
@ -166,8 +166,8 @@ function verify_email($address, &$error)
return true;
}
$error = "메일 교환기에 도달하지 못하였습니다.";
$error = '메일 교환기에 도달하지 못하였습니다.';
return false;
}
?>

View File

@ -2,14 +2,14 @@
if (!defined('_GNUBOARD_')) exit;
// 외부로그인
function outlogin($skin_dir="basic")
function outlogin($skin_dir='basic')
{
global $config, $member, $g4, $urlencode, $is_admin;
$nick = cut_str($member['mb_nick'], $config['cf_cut_name']);
$point = number_format($member['mb_point']);
$outlogin_skin_path = "$g4[path]/skin/outlogin/$skin_dir";
$outlogin_skin_path = $g4['path'].'/skin/outlogin/'.$skin_dir;
// 읽지 않은 쪽지가 있다면
if ($member['mb_id']) {
@ -18,17 +18,17 @@ function outlogin($skin_dir="basic")
$memo_not_read = $row['cnt'];
$is_auth = false;
$sql = " select count(*) as cnt from $g4[auth_table] where mb_id = '$member[mb_id]' ";
$sql = " select count(*) as cnt from {$g4['auth_table']} where mb_id = '{$member['mb_id']}' ";
$row = sql_fetch($sql);
if ($row['cnt'])
if ($row['cnt'])
$is_auth = true;
}
ob_start();
if ($member['mb_id'])
include_once ("$outlogin_skin_path/outlogin.skin.2.php");
include_once ($outlogin_skin_path.'/outlogin.skin.2.php');
else // 로그인 전이라면
include_once ("$outlogin_skin_path/outlogin.skin.1.php");
include_once ($outlogin_skin_path.'/outlogin.skin.1.php');
$content = ob_get_contents();
ob_end_clean();

View File

@ -2,12 +2,12 @@
if (!defined('_GNUBOARD_')) exit;
// 설문조사
function poll($skin_dir="basic", $po_id=false)
function poll($skin_dir='basic', $po_id=false)
{
global $config, $member, $g4;
// 투표번호가 넘어오지 않았다면 가장 큰(최근에 등록한) 투표번호를 얻는다
if (empty($po_id))
if (empty($po_id))
{
$po_id = $config['cf_max_po_id'];
if (empty($po_id))
@ -15,8 +15,8 @@ function poll($skin_dir="basic", $po_id=false)
}
ob_start();
$poll_skin_path = "$g4[path]/skin/poll/$skin_dir";
include_once ("$poll_skin_path/poll.skin.php");
$poll_skin_path = $g4['path'].'/skin/poll/'.$skin_dir;
include_once ($poll_skin_path.'/poll.skin.php');
$content = ob_get_contents();
ob_end_clean();

View File

@ -11,23 +11,23 @@ function popular($skin_dir='basic', $pop_cnt=7, $date_cnt=3)
if (!$skin_dir) $skin_dir = 'basic';
$date_gap = date("Y-m-d", $g4[server_time] - ($date_cnt * 86400));
$sql = " select pp_word, count(*) as cnt from $g4[popular_table]
where pp_date between '$date_gap' and '$g4[time_ymd]'
$date_gap = date("Y-m-d", $g4['server_time'] - ($date_cnt * 86400));
$sql = " select pp_word, count(*) as cnt from {$g4['popular_table']}
where pp_date between '$date_gap' and '{$g4['time_ymd']}'
group by pp_word
order by cnt desc, pp_word
limit 0, $pop_cnt ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$list[$i] = $row;
// 스크립트등의 실행금지
$list[$i][pp_word] = get_text($list[$i][pp_word]);
$list[$i]['pp_word'] = get_text($list[$i]['pp_word']);
}
ob_start();
$popular_skin_path = "$g4[path]/skin/popular/$skin_dir";
include_once ("$popular_skin_path/popular.skin.php");
$popular_skin_path = $g4['path'].'/skin/popular/'.$skin_dir;
include_once ($popular_skin_path.'/popular.skin.php');
$content = ob_get_contents();
ob_end_clean();

View File

@ -12,16 +12,16 @@ if (!defined('_GNUBOARD_')) exit;
/////////////////////////////////////////
// return 값이 있으면 오류, 없으면 정상
function send_trackback($tb_url, $url, $title, $blog_name, $excerpt)
function send_trackback($tb_url, $url, $title, $blog_name, $excerpt)
{
/*
// allow_url_fopen = Off 일 경우 트랙백 사용할 수 없었던 오류를 수정
// allow_url_fopen = On 일 경우에만 사용 가능
//주소가 유효한지 검사
$p_fp = fopen($tb_url,"r");
if($p_fp)
if($p_fp)
@fclose($p_fp);
else
else
return "트랙백 URL이 존재하지 않습니다.";
*/
@ -33,20 +33,20 @@ function send_trackback($tb_url, $url, $title, $blog_name, $excerpt)
//주소 처리
$uinfo = parse_url($tb_url);
if($uinfo[query]) $tmp_data .= "&".$uinfo[query];
if(!$uinfo[port]) $uinfo[port] = "80";
if($uinfo['query']) $tmp_data .= "&".$uinfo['query'];
if(!$uinfo['port']) $uinfo['port'] = "80";
//최종 전송 자료
$send_str = "POST ".$uinfo[path]." HTTP/1.1\r\n".
"Host: ".$uinfo[host]."\r\n".
"User-Agent: GNUBOARD\r\n".
"Content-Type: application/x-www-form-urlencoded\r\n".
"Content-length: ".strlen($tmp_data)."\r\n".
"Connection: close\r\n\r\n".
$send_str = 'POST '.$uinfo['path'].' HTTP/1.1\r\n'.
'Host: '.$uinfo['host'].'\r\n'.
'User-Agent: GNUBOARD\r\n'.
'Content-Type: application/x-www-form-urlencoded\r\n'.
'Content-length: ".strlen($tmp_data)."\r\n'.
'Connection: close\r\n\r\n'.
$tmp_data;
$fp = @fsockopen($uinfo[host],$uinfo[port]);
if(!$fp)
return "트랙백 URL이 존재하지 않습니다.";
$fp = @fsockopen($uinfo['host'],$uinfo['port']);
if(!$fp)
return '트랙백 URL이 존재하지 않습니다.';
//전송
//$fp = fsockopen($uinfo[host],$uinfo[port]);
@ -57,21 +57,21 @@ function send_trackback($tb_url, $url, $title, $blog_name, $excerpt)
fclose($fp);
//트랙백 URL인지 확인
if(!strstr($response,"<response>"))
return "올바른 트랙백 URL이 아닙니다.";
if(!strstr($response,'<response>'))
return '올바른 트랙백 URL이 아닙니다.';
//XML 부분만 뽑음
$response = strchr($response,"<?");
$response = substr($response,0,strpos($response,"</response>"));
$response = strchr($response,'<?');
$response = substr($response,0,strpos($response,'</response>'));
//에러 검사
if(strstr($response,"<error>0</error>"))
return "";
if(strstr($response,'<error>0</error>'))
return '';
else {
$tb_error_str = strchr($response,"<message>");
$tb_error_str = substr($tb_error_str,0,strpos($tb_error_str,"</message>"));
$tb_error_str = str_replace("<message>","",$tb_error_str);
return "트랙백 전송중 오류가 발생했습니다: $tb_error_str";
$tb_error_str = strchr($response,'<message>');
$tb_error_str = substr($tb_error_str,0,strpos($tb_error_str,'</message>'));
$tb_error_str = str_replace('<message>','',$tb_error_str);
return '트랙백 전송중 오류가 발생했습니다: '.$tb_error_str;
}
}
?>

View File

@ -2,11 +2,11 @@
if (!defined('_GNUBOARD_')) exit;
// 방문자수 출력
function visit($skin_dir="basic")
function visit($skin_dir='basic')
{
global $config, $g4;
// visit 배열변수에
// visit 배열변수에
// $visit[1] = 오늘
// $visit[2] = 어제
// $visit[3] = 최대
@ -19,8 +19,8 @@ function visit($skin_dir="basic")
settype($visit[3], "integer");
ob_start();
$visit_skin_path = "$g4[path]/skin/visit/$skin_dir";
include_once ("$visit_skin_path/visit.skin.php");
$visit_skin_path = $g4['path'].'/skin/visit/'.$skin_dir;
include_once ($visit_skin_path.'/visit.skin.php');
$content = ob_get_contents();
ob_end_clean();

View File

@ -1,5 +1,5 @@
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
// 사용자 화면 우측과 하단을 담당하는 페이지입니다.
// 우측, 하단 화면을 꾸미려면 이 파일을 수정합니다.
@ -18,5 +18,5 @@ if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
<!-- 카피라이트 끝 -->
<?
include_once("$g4[path]/tail.sub.php");
include_once($g4['path'].'/tail.sub.php');
?>

View File

@ -1,25 +1,25 @@
<script src="<?=$g4['path']?>/js/wrest.js"></script>
<? if ($is_admin == "super") { ?><!-- <div style='float:left; width:<?=$table_width?>px; text-align:center;'>RUN TIME : <?=get_microtime()-$begin_time;?><br></div> --><? } ?>
<? if ($is_admin == 'super') { ?><!-- <div style='float:left; width:<?=$table_width?>px; text-align:center;'>RUN TIME : <?=get_microtime()-$begin_time;?><br></div> --><? } ?>
</body>
</html>
<?
$tmp_sql = " select count(*) as cnt from $g4[login_table] where lo_ip = '$_SERVER[REMOTE_ADDR]' ";
$tmp_sql = " select count(*) as cnt from {$g4['login_table']} where lo_ip = '{$_SERVER['REMOTE_ADDR']}' ";
$tmp_row = sql_fetch($tmp_sql);
//sql_query(" lock table $g4[login_table] write ", false);
if ($tmp_row['cnt'])
{
$tmp_sql = " update $g4[login_table] set mb_id = '$member[mb_id]', lo_datetime = '$g4[time_ymdhis]', lo_location = '$lo_location', lo_url = '$lo_url' where lo_ip = '$_SERVER[REMOTE_ADDR]' ";
$tmp_sql = " update {$g4['login_table']} set mb_id = '{$member['mb_id']}', lo_datetime = '{$g4['time_ymdhis']}', lo_location = '$lo_location', lo_url = '$lo_url' where lo_ip = '{$_SERVER['REMOTE_ADDR']}' ";
sql_query($tmp_sql, FALSE);
}
else
{
$tmp_sql = " insert into $g4[login_table] ( lo_ip, mb_id, lo_datetime, lo_location, lo_url ) values ( '$_SERVER[REMOTE_ADDR]', '$member[mb_id]', '$g4[time_ymdhis]', '$lo_location', '$lo_url' ) ";
$tmp_sql = " insert into {$g4['login_table']} ( lo_ip, mb_id, lo_datetime, lo_location, lo_url ) values ( '{$_SERVER['REMOTE_ADDR']}', '{$member['mb_id']}', '{$g4['time_ymdhis']}', '$lo_location', '$lo_url' ) ";
sql_query($tmp_sql, FALSE);
// 시간이 지난 접속은 삭제한다
sql_query(" delete from $g4[login_table] where lo_datetime < '".date("Y-m-d H:i:s", $g4[server_time] - (60 * $config[cf_login_minutes]))."' ");
sql_query(" delete from {$g4['login_table']} where lo_datetime < '".date("Y-m-d H:i:s", $g4['server_time'] - (60 * $config['cf_login_minutes']))."' ");
// 부담(overhead)이 있다면 테이블 최적화
//$row = sql_fetch(" SHOW TABLE STATUS FROM `$mysql_db` LIKE '$g4[login_table]' ");