테스트 사이트 - 개발 중인 베타 버전입니다

네이트온 알림 플러그인 - 2011년 10월 07일 패치 - 사용중단

cm_free-632757-f6e42d778e83cb2ea9cbb253fa791a0a.jpg
 
http://sir.co.kr/bbs/board.php?bo_table=g4_plugin&wr_id=117&page=2 의 버전2인 네이트온으로 알림입니다.

마이피플과 다른방식의 전송방식을 택하여 보다 많은 분이 이용가능하게 하였습니다. 이것도 질문 또는 AS없습니다.

* 판매목적으로 사용이 불가능합니다.

 

 

 

파일 설정


 

1, 첨부파일을 업로드

2, 계정 or 서버의 ./bbs/write_update.php 오픈



3, 네이트온 코드 추출
http://devsquare.nate.com/openApi/NateOnAddBuddyButton 접속

    ① 네이트 로그인후 접속해야합니다.

    ② 알림을 전송하는 아이디를 선택후 ⓑ진행

ⓑ 하단부분에 코드받기 클릭.


ⓒ 소스코드를 복사한다.




 

4, 그누보드 원본 파일이라는 가정에 약 462줄에 다음 소스 삽입.

// 네이트온 전송
  if($board[bo_10] == "nateon send"){ // 네이트온 사용 게시판인지 판별
 // 자동 추출
 $auto_if = '3번에서 복사한 소스 삽입'; //
http://devsquare.nate.com/openApi/NateOnAddBuddyButton 에서 발급된소스 삽입
 $auto_url = @explode("<iframe src=\"", $auto_if);
 $auto_url = @explode("\" width=\"", $auto_url[1]);
 $auto_url = $auto_url[0];
 include_once("$g4[path]/module/send_nateon/nateon.lib.php"); // lib로드
    nateon($auto_url, $board[bo_9], "{$wr_name}님께서 {$board[bo_subject]} 게시판에 \"{$wr_subject}\"의 글을 남기셨습니다.\r\n\r\n{$g4[url]}/{$g4[bbs]}/board.php?bo_table={$bo_table}&wr_id={$wr_id}");
  }

 





게시판 설정



1, 적용하고자하는 게시판의 관리자 설정에 접속합니다.



2, 여분테이블에 알림받는분 네이트온 주소 삽입.(다수일경우: aaaa@nate.com; bbb@nate.com 식으로 추가)

3, 네이트온을 사용하는 게시판인지 확인하기 위하여 여분필드10에 "nateon send"를 입력.

4, 사용한다 ㅇㅅㅇ;;

 

 

....................██...........................██
.................█......█.....................█▒▒█
..............█...▓▓.█...................█.▓▓▒█
...........█...▓▓▓..█.................█..▓▓▓▒█
.........█.....▓▓▓...███████...▓▓▓.▒█
.......█.....................................................▒▒█
.....█.........................................................▒▒█
...███████..............................███████
.█.............................................................▒▒▒█
█......██................................................██▒▒█
█......██................................................██▒▒█
█..................................................................▒▒█
█..........▓▓▓..........................▓▓▓...▒▒█
█.......▓▓▓▓▓....███...███....▓▓▓▓▓▒▒█
...█......▓▓▓....................................▓▓▓▒▒█
......███.......................................▒▒▒███
...............████████████████
........................█▓▓▓▓▓▓▓▓█
.....................██............▒▒▓▓██
..................█▒█...............▒▒▓█▓█
...............█▒██...............▒▒▓██▓█
............█...█...█...............▒▒▓█...█▒█
.........█...█......█...............▒▒▒█......█▒█
......█...█.........█...............▒▒▒█.........█...█
.........█............█............▒▒▒▒█............█
  


- 2011년 10월 05일 패치내용
* 일부 사용자 동작 안하던 현상 패치(코드 로드 제대로 못하던 현상 수정)

* 기존 작동이 되던 사용자는 그대로 사용하셔도 됩니다.


- 2011년 10월 05일 패치내용
* 일부 사용자 동작 안되던현상 수정(2차수정)


- 2011년 12월 05일 배포중인 다른 스킨/플러그인과 같은 라이센스 적용
* 이 스킨으로 발생하는 모든책임은 사용자에게 있습니다.

* 수정은 본인이 알아서 하셔야합니다.

* 질문 받지 않습니다.

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

댓글 70개

일반페이지에서 사용방법
// 자동 추출
$auto_if = '소스 삽입'; // http://devsquare.nate.com/openApi/NateOnAddBuddyButton 에서 발급된소스 삽입
$auto_url = @explode("<iframe src=\"", $auto_if);
$auto_url = @explode("\" width=\"", $auto_url[1]);
$auto_url = $auto_url[0];
include_once("$g4[path]/module/send_nateon/nateon.lib.php"); // lib로드
nateon($auto_url, "받는분 네이트온 주소", "보내고자하는내용"); // 다수일경우: aaaa@nate.com; bbb@nate.com 식으로 추가
수고하셨습니다.
아.. 참고로 스마트폰으로 알림기능은 그대로 사용할수 있습니다.
다만 스마트폰에 네이트온톡을 설치 하셔야합니다.
멋지네요
잘 활용할께요 추천합니다
와 이런게 대박이군요
코드는 어떤걸 받아야하나요?


마이페이지
오픈API
네이트 인증 API
미니홈피 API
일촌 API
네이트온 API
ⓒ로그 API
커넥팅 API
게시판 스크랩 API
이글루스 API
공감 플러그인
팬박스 플러그인
친구 추가 플러그인
쪽지보내기 플러그인쪽지보내기 버튼
http://devsquare.nate.com/openApi/NateOnAddBuddyButton (친구 추가 플러그인) 하단에 보시면됩니다.
이 마지못한 추천은 ㅇㅅㅇ;;;
ㅋㅋ
와.................. 멋진데요?
오우 나이스
고생많으셨습니다 추천~
오.. 이런 기능도 가능하군요.~~
이메일아이디로 cmn 얻고 싶은데... 정말 얻기 힘드네요 ;;;;
Cmn이 먼지 몰라서 ㅋㅋ
소스코드에 보시면, 고유ID값으로 CMN 얻어와서 보내는거 있는데요 ^^;
아... 그 CMN이요?(제일 고생한 부분이라 머리속에서 지워버렸습니다 ㅋㅋ)
그것 같은경우 네이트인증 API(토큰, 세션등 유지하고 값을 불러와야하기 때문.)를 써야하기 때문에...
작업분량이 많아지고 부화가 이소스보다 조금더 있습니다.
그래서 대충 CMN값을 파싱해올수 있는 방법을 찾다가 위소스처럼 처리 한것이지요.
네이트인증 API를 쓰지 않는이상은 메일주소로만 해서 CMN얻는방법이 제가 쓰는 방법 이외에 없어 보입니다.(저도 이거 2시간동안 삽질하다가 저렇게 했습니다 ㅎㅎ)
결국 API가 답이군요... (ㅠ.ㅠ)
저도 이리저리 연구해봤는데... Terrorboy님이 얼마나 고생하셨는지 짐작이 갑니다. 감사합니다.
감사합니다 ㅠ.ㅠ
테러보이님은 신기한거 되게 잘만드시네요 ㅋㅋ
한번 받아봐야징~
와..저도 꼭 해봐야겠네요 ㅎㅎ
추천합니다..ㅎㅎ
와우..대단하네요! 추천드립니다..
문자셋 euc-kr 입니다.

nateon.lib.php 파일 에 아래 주석 해지 했습니다
$to = iconv('euc-kr', 'utf-8',$to); //보내는 사람 데이터 UTF변환;
$msg = iconv('euc-kr', 'utf-8',$msg); //메시지 데이터 UTF변환;
ANSI 으로 저장후 업로드 하였습니다.

.htaccess 파일을 아래와 같이 작성 하여 루트에 업로드 했습니다
<IfModule mod_rewrite.c>
php_flag allow_url_fopen 1
</IfModule>

그런데 "실패" 가 출력 됩니다.
카페24호스팅 입니다. 혹 짐작 가시는것 있으신가요??
.htaccess가 필요없는것으로 알고 있습니다.
필요하다네요... ㅠㅠ
일단 수정해드렸지만 이유를 파악할수 없군요 ㅎ.ㅎ;
Terrorboy 님 덕분에 잘 해결 됬습니다.
좀더 잘보고 이해 하도록 노력 해봐야 겠네요^^
질문있어요

네이트에서 받은 코드 모두를

$auto_if = '3번에서 복사한 소스 삽입'; // http://devsquare.nate.com/openApi/

3번에서 복사한 이곳에 모두 붙혀넣기 하는건가요??
이상하네.. 왜 안되는지 연구 2시간째.ㅠㅠ
php 설정에서 allow_url_fopen 가 on으로 되어 있는지 확인 한 번 해보고 하세요. 저도 그게 안되어 있어서 4시간정도 삽질했습니다.

답변감사합니다.
allow_url_fopen이게 필요없는줄알았는데...
필요하군요...
allow_url_fopen이것때문에 전송방식을 바꿨는데 말이죠 ㅠ.ㅠ;
결국 네이트온을 몽땅 분석했습니다...
아..... 더 자세히 이야기하면, 차단될까봐 .. 여기까지만.. ;;
ㅋㅋㅋㅋㅋㅋㅋㅋㅋ
난사님이 적어주신대로 하니 드디어 됐습니다.
.htaccess에 PHP_flag allow_url_fopen 1 삽입하고 나니 되네요.
(cafe24 호스팅 사용)

좋은 자료 / 정보 감사합니다. ^^
축하드립니다.
테러보이님 오늘 확인한건데요,.
요거 추가하니까 글쓰기후 bbs/write_update.php 넘어갈때 유지보수중이라고 페이지 뜹니다.

"웹 사이트에서 페이지를 표시할 수 없습니다. HTTP 500 가능성이 높은 원인:•웹 사이트는 유지 관리 중입니다.•웹 사이트에 프로그래밍 오류가 있습니다. "

원본에다가 시험해봤는데 그러더라구요..
흠..... 저 에러는 윈도우 서버같네요...
설정에서 allow_url_fopen 를 ON시켜보세요..
리눅스 서버인데...allow_url_fopen는 php.ini 에서 찾아보니 이미

allow_url_fopen = On

상태더라구요~



[PHP]
engine = On
short_open_tag = On
asp_tags = Off
precision = 12
y2k_compliance = On
output_buffering = Off
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func=
serialize_precision = 100
allow_call_time_pass_reference = On
safe_mode = Off
safe_mode_gid = Off
safe_mode_include_dir =
safe_mode_exec_dir =
safe_mode_allowed_env_vars = PHP_
safe_mode_protected_env_vars = LD_LIBRARY_PATH
disable_functions =
disable_classes =
expose_php = On
max_execution_time = 240 ; Maximum execution time of each script, in seconds
max_input_time = 60 ; Maximum amount of time each script may spend parsing request data
memory_limit = 256M
error_reporting = E_ALL & ~E_NOTICE
display_errors = Off
display_startup_errors = Off
log_errors = Off
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
variables_order = "EGPCS"
register_globals = Off
register_argc_argv = On
post_max_size = 2047M
gpc_order = "GPC"
magic_quotes_gpc = On
magic_quotes_runtime = Off
magic_quotes_sybase = Off
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
doc_root =
user_dir =
include_path = ".:/etc/config/php"
extension_dir = /usr/local/apache/modules
enable_dl = On
file_uploads = On
upload_max_filesize = 2047M
allow_url_fopen = On
default_socket_timeout = 300
upload_tmp_dir = /share/Web
[Syslog]
define_syslog_variables = Off

[mail function]
SMTP = localhost
smtp_port = 25
sendmail_path = /usr/sbin/sendmail -t -i
[Java]

[Date]
date.timezone = "Asia/Taipei"

[SQL]
sql.safe_mode = Off

[ODBC]
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1

[MySQL]
mysql.allow_persistent = On
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket = "/tmp/mysql.sock"
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off

[mSQL]
msql.allow_persistent = On
msql.max_persistent = -1
msql.max_links = -1

[PostgresSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0

[Sybase]
sybase.allow_persistent = On
sybase.max_persistent = -1
sybase.max_links = -1
sybase.min_error_severity = 10
sybase.min_message_severity = 10
sybase.compatability_mode = Off

[Sybase-CT]
sybct.allow_persistent = On
sybct.max_persistent = -1
sybct.max_links = -1
sybct.min_server_severity = 10
sybct.min_client_severity = 10

[dbx]
dbx.colnames_case = "unchanged"

[bcmath]
bcmath.scale = 0

[browscap]

[Informix]
ifx.default_host =
ifx.default_user =
ifx.default_password =
ifx.allow_persistent = On
ifx.max_persistent = -1
ifx.max_links = -1
ifx.textasvarchar = 0
ifx.byteasvarchar = 0
ifx.charasvarchar = 0
ifx.blobinfile = 0
ifx.nullformat = 0

[Session]
session.save_handler = files
session.use_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 100
session.gc_maxlifetime = 1440
session.bug_compat_42 = 1
session.bug_compat_warn = 1
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="

session.save_path = /share/MD0_DATA/.php_session
[MSSQL]
mssql.allow_persistent = On
mssql.max_persistent = -1
mssql.max_links = -1
mssql.min_error_severity = 10
mssql.min_message_severity = 10
mssql.compatability_mode = Off
mssql.secure_connection = Off

[Assertion]

[Ingres II]
ingres.allow_persistent = On
ingres.max_persistent = -1
ingres.max_links = -1
ingres.default_database =
ingres.default_user =
ingres.default_password =

[Verisign Payflow Pro]
pfpro.defaulthost = "test-payflow.verisign.com"
pfpro.defaultport = 443
pfpro.defaulttimeout = 30

[com]

[Printer]

[mbstring]

[FrontBase]

[exif]

[eaccelerator]
extension = eaccelerator.so
eaccelerator.shm_size = 32
eaccelerator.cache_dir = /.eaccelerator.tmp
eaccelerator.enable = 1
eaccelerator.optimizer = 1
eaccelerator.check_mtime = 1
eaccelerator.debug = 0
eaccelerator.filter =
eaccelerator.shm_max = 1M
eaccelerator.shm_ttl = 0
eaccelerator.shm_prune_period = 3600
eaccelerator.shm_only = 0
eaccelerator.compress = 1
eaccelerator.compress_level = 9

[Crack]

; End:
[Zend]
zend_extension = /share/MD0_DATA/Web/linkhard/ioncube/ioncube_loader_lin_5.2.so
zend_extension_manager.optimizer = /usr/local/apache/modules/Zend/lib/Optimizer-3.3.0
zend_extension_manager.optimizer_ts = /usr/local/apache/modules/Zend/lib/Optimizer_TS-3.3.0
zend_optimizer.version = 3.3.0a
zend_extension = /usr/local/apache/modules/Zend/lib/ZendExtensionManager.so
zend_extension_ts = /usr/local/apache/modules/Zend/lib/ZendExtensionManager_TS.so
[Imagick]
extension = imagick.so
bbs/write_update.php 전문을 보내주세요.
<?
$g4[title] = $wr_subject . "글입력";
include_once("./_common.php");

// 090710
if (substr_count($wr_content, "&#") > 50) {
alert("내용에 올바르지 않은 코드가 다수 포함되어 있습니다.");
exit;
}

@include_once("$board_skin_path/write_update.head.skin.php");

include_once("$g4[path]/lib/trackback.lib.php");

/*
$filters = explode(",", $config[cf_filter]);
for ($i=0; $i<count($filters); $i++) {
$s = trim($filters[$i]); // 필터단어의 앞뒤 공백을 없앰
if (stristr($wr_subject, $s)) {
alert("제목에 금지단어(\'{$s}\')가 포함되어 있습니다.");
exit;
}
if (stristr($wr_content, $s)) {
alert("내용에 금지단어(\'{$s}\')가 포함되어 있습니다.");
exit;
}
}
*/

$upload_max_filesize = ini_get('upload_max_filesize');

if (empty($_POST))
alert("파일 또는 글내용의 크기가 서버에서 설정한 값을 넘어 오류가 발생하였습니다.\\n\\npost_max_size=".ini_get('post_max_size')." , upload_max_filesize=$upload_max_filesize\\n\\n게시판관리자 또는 서버관리자에게 문의 바랍니다.");

// 리퍼러 체크
//referer_check();

$w = $_POST["w"];
$wr_link1 = mysql_real_escape_string($_POST['wr_link1']);
$wr_link2 = mysql_real_escape_string($_POST['wr_link2']);

$notice_array = explode("\n", trim($board[bo_notice]));

if ($w == "u" || $w == "r") {
$wr = get_write($write_table, $wr_id);
if (!$wr[wr_id])
alert("글이 존재하지 않습니다.\\n\\n글이 삭제되었거나 이동하였을 수 있습니다.");
}

// 외부에서 글을 등록할 수 있는 버그가 존재하므로 비밀글은 사용일 경우에만 가능해야 함
if (!$is_admin && !$board[bo_use_secret] && $secret)
alert("비밀글 미사용 게시판 이므로 비밀글로 등록할 수 없습니다.");

// 외부에서 글을 등록할 수 있는 버그가 존재하므로 비밀글 무조건 사용일때는 관리자를 제외(공지)하고 무조건 비밀글로 등록
if (!$is_admin && $board[bo_use_secret] == 2) {
$secret = "secret";
}

if ($w == "" || $w == "u") {
// 김선용 1.00 : 글쓰기 권한과 수정은 별도로 처리되어야 함
if($w =="u" && $member['mb_id'] && $wr['mb_id'] == $member['mb_id'])
;
else if ($member[mb_level] < $board[bo_write_level])
alert("글을 쓸 권한이 없습니다.");

// 외부에서 글을 등록할 수 있는 버그가 존재하므로 공지는 관리자만 등록이 가능해야 함
if (!$is_admin && $notice)
alert("관리자만 공지할 수 있습니다.");
}
else if ($w == "r")
{
if (in_array((int)$wr_id, $notice_array))
alert("공지에는 답변 할 수 없습니다.");

if ($member[mb_level] < $board[bo_reply_level])
alert("글을 답변할 권한이 없습니다.");

// 게시글 배열 참조
$reply_array = &$wr;

// 최대 답변은 테이블에 잡아놓은 wr_reply 사이즈만큼만 가능합니다.
if (strlen($reply_array[wr_reply]) == 10)
alert("더 이상 답변하실 수 없습니다.\\n\\n답변은 10단계 까지만 가능합니다.");

$reply_len = strlen($reply_array[wr_reply]) + 1;
if ($board[bo_reply_order]) {
$begin_reply_char = "A";
$end_reply_char = "Z";
$reply_number = +1;
$sql = " select MAX(SUBSTRING(wr_reply, $reply_len, 1)) as reply from $write_table where wr_num = '$reply_array[wr_num]' and SUBSTRING(wr_reply, $reply_len, 1) <> '' ";
} else {
$begin_reply_char = "Z";
$end_reply_char = "A";
$reply_number = -1;
$sql = " select MIN(SUBSTRING(wr_reply, $reply_len, 1)) as reply from $write_table where wr_num = '$reply_array[wr_num]' and SUBSTRING(wr_reply, $reply_len, 1) <> '' ";
}
if ($reply_array[wr_reply]) $sql .= " and wr_reply like '$reply_array[wr_reply]%' ";
$row = sql_fetch($sql);

if (!$row[reply])
$reply_char = $begin_reply_char;
else if ($row[reply] == $end_reply_char) // A~Z은 26 입니다.
alert("더 이상 답변하실 수 없습니다.\\n\\n답변은 26개 까지만 가능합니다.");
else
$reply_char = chr(ord($row[reply]) + $reply_number);

$reply = $reply_array[wr_reply] . $reply_char;
} else
alert("w 값이 제대로 넘어오지 않았습니다.");


if ($w == "" || $w == "r")
{
if ($_SESSION["ss_datetime"] >= ($g4[server_time] - $config[cf_delay_sec]) && !$is_admin)
alert("너무 빠른 시간내에 게시물을 연속해서 올릴 수 없습니다.");

set_session("ss_datetime", $g4[server_time]);

// 동일내용 연속 등록 불가
$row = sql_fetch(" select MD5(CONCAT(wr_ip, wr_subject, wr_content)) as prev_md5 from $write_table order by wr_id desc limit 1 ");
$curr_md5 = md5($_SERVER[REMOTE_ADDR].$wr_subject.$wr_content);
if ($row[prev_md5] == $curr_md5 && !$is_admin)
alert("동일한 내용을 연속해서 등록할 수 없습니다.");
}

// 자동등록방지 검사
//include_once ("./norobot_check.inc.php");

if (!$is_member) {
if ($w=='' || $w=='r') {
$key = get_session("captcha_keystring");
if (!($key && $key == $_POST[wr_key])) {
session_unregister("captcha_keystring");
alert("정상적인 접근이 아닌것 같습니다.");
}
}
}

if (!isset($_POST[wr_subject]) || !trim($_POST[wr_subject]))
alert("제목을 입력하여 주십시오.");

// 디렉토리가 없다면 생성합니다. (퍼미션도 변경하구요.)
@mkdir("$g4[path]/data/file/$bo_table", 0707);
@chmod("$g4[path]/data/file/$bo_table", 0707);

// "인터넷옵션 > 보안 > 사용자정의수준 > 스크립팅 > Action 스크립팅 > 사용 안 함" 일 경우의 오류 처리
// 이 옵션을 사용 안 함으로 설정할 경우 어떤 스크립트도 실행 되지 않습니다.
//if (!$_POST[wr_content]) die ("내용을 입력하여 주십시오.");

$chars_array = array_merge(range(0,9), range('a','z'), range('A','Z'));
//print_r2($chars_array); exit;

// 가변 파일 업로드
$file_upload_msg = "";
$upload = array();
for ($i=0; $i<count($_FILES[bf_file][name]); $i++)
{
// 삭제에 체크가 되어있다면 파일을 삭제합니다.
if ($_POST[bf_file_del][$i])
{
$upload[$i][del_check] = true;

$row = sql_fetch(" select bf_file from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' ");
@unlink("$g4[path]/data/file/$bo_table/$row[bf_file]");
}
else
$upload[$i][del_check] = false;

$tmp_file = $_FILES[bf_file][tmp_name][$i];
$filename = $_FILES[bf_file][name][$i];
$filesize = $_FILES[bf_file][size][$i];

// 서버에 설정된 값보다 큰파일을 업로드 한다면
if ($filename)
{
if ($_FILES[bf_file][error][$i] == 1)
{
$file_upload_msg .= "\'{$filename}\' 파일의 용량이 서버에 설정($upload_max_filesize)된 값보다 크므로 업로드 할 수 없습니다.\\n";
continue;
}
else if ($_FILES[bf_file][error][$i] != 0)
{
$file_upload_msg .= "\'{$filename}\' 파일이 정상적으로 업로드 되지 않았습니다.\\n";
continue;
}
}

if (is_uploaded_file($tmp_file))
{
// 관리자가 아니면서 설정한 업로드 사이즈보다 크다면 건너뜀
if (!$is_admin && $filesize > $board[bo_upload_size])
{
$file_upload_msg .= "\'{$filename}\' 파일의 용량(".number_format($filesize)." 바이트)이 게시판에 설정(".number_format($board[bo_upload_size])." 바이트)된 값보다 크므로 업로드 하지 않습니다.\\n";
continue;
}

//=================================================================\
// 090714
// 이미지나 플래시 파일에 악성코드를 심어 업로드 하는 경우를 방지
// 에러메세지는 출력하지 않는다.
//-----------------------------------------------------------------
$timg = @getimagesize($tmp_file);
// image type
if ( preg_match("/\.($config[cf_image_extension])$/i", $filename) ||
preg_match("/\.($config[cf_flash_extension])$/i", $filename) )
{
if ($timg[2] < 1 || $timg[2] > 16)
{
//$file_upload_msg .= "\'{$filename}\' 파일이 이미지나 플래시 파일이 아닙니다.\\n";
continue;
}
}
//=================================================================

$upload[$i][image] = $timg;

// 4.00.11 - 글답변에서 파일 업로드시 원글의 파일이 삭제되는 오류를 수정
if ($w == 'u')
{
// 존재하는 파일이 있다면 삭제합니다.
$row = sql_fetch(" select bf_file from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' ");
@unlink("$g4[path]/data/file/$bo_table/$row[bf_file]");
}

// 프로그램 원래 파일명
$upload[$i][source] = $filename;
$upload[$i][filesize] = $filesize;

// 아래의 문자열이 들어간 파일은 -x 를 붙여서 웹경로를 알더라도 실행을 하지 못하도록 함
$filename = preg_replace("/\.(php|phtm|htm|cgi|pl|exe|jsp|asp|inc)/i", "$0-x", $filename);

// 접미사를 붙인 파일명
//$upload[$i][file] = abs(ip2long($_SERVER[REMOTE_ADDR])).'_'.substr(md5(uniqid($g4[server_time])),0,8).'_'.urlencode($filename);
// 달빛온도님 수정 : 한글파일은 urlencode($filename) 처리를 할경우 '%'를 붙여주게 되는데 '%'표시는 미디어플레이어가 인식을 못하기 때문에 재생이 안됩니다. 그래서 변경한 파일명에서 '%'부분을 빼주면 해결됩니다.
//$upload[$i][file] = abs(ip2long($_SERVER[REMOTE_ADDR])).'_'.substr(md5(uniqid($g4[server_time])),0,8).'_'.str_replace('%', '', urlencode($filename));
shuffle($chars_array);
$shuffle = implode("", $chars_array);

// 첨부파일 첨부시 첨부파일명에 공백이 포함되어 있으면 일부 PC에서 보이지 않거나 다운로드 되지 않는 현상이 있습니다. (길상여의 님 090925)
//$upload[$i][file] = abs(ip2long($_SERVER[REMOTE_ADDR])).'_'.substr($shuffle,0,8).'_'.str_replace('%', '', urlencode($filename));
$upload[$i][file] = abs(ip2long($_SERVER[REMOTE_ADDR])).'_'.substr($shuffle,0,8).'_'.str_replace('%', '', urlencode(str_replace(' ', '_', $filename)));

$dest_file = "$g4[path]/data/file/$bo_table/" . $upload[$i][file];

// 업로드가 안된다면 에러메세지 출력하고 죽어버립니다.
$error_code = move_uploaded_file($tmp_file, $dest_file) or die($_FILES[bf_file][error][$i]);

// 올라간 파일의 퍼미션을 변경합니다.
chmod($dest_file, 0606);

//$upload[$i][image] = @getimagesize($dest_file);

}
}

if ($w == "" || $w == "r")
{
if ($member[mb_id])
{
$mb_id = $member[mb_id];
$wr_name = $board[bo_use_name] ? $member[mb_name] : $member[mb_nick];
$wr_password = $member[mb_password];
$wr_email = $member[mb_email];
$wr_homepage = $member[mb_homepage];
}
else
{
$mb_id = "";
// 비회원의 경우 이름이 누락되는 경우가 있음
if (!trim($wr_name))
alert("이름은 필히 입력하셔야 합니다.");
$wr_password = sql_password($wr_password);
}

if ($w == "r")
{
// 답변의 원글이 비밀글이라면 패스워드는 원글과 동일하게 넣는다.
if ($secret)
$wr_password = $wr[wr_password];

$wr_id = $wr_id . $reply;
$wr_num = $write[wr_num];
$wr_reply = $reply;
}
else
{
$wr_num = get_next_num($write_table);
$wr_reply = "";
}

$sql = " insert into $write_table
set wr_num = '$wr_num',
wr_reply = '$wr_reply',
wr_comment = 0,
ca_name = '$ca_name',
wr_option = '$html,$secret,$mail',
wr_subject = '$wr_subject',
wr_content = '$wr_content',
wr_link1 = '$wr_link1',
wr_link2 = '$wr_link2',
wr_link1_hit = 0,
wr_link2_hit = 0,
wr_trackback = '$wr_trackback',
wr_hit = 0,
wr_good = 0,
wr_nogood = 0,
mb_id = '$member[mb_id]',
wr_password = '$wr_password',
wr_name = '$wr_name',
wr_email = '$wr_email',
wr_homepage = '$wr_homepage',
wr_datetime = '$g4[time_ymdhis]',
wr_last = '$g4[time_ymdhis]',
wr_ip = '$_SERVER[REMOTE_ADDR]',
wr_1 = '$wr_1',
wr_2 = '$wr_2',
wr_3 = '$wr_3',
wr_4 = '$wr_4',
wr_5 = '$wr_5',
wr_6 = '$wr_6',
wr_7 = '$wr_7',
wr_8 = '$wr_8',
wr_9 = '$wr_9',
wr_10 = '$wr_10' ";
sql_query($sql);

$wr_id = mysql_insert_id();

// 부모 아이디에 UPDATE
sql_query(" update $write_table set wr_parent = '$wr_id' where wr_id = '$wr_id' ");

// 새글 INSERT
//sql_query(" insert into $g4[board_new_table] ( bo_table, wr_id, wr_parent, bn_datetime ) values ( '$bo_table', '$wr_id', '$wr_id', '$g4[time_ymdhis]' ) ");
sql_query(" insert into $g4[board_new_table] ( bo_table, wr_id, wr_parent, bn_datetime, mb_id ) values ( '$bo_table', '$wr_id', '$wr_id', '$g4[time_ymdhis]', '$member[mb_id]' ) ");

// 게시글 1 증가
sql_query("update $g4[board_table] set bo_count_write = bo_count_write + 1 where bo_table = '$bo_table'");

// 쓰기 포인트 부여
if ($w == '')
{
if ($notice)
{
$bo_notice = $wr_id . "\n" . $board[bo_notice];
sql_query(" update $g4[board_table] set bo_notice = '$bo_notice' where bo_table = '$bo_table' ");
}

insert_point($member[mb_id], $board[bo_write_point], "$board[bo_subject] $wr_id 글쓰기", $bo_table, $wr_id, '쓰기');
}
else
{
// 답변은 코멘트 포인트를 부여함
// 답변 포인트가 많은 경우 코멘트 대신 답변을 하는 경우가 많음
insert_point($member[mb_id], $board[bo_comment_point], "$board[bo_subject] $wr_id 글답변", $bo_table, $wr_id, '쓰기');
}
}
else if ($w == "u")
{
if ($is_admin == "super") // 최고관리자 통과
;
else if ($is_admin == "group") { // 그룹관리자
$mb = get_member($write[mb_id]);
if ($member[mb_id] != $group[gr_admin]) // 자신이 관리하는 그룹인가?
alert("자신이 관리하는 그룹의 게시판이 아니므로 수정할 수 없습니다.");
else if ($member[mb_level] < $mb[mb_level]) // 자신의 레벨이 크거나 같다면 통과
alert("자신의 권한보다 높은 권한의 회원이 작성한 글은 수정할 수 없습니다.");
} else if ($is_admin == "board") { // 게시판관리자이면
$mb = get_member($write[mb_id]);
if ($member[mb_id] != $board[bo_admin]) // 자신이 관리하는 게시판인가?
alert("자신이 관리하는 게시판이 아니므로 수정할 수 없습니다.");
else if ($member[mb_level] < $mb[mb_level]) // 자신의 레벨이 크거나 같다면 통과
alert("자신의 권한보다 높은 권한의 회원이 작성한 글은 수정할 수 없습니다.");
} else if ($member[mb_id]) {
if ($member[mb_id] != $write[mb_id])
alert("자신의 글이 아니므로 수정할 수 없습니다.");
} else {
if ($write[mb_id])
alert("로그인 후 수정하세요.", "./login.php?url=".urlencode("./board.php?bo_table=$bo_table&wr_id=$wr_id"));
}

if ($member[mb_id])
{
// 자신의 글이라면
if ($member[mb_id] == $wr[mb_id])
{
$mb_id = $member[mb_id];
$wr_name = $board[bo_use_name] ? $member[mb_name] : $member[mb_nick];
$wr_email = $member[mb_email];
$wr_homepage = $member[mb_homepage];
}
else
{
$mb_id = $wr[mb_id];
$wr_name = $wr[wr_name];
$wr_email = $wr[wr_email];
$wr_homepage = $wr[wr_homepage];
}
}
else
{
$mb_id = "";
// 비회원의 경우 이름이 누락되는 경우가 있음
//if (!trim($wr_name)) alert("이름은 필히 입력하셔야 합니다.");
}

$sql_password = $wr_password ? " , wr_password = '".sql_password($wr_password)."' " : "";

$sql_ip = "";
if (!$is_admin)
$sql_ip = " , wr_ip = '$_SERVER[REMOTE_ADDR]' ";

$sql = " update $write_table
set ca_name = '$ca_name',
wr_option = '$html,$secret,$mail',
wr_subject = '$wr_subject',
wr_content = '$wr_content',
wr_link1 = '$wr_link1',
wr_link2 = '$wr_link2',
mb_id = '$mb_id',
wr_name = '$wr_name',
wr_email = '$wr_email',
wr_homepage = '$wr_homepage',
wr_1 = '$wr_1',
wr_2 = '$wr_2',
wr_3 = '$wr_3',
wr_4 = '$wr_4',
wr_5 = '$wr_5',
wr_6 = '$wr_6',
wr_7 = '$wr_7',
wr_8 = '$wr_8',
wr_9 = '$wr_9',
wr_10= '$wr_10'
$sql_ip
$sql_password
where wr_id = '$wr[wr_id]' ";
sql_query($sql);

// 분류가 수정되는 경우 해당되는 코멘트의 분류명도 모두 수정함
// 코멘트의 분류를 수정하지 않으면 검색이 제대로 되지 않음
$sql = " update $write_table set ca_name = '$ca_name' where wr_parent = '$wr[wr_id]' ";
sql_query($sql);

if ($notice)
{
//if (!preg_match("/[^0-9]{0,1}{$wr_id}[\r]{0,1}/",$board[bo_notice]))
if (!in_array((int)$wr_id, $notice_array))
{
$bo_notice = $wr_id . '\n' . $board[bo_notice];
sql_query(" update $g4[board_table] set bo_notice = '$bo_notice' where bo_table = '$bo_table' ");
}
}
else
{
$bo_notice = '';
for ($i=0; $i<count($notice_array); $i++)
if ((int)$wr_id != (int)$notice_array[$i])
$bo_notice .= $notice_array[$i] . '\n';
$bo_notice = trim($bo_notice);
//$bo_notice = preg_replace("/^".$wr_id."[\n]?$/m", "", $board[bo_notice]);
sql_query(" update $g4[board_table] set bo_notice = '$bo_notice' where bo_table = '$bo_table' ");
}
}
/*
// 네이트온 전송 조상문 2011.10.27
if($board[bo_10] == "nateon send"){ // 네이트온 사용 게시판인지 판별
// 자동 추출
$auto_if = '<iframe src="http://api.nateon.nate.com/web/buddy/ViewPlugin.do?v=Dq0YKofBQW4NysYUCx9yUtkUvdVGM_btHBIkBxHWizZ1OU6yntZBggiSHA2NOoydB7ebvVcEHQ7qVU3IQe5crrX7wT_qLyS9iFHDFhKMTcOM6JibPiPb2jzA_iTAN59gISkjtQim5J7LCuDw3gmrGVBeEGbzQ2_weMuJNS1ivwRc5F4UMjESTu9aub4s7UWn" width="135" height="43" marginwidth="0" marginheight="0" frameborder="0" scrolling="no"></iframe>'; // http://devsquare.nate.com/openApi/NateOnAddBuddyButton 에서 발급된소스 삽입
$auto_url = @explode("<iframe src=\"", $auto_if);
$auto_url = @explode("\" width=\"", $auto_url[1]);
$auto_url = $auto_url[0];
include_once("$g4[path]/module/send_nateon/nateon.lib.php"); // lib로드
nateon($auto_url, $board[bo_9], "{$wr_name}님께서 {$board[bo_subject]} 게시판에 \"{$wr_subject}\"의 글을 남기셨습니다.\r\n\r\n{$g4[url]}/{$g4[bbs]}/board.php?bo_table={$bo_table}&wr_id={$wr_id}");
}
*/
//------------------------------------------------------------------------------
// 가변 파일 업로드
// 나중에 테이블에 저장하는 이유는 $wr_id 값을 저장해야 하기 때문입니다.
for ($i=0; $i<count($upload); $i++)
{
if (!get_magic_quotes_gpc()) {
$upload[$i]['source'] = addslashes($upload[$i]['source']);
}

$row = sql_fetch(" select count(*) as cnt from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' ");
if ($row[cnt])
{
// 삭제에 체크가 있거나 파일이 있다면 업데이트를 합니다.
// 그렇지 않다면 내용만 업데이트 합니다.
if ($upload[$i][del_check] || $upload[$i][file])
{
$sql = " update $g4[board_file_table]
set bf_source = '{$upload[$i][source]}',
bf_file = '{$upload[$i][file]}',
bf_content = '{$bf_content[$i]}',
bf_filesize = '{$upload[$i][filesize]}',
bf_width = '{$upload[$i][image][0]}',
bf_height = '{$upload[$i][image][1]}',
bf_type = '{$upload[$i][image][2]}',
bf_datetime = '$g4[time_ymdhis]'
where bo_table = '$bo_table'
and wr_id = '$wr_id'
and bf_no = '$i' ";
sql_query($sql);
}
else
{
$sql = " update $g4[board_file_table]
set bf_content = '{$bf_content[$i]}'
where bo_table = '$bo_table'
and wr_id = '$wr_id'
and bf_no = '$i' ";
sql_query($sql);
}
}
else
{
$sql = " insert into $g4[board_file_table]
set bo_table = '$bo_table',
wr_id = '$wr_id',
bf_no = '$i',
bf_source = '{$upload[$i][source]}',
bf_file = '{$upload[$i][file]}',
bf_content = '{$bf_content[$i]}',
bf_download = 0,
bf_filesize = '{$upload[$i][filesize]}',
bf_width = '{$upload[$i][image][0]}',
bf_height = '{$upload[$i][image][1]}',
bf_type = '{$upload[$i][image][2]}',
bf_datetime = '$g4[time_ymdhis]' ";
sql_query($sql);
}
}

// 업로드된 파일 내용에서 가장 큰 번호를 얻어 거꾸로 확인해 가면서
// 파일 정보가 없다면 테이블의 내용을 삭제합니다.
$row = sql_fetch(" select max(bf_no) as max_bf_no from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' ");
for ($i=(int)$row[max_bf_no]; $i>=0; $i--)
{
$row2 = sql_fetch(" select bf_file from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' ");

// 정보가 있다면 빠집니다.
if ($row2[bf_file]) break;

// 그렇지 않다면 정보를 삭제합니다.
sql_query(" delete from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' ");
}
//------------------------------------------------------------------------------

// 비밀글이라면 세션에 비밀글의 아이디를 저장한다. 자신의 글은 다시 패스워드를 묻지 않기 위함
if ($secret)
set_session("ss_secret_{$bo_table}_{$wr_num}", TRUE);

// 메일발송 사용 (수정글은 발송하지 않음)
if (!($w == "u" || $w == "cu") && $config[cf_email_use] && $board[bo_use_email])
{
// 관리자의 정보를 얻고
$super_admin = get_admin("super");
$group_admin = get_admin("group");
$board_admin = get_admin("board");

$wr_subject = get_text(stripslashes($wr_subject));

$tmp_html = 0;
if (strstr($html, "html1"))
$tmp_html = 1;
else if (strstr($html, "html2"))
$tmp_html = 2;

$wr_content = conv_content(stripslashes($wr_content), $tmp_html);

$warr = array( ""=>"입력", "u"=>"수정", "r"=>"답변", "c"=>"코멘트", "cu"=>"코멘트 수정" );
$str = $warr[$w];

$subject = "'{$board[bo_subject]}' 게시판에 {$str}글이 올라왔습니다.";
$link_url = "$g4[url]/$g4[bbs]/board.php?bo_table=$bo_table&wr_id=$wr_id&$qstr";

include_once("$g4[path]/lib/mailer.lib.php");

ob_start();
include_once ("./write_update_mail.php");
$content = ob_get_contents();
ob_end_clean();

$array_email = array();
// 게시판관리자에게 보내는 메일
if ($config[cf_email_wr_board_admin]) $array_email[] = $board_admin[mb_email];
// 게시판그룹관리자에게 보내는 메일
if ($config[cf_email_wr_group_admin]) $array_email[] = $group_admin[mb_email];
// 최고관리자에게 보내는 메일
if ($config[cf_email_wr_super_admin]) $array_email[] = $super_admin[mb_email];

// 옵션에 메일받기가 체크되어 있고, 게시자의 메일이 있다면
if (strstr($wr[wr_option], "mail") && $wr[wr_email]) {
// 원글 메일발송에 체크가 되어 있다면
if ($config[cf_email_wr_write]) $array_email[] = $wr[wr_email];

// 코멘트 쓴 모든이에게 메일 발송이 되어 있다면 (자신에게는 발송하지 않는다)
if ($config[cf_email_wr_comment_all]) {
$sql = " select distinct wr_email from $write_table
where wr_email not in ( '$wr[wr_email]', '$member[mb_email]', '' )
and wr_parent = '$wr_id' ";
$result = sql_query($sql);
while ($row=sql_fetch_array($result))
$array_email[] = $row[wr_email];
}
}

// 중복된 메일 주소는 제거
$unique_email = array_unique($array_email);
$unique_email = array_values($unique_email);
for ($i=0; $i<count($unique_email); $i++) {
mailer($wr_name, $wr_email, $unique_email[$i], $subject, $content, 1);
}
}

// 사용자 코드 실행
@include_once ("$board_skin_path/write_update.skin.php");
include_once("$g4[notice_path]/write_update.tail.php"); //실시간 알림 조상문 2011.10.28

// 트랙백 주소가 있다면
if (($w != "u" && $wr_trackback) || ($w=="u" && $wr_trackback && $re_trackback))
{
$trackback_url = "$g4[url]/$g4[bbs]/tb.php/$bo_table/$wr_id";
$msg = "";
$msg = send_trackback($wr_trackback, $trackback_url, $wr_subject, $board[bo_subject], $_POST[wr_content]);
if ($msg) {
echo "<meta http-equiv='content-type' content='text/html; charset={$g4['charset']}'>\n";
echo "<script type='text/javascript'>alert('$msg $wr_trackback');</script>";
}
}

@include_once("$board_skin_path/write_update.tail.skin.php");

if ($g4[https_url])
$https_url = "$g4[url]/$g4[bbs]";
else
$https_url = ".";

if ($file_upload_msg)
alert($file_upload_msg, "{$https_url}/board.php?bo_table=$bo_table&wr_id=$wr_id&page=$page" . $qstr);
else
goto_url("{$https_url}/board.php?bo_table=$bo_table&wr_id=$wr_id&page=$page" . $qstr);
?>


일단 테러보이님 팁은 주석처리해두었습니다.
원격확인결과 모듈이 제대로 불러와지지 않아 발생한 에러였습니다.
수정조취 해드렸습니다.
감사합니다~
추천드립니다. 멋집니다.
네이트온 알림 플러그인
와, 이런! 항상 필요하다고 느끼는 기능을 이렇게 구현해주시니 감사할따름입니다 +ㅁ+ 추천 !
저도 감사합니다.
우와 감사합니다~~ 강추 !!
boy님~ 작동이안되요~ ㅜㅜ
bbs/write_update.php 전문을 보내드릴게요
<?
$g4[title] = $wr_subject . "글입력";
include_once("./_common.php");

@include_once("$board_skin_path/write_update.head.skin.php");

include_once("$g4[path]/lib/trackback.lib.php");

/*
$filters = explode(",", $config[cf_filter]);
for ($i=0; $i<count($filters); $i++) {
$s = trim($filters[$i]); // 필터단어의 앞뒤 공백을 없앰
if (stristr($wr_subject, $s)) {
alert("제목에 금지단어(\'{$s}\')가 포함되어 있습니다.");
exit;
}
if (stristr($wr_content, $s)) {
alert("내용에 금지단어(\'{$s}\')가 포함되어 있습니다.");
exit;
}
}
*/

$upload_max_filesize = ini_get('upload_max_filesize');

if (empty($_POST))
alert("파일 또는 글내용의 크기가 서버에서 설정한 값을 넘어 오류가 발생하였습니다.\\n\\npost_max_size=".ini_get('post_max_size')." , upload_max_filesize=$upload_max_filesize\\n\\n게시판관리자 또는 서버관리자에게 문의 바랍니다.");

// 리퍼러 체크
//referer_check();

$w = $_POST["w"];

$notice_array = explode("\n", trim($board[bo_notice]));

if ($w == "u" || $w == "r") {
$wr = get_write($write_table, $wr_id);
if (!$wr[wr_id])
alert("글이 존재하지 않습니다.\\n\\n글이 삭제되었거나 이동하였을 수 있습니다.");
}

// 외부에서 글을 등록할 수 있는 버그가 존재하므로 비밀글은 사용일 경우에만 가능해야 함
if (!$is_admin && !$board[bo_use_secret] && $secret)
alert("비밀글 미사용 게시판 이므로 비밀글로 등록할 수 없습니다.");

if ($w == "" || $w == "u") {
// 김선용 1.00 : 글쓰기 권한과 수정은 별도로 처리되어야 함
if($w =="u" && $member['mb_id'] && $wr['mb_id'] == $member['mb_id'])
;
else if ($member[mb_level] < $board[bo_write_level])
alert("글을 쓸 권한이 없습니다.");

// 외부에서 글을 등록할 수 있는 버그가 존재하므로 공지는 관리자만 등록이 가능해야 함
if (!$is_admin && $notice)
alert("관리자만 공지할 수 있습니다.");
}
else if ($w == "r")
{
if (in_array((int)$wr_id, $notice_array))
alert("공지에는 답변 할 수 없습니다.");

if ($member[mb_level] < $board[bo_reply_level])
alert("글을 답변할 권한이 없습니다.");

// 게시글 배열 참조
$reply_array = &$wr;

// 최대 답변은 테이블에 잡아놓은 wr_reply 사이즈만큼만 가능합니다.
if (strlen($reply_array[wr_reply]) == 10)
alert("더 이상 답변하실 수 없습니다.\\n\\n답변은 10단계 까지만 가능합니다.");

$reply_len = strlen($reply_array[wr_reply]) + 1;
if ($board[bo_reply_order]) {
$begin_reply_char = "A";
$end_reply_char = "Z";
$reply_number = +1;
$sql = " select MAX(SUBSTRING(wr_reply, $reply_len, 1)) as reply from $write_table where wr_num = '$reply_array[wr_num]' and SUBSTRING(wr_reply, $reply_len, 1) <> '' ";
} else {
$begin_reply_char = "Z";
$end_reply_char = "A";
$reply_number = -1;
$sql = " select MIN(SUBSTRING(wr_reply, $reply_len, 1)) as reply from $write_table where wr_num = '$reply_array[wr_num]' and SUBSTRING(wr_reply, $reply_len, 1) <> '' ";
}
if ($reply_array[wr_reply]) $sql .= " and wr_reply like '$reply_array[wr_reply]%' ";
$row = sql_fetch($sql);

if (!$row[reply])
$reply_char = $begin_reply_char;
else if ($row[reply] == $end_reply_char) // A~Z은 26 입니다.
alert("더 이상 답변하실 수 없습니다.\\n\\n답변은 26개 까지만 가능합니다.");
else
$reply_char = chr(ord($row[reply]) + $reply_number);

$reply = $reply_array[wr_reply] . $reply_char;
} else
alert("w 값이 제대로 넘어오지 않았습니다.");


if ($w == "" || $w == "r")
{
if ($_SESSION["ss_datetime"] >= ($g4[server_time] - $config[cf_delay_sec]) && !$is_admin)
alert("너무 빠른 시간내에 게시물을 연속해서 올릴 수 없습니다.");

set_session("ss_datetime", $g4[server_time]);

// 동일내용 연속 등록 불가
$row = sql_fetch(" select MD5(CONCAT(wr_ip, wr_subject, wr_content)) as prev_md5 from $write_table order by wr_id desc limit 1 ");
$curr_md5 = md5($_SERVER[REMOTE_ADDR].$wr_subject.$wr_content);
if ($row[prev_md5] == $curr_md5 && !$is_admin)
alert("동일한 내용을 연속해서 등록할 수 없습니다.");
}

// 자동등록방지 검사
//include_once ("./norobot_check.inc.php");

if (!$is_member) {
if ($w=='' || $w=='r') {
$key = get_session("captcha_keystring");
if (!($key && $key == $_POST[wr_key])) {
session_unregister("captcha_keystring");
alert("정상적인 접근이 아닌것 같습니다.");
}
}
}

if (!isset($_POST[wr_subject]) || !trim($_POST[wr_subject]))
alert("제목을 입력하여 주십시오.");

// 디렉토리가 없다면 생성합니다. (퍼미션도 변경하구요.)
@mkdir("$g4[path]/data/file/$bo_table", 0707);
@chmod("$g4[path]/data/file/$bo_table", 0707);

// "인터넷옵션 > 보안 > 사용자정의수준 > 스크립팅 > Action 스크립팅 > 사용 안 함" 일 경우의 오류 처리
// 이 옵션을 사용 안 함으로 설정할 경우 어떤 스크립트도 실행 되지 않습니다.
//if (!$_POST[wr_content]) die ("내용을 입력하여 주십시오.");

$chars_array = array_merge(range(0,9), range('a','z'), range('A','Z'));
//print_r2($chars_array); exit;




//==================================================================================
// 가변 파일 업로드
//==================================================================================
$file_upload_msg = "";
$upload = array();
for ($i=0; $i<count($_FILES[bf_file][name]); $i++)
{
// 삭제에 체크가 되어있다면 파일을 삭제합니다.
if ($_POST[bf_file_del][$i])
{
$upload[$i][del_check] = true;

$row = sql_fetch(" select bf_file from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' ");
@unlink("$g4[path]/data/file/$bo_table/$row[bf_file]");
}
else
$upload[$i][del_check] = false;

$tmp_file = $_FILES[bf_file][tmp_name][$i];
$filename = $_FILES[bf_file][name][$i];
$filesize = $_FILES[bf_file][size][$i];

// 서버에 설정된 값보다 큰파일을 업로드 한다면
if ($filename)
{
if ($_FILES[bf_file][error][$i] == 1)
{
$file_upload_msg .= "\'{$filename}\' 파일의 용량이 서버에 설정($upload_max_filesize)된 값보다 크므로 업로드 할 수 없습니다.\\n";
continue;
}
else if ($_FILES[bf_file][error][$i] != 0)
{
$file_upload_msg .= "\'{$filename}\' 파일이 정상적으로 업로드 되지 않았습니다.\\n";
continue;
}
}

if (is_uploaded_file($tmp_file))
{
// 관리자가 아니면서 설정한 업로드 사이즈보다 크다면 건너뜀
if (!$is_admin && $filesize > $board[bo_upload_size])
{
$file_upload_msg .= "\'{$filename}\' 파일의 용량(".number_format($filesize)." 바이트)이 게시판에 설정(".number_format($board[bo_upload_size])." 바이트)된 값보다 크므로 업로드 하지 않습니다.\\n";
continue;
}

// 4.00.11 - 글답변에서 파일 업로드시 원글의 파일이 삭제되는 오류를 수정
if ($w == 'u')
{
// 존재하는 파일이 있다면 삭제합니다.
$row = sql_fetch(" select bf_file from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' ");
@unlink("$g4[path]/data/file/$bo_table/$row[bf_file]");
}

// 프로그램 원래 파일명
$upload[$i][source] = $filename;
$upload[$i][filesize] = $filesize;

// 아래의 문자열이 들어간 파일은 -x 를 붙여서 웹경로를 알더라도 실행을 하지 못하도록 함
$filename = preg_replace("/\.(php|phtm|htm|cgi|pl|exe|jsp|asp|inc)/i", "$0-x", $filename);

// 접미사를 붙인 파일명
//$upload[$i][file] = abs(ip2long($_SERVER[REMOTE_ADDR])).'_'.substr(md5(uniqid($g4[server_time])),0,8).'_'.urlencode($filename);
// 달빛온도님 수정 : 한글파일은 urlencode($filename) 처리를 할경우 '%'를 붙여주게 되는데 '%'표시는 미디어플레이어가 인식을 못하기 때문에 재생이 안됩니다. 그래서 변경한 파일명에서 '%'부분을 빼주면 해결됩니다.
//$upload[$i][file] = abs(ip2long($_SERVER[REMOTE_ADDR])).'_'.substr(md5(uniqid($g4[server_time])),0,8).'_'.str_replace('%', '', urlencode($filename));
shuffle($chars_array);
$shuffle = implode("", $chars_array);
$upload[$i][file] = abs(ip2long($_SERVER[REMOTE_ADDR])).'_'.substr($shuffle,0,8).'_'.str_replace('%', '', urlencode($filename));

$dest_file = "$g4[path]/data/file/$bo_table/" . $upload[$i][file];

// 업로드가 안된다면 에러메세지 출력하고 죽어버립니다.
$error_code = move_uploaded_file($tmp_file, $dest_file) or die($_FILES[bf_file][error][$i]);

// 올라간 파일의 퍼미션을 변경합니다.
chmod($dest_file, 0606);

$upload[$i][image] = @getimagesize($dest_file);

}
}

if ($w == "" || $w == "r")
{
if ($member[mb_id])
{
$mb_id = $member[mb_id];
$wr_name = $board[bo_use_name] ? $member[mb_name] : $member[mb_nick];
$wr_password = $member[mb_password];
$wr_email = $member[mb_email];
$wr_homepage = $member[mb_homepage];
}
else
{
$mb_id = "";
// 비회원의 경우 이름이 누락되는 경우가 있음
if (!trim($wr_name))
alert("이름은 필히 입력하셔야 합니다.");
$wr_password = sql_password($wr_password);
}

if ($w == "r")
{
// 답변의 원글이 비밀글이라면 패스워드는 원글과 동일하게 넣는다.
if ($secret)
$wr_password = $wr[wr_password];

$wr_id = $wr_id . $reply;
$wr_num = $write[wr_num];
$wr_reply = $reply;
}
else
{
$wr_num = get_next_num($write_table);
$wr_reply = "";
}

$sql = " insert into $write_table
set wr_num = '$wr_num',
wr_reply = '$wr_reply',
wr_comment = 0,
ca_name = '$ca_name',
wr_option = '$html,$secret,$mail',
wr_subject = '$wr_subject',
wr_content = '$wr_content',
wr_link1 = '$wr_link1',
wr_link2 = '$wr_link2',
wr_link1_hit = 0,
wr_link2_hit = 0,
wr_trackback = '$wr_trackback',
wr_hit = 0,
wr_good = 0,
wr_nogood = 0,
mb_id = '$member[mb_id]',
wr_password = '$wr_password',
wr_name = '$wr_name',
wr_email = '$wr_email',
wr_homepage = '$wr_homepage',
wr_datetime = '$g4[time_ymdhis]',
wr_last = '$g4[time_ymdhis]',
wr_ip = '$_SERVER[REMOTE_ADDR]',
wr_1 = '$wr_1',
wr_2 = '$wr_2',
wr_3 = '$wr_3',
wr_4 = '$wr_4',
wr_5 = '$wr_5',
wr_6 = '$wr_6',
wr_7 = '$wr_7',
wr_8 = '$wr_8',
wr_9 = '$wr_9',
wr_10 = '$wr_10' ";
sql_query($sql);

$wr_id = mysql_insert_id();

// 부모 아이디에 UPDATE
sql_query(" update $write_table set wr_parent = '$wr_id' where wr_id = '$wr_id' ");

// 새글 INSERT
//sql_query(" insert into $g4[board_new_table] ( bo_table, wr_id, wr_parent, bn_datetime ) values ( '$bo_table', '$wr_id', '$wr_id', '$g4[time_ymdhis]' ) ");
sql_query(" insert into $g4[board_new_table] ( bo_table, wr_id, wr_parent, bn_datetime, mb_id ) values ( '$bo_table', '$wr_id', '$wr_id', '$g4[time_ymdhis]', '$member[mb_id]' ) ");

// 게시글 1 증가
sql_query("update $g4[board_table] set bo_count_write = bo_count_write + 1 where bo_table = '$bo_table'");

// 쓰기 포인트 부여
if ($w == '')
{
if ($notice)
{
$bo_notice = $wr_id . "\n" . $board[bo_notice];
sql_query(" update $g4[board_table] set bo_notice = '$bo_notice' where bo_table = '$bo_table' ");
}

insert_point($member[mb_id], $board[bo_write_point], "$board[bo_subject] $wr_id 글쓰기", $bo_table, $wr_id, '쓰기');
}
else
{
// 답변은 코멘트 포인트를 부여함
// 답변 포인트가 많은 경우 코멘트 대신 답변을 하는 경우가 많음
insert_point($member[mb_id], $board[bo_comment_point], "$board[bo_subject] $wr_id 글답변", $bo_table, $wr_id, '쓰기');
}
}
else if ($w == "u")
{
if ($member[mb_id])
{
// 자신의 글이라면
if ($member[mb_id] == $wr[mb_id])
{
$mb_id = $member[mb_id];
$wr_name = $board[bo_use_name] ? $member[mb_name] : $member[mb_nick];
$wr_email = $member[mb_email];
$wr_homepage = $member[mb_homepage];
}
else
{
$mb_id = $wr[mb_id];
$wr_name = $wr[wr_name];
$wr_email = $wr[wr_email];
$wr_homepage = $wr[wr_homepage];
}
}
else
{
$mb_id = "";
// 비회원의 경우 이름이 누락되는 경우가 있음
//if (!trim($wr_name)) alert("이름은 필히 입력하셔야 합니다.");
}

$sql_password = $wr_password ? " , wr_password = '".sql_password($wr_password)."' " : "";

$sql_ip = "";
if (!$is_admin)
$sql_ip = " , wr_ip = '$_SERVER[REMOTE_ADDR]' ";

$sql = " update $write_table
set ca_name = '$ca_name',
wr_option = '$html,$secret,$mail',
wr_subject = '$wr_subject',
wr_content = '$wr_content',
wr_link1 = '$wr_link1',
wr_link2 = '$wr_link2',
mb_id = '$mb_id',
wr_name = '$wr_name',
wr_email = '$wr_email',
wr_homepage = '$wr_homepage',
wr_1 = '$wr_1',
wr_2 = '$wr_2',
wr_3 = '$wr_3',
wr_4 = '$wr_4',
wr_5 = '$wr_5',
wr_6 = '$wr_6',
wr_7 = '$wr_7',
wr_8 = '$wr_8',
wr_9 = '$wr_9',
wr_10= '$wr_10'
$sql_ip
$sql_password
where wr_id = '$wr[wr_id]' ";
sql_query($sql);

// 분류가 수정되는 경우 해당되는 코멘트의 분류명도 모두 수정함
// 코멘트의 분류를 수정하지 않으면 검색이 제대로 되지 않음
$sql = " update $write_table set ca_name = '$ca_name' where wr_parent = '$wr[wr_id]' ";
sql_query($sql);

if ($notice)
{
//if (!preg_match("/[^0-9]{0,1}{$wr_id}[\r]{0,1}/",$board[bo_notice]))
if (!in_array((int)$wr_id, $notice_array))
{
$bo_notice = $wr_id . '\n' . $board[bo_notice];
sql_query(" update $g4[board_table] set bo_notice = '$bo_notice' where bo_table = '$bo_table' ");
}
}
else
{
$bo_notice = '';
for ($i=0; $i<count($notice_array); $i++)
if ((int)$wr_id != (int)$notice_array[$i])
$bo_notice .= $notice_array[$i] . '\n';
$bo_notice = trim($bo_notice);
//$bo_notice = preg_replace("/^".$wr_id."[\n]?$/m", "", $board[bo_notice]);
sql_query(" update $g4[board_table] set bo_notice = '$bo_notice' where bo_table = '$bo_table' ");
}
}

//네이트온 알림추가


// 네이트온 전송
if($board[bo_10] == "nateon send"){ // 네이트온 사용 게시판인지 판별
// 자동 추출
$auto_if = '<iframe src="http://api.nateon.nate.com/web/buddy/ViewPlugin.do?v=BSSB4edVskwm-GyWs-kxrMRHScqtmKH__HhToLb_yr4kW1T1E3RcN801Brr2Gtf3NeW47FL-ac358exJ37FPB_wXwOWM7dFPjvnuRCoqyGpbKoWZc-FouSFlKGtIpH0MwetnedTfH0h3XHGqatLgsFPOzY3y_AflcAVpyKnb3C6TAccm23cOJ2GkWQCqTxR4" width="135" height="43" marginwidth="0" marginheight="0" frameborder="0" scrolling="no"></iframe>'; // http://devsquare.nate.com/openApi/NateOnAddBuddyButton 에서 발급된소스 삽입
$auto_url = @explode("<iframe src=\"", $auto_if);
$auto_url = @explode("\" width=\"", $auto_url[1]);
$auto_url = $auto_url[0];
include_once("$g4[path]/module/send_nateon/nateon.lib.php"); // lib로드
nateon($auto_url, $board[bo_9], "{$wr_name}님께서 {$board[bo_subject]} 게시판에 \"{$wr_subject}\"의 글을 남기셨습니다.\r\n\r\n{$g4[url]}/{$g4[bbs]}/board.php?bo_table={$bo_table}&wr_id={$wr_id}");
}



//------------------------------------------------------------------------------
// 가변 파일 업로드
// 나중에 테이블에 저장하는 이유는 $wr_id 값을 저장해야 하기 때문입니다.
for ($i=0; $i<count($upload); $i++)
{
$row = sql_fetch(" select count(*) as cnt from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' ");
if ($row[cnt])
{
// 삭제에 체크가 있거나 파일이 있다면 업데이트를 합니다.
// 그렇지 않다면 내용만 업데이트 합니다.
if ($upload[$i][del_check] || $upload[$i][file])
{
$sql = " update $g4[board_file_table]
set bf_source = '{$upload[$i][source]}',
bf_file = '{$upload[$i][file]}',
bf_content = '{$bf_content[$i]}',
bf_filesize = '{$upload[$i][filesize]}',
bf_width = '{$upload[$i][image][0]}',
bf_height = '{$upload[$i][image][1]}',
bf_type = '{$upload[$i][image][2]}',
bf_datetime = '$g4[time_ymdhis]'
where bo_table = '$bo_table'
and wr_id = '$wr_id'
and bf_no = '$i' ";
sql_query($sql);
}
else
{
$sql = " update $g4[board_file_table]
set bf_content = '{$bf_content[$i]}'
where bo_table = '$bo_table'
and wr_id = '$wr_id'
and bf_no = '$i' ";
sql_query($sql);
}
}
else
{
$sql = " insert into $g4[board_file_table]
set bo_table = '$bo_table',
wr_id = '$wr_id',
bf_no = '$i',
bf_source = '{$upload[$i][source]}',
bf_file = '{$upload[$i][file]}',
bf_content = '{$bf_content[$i]}',
bf_download = 0,
bf_filesize = '{$upload[$i][filesize]}',
bf_width = '{$upload[$i][image][0]}',
bf_height = '{$upload[$i][image][1]}',
bf_type = '{$upload[$i][image][2]}',
bf_datetime = '$g4[time_ymdhis]' ";
sql_query($sql);
}
}

// 업로드된 파일 내용에서 가장 큰 번호를 얻어 거꾸로 확인해 가면서
// 파일 정보가 없다면 테이블의 내용을 삭제합니다.
$row = sql_fetch(" select max(bf_no) as max_bf_no from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' ");
for ($i=(int)$row[max_bf_no]; $i>=0; $i--)
{
$row2 = sql_fetch(" select bf_file from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' ");

// 정보가 있다면 빠집니다.
if ($row2[bf_file]) break;

// 그렇지 않다면 정보를 삭제합니다.
sql_query(" delete from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' ");
}
//------------------------------------------------------------------------------

// 비밀글이라면 세션에 비밀글의 아이디를 저장한다. 자신의 글은 다시 패스워드를 묻지 않기 위함
if ($secret)
set_session("ss_secret_{$bo_table}_{$wr_num}", TRUE);

// 메일발송 사용 (수정글은 발송하지 않음)
if (!($w == "u" || $w == "cu") && $config[cf_email_use] && $board[bo_use_email])
{
// 관리자의 정보를 얻고
$super_admin = get_admin("super");
$group_admin = get_admin("group");
$board_admin = get_admin("board");

$wr_subject = get_text(stripslashes($wr_subject));

$tmp_html = 0;
if (strstr($html, "html1"))
$tmp_html = 1;
else if (strstr($html, "html2"))
$tmp_html = 2;

$wr_content = conv_content(stripslashes($wr_content), $tmp_html);

$warr = array( ""=>"입력", "u"=>"수정", "r"=>"답변", "c"=>"코멘트", "cu"=>"코멘트 수정" );
$str = $warr[$w];

$subject = "'{$board[bo_subject]}' 게시판에 {$str}글이 올라왔습니다.";
$link_url = "$g4[url]/$g4[bbs]/board.php?bo_table=$bo_table&wr_id=$wr_id&$qstr";

include_once("$g4[path]/lib/mailer.lib.php");

ob_start();
include_once ("./write_update_mail.php");
$content = ob_get_contents();
ob_end_clean();

// 게시판관리자에게 보내는 메일
if ($config[cf_email_wr_board_admin])
mailer($wr_name, $wr_email, $board_admin[mb_email], $subject, $content, 1);

// 그룹관리자에게 보내는 메일
if ($group_admin[mb_email] != $board_admin[mb_email])
{
if ($config[cf_email_wr_group_admin])
mailer($wr_name, $wr_email, $group_admin[mb_email], $subject, $content, 1);
}

// 최고관리자에게 보내는 메일
if ($super_admin[mb_email] != $board_admin[mb_email])
{
if ($config[cf_email_wr_super_admin])
mailer($wr_name, $wr_email, $super_admin[mb_email], $subject, $content, 1);
}

// 답변 메일받기 (원게시자에게 보내는 메일)
if (strstr($wr[wr_option], "mail") && $wr[wr_email] && $wr[wr_email] != $admin[mb_email])
{
if ($config[cf_email_wr_write])
mailer($wr_name, $wr_email, $wr[wr_email], $subject, $content, 1);

// 코멘트 쓴 모든이에게 메일 발송
if ($config[cf_email_wr_comment_all])
{
$sql = " select distinct wr_email from $write_table
where wr_email not in ( '$wr[wr_email]', '' )
and wr_parent = '$wr_id' ";
$result = sql_query($sql);
while ($row=sql_fetch_array($result))
mailer($wr_name, $wr_email, $row[wr_email], $subject, $content, 1);
}
}
}

// 사용자 코드 실행
@include_once ("$board_skin_path/write_update.skin.php");

// 트랙백 주소가 있다면
if (($w != "u" && $wr_trackback) || ($w=="u" && $wr_trackback && $re_trackback))
{
$trackback_url = "$g4[url]/$g4[bbs]/tb.php/$bo_table/$wr_id";
$msg = "";
$msg = send_trackback($wr_trackback, $trackback_url, $wr_subject, $board[bo_subject], $_POST[wr_content]);
if ($msg)
echo "<script language='JavaScript'>alert('$msg $wr_trackback');</script>";
}

@include_once("$board_skin_path/write_update.tail.skin.php");

if ($g4[https_url])
$https_url = "$g4[url]/$g4[bbs]";
else
$https_url = ".";

if ($file_upload_msg)
alert($file_upload_msg, "{$https_url}/board.php?bo_table=$bo_table&wr_id=$wr_id&page=$page" . $qstr);
else
goto_url("{$https_url}/board.php?bo_table=$bo_table&wr_id=$wr_id&page=$page" . $qstr);
?>
전왜;;
}
// 네이트온 전송
if($board[bo_10] == "nateon send"){ // 네이트온 사용 게시판인지 판별
// 자동 추출
$auto_if = '<iframe src="http://api.nateon.nate.com/web/buddy/ViewPlugin.do?v=uZSTzttKmlyUekS4nZMDpX5dHWQlMuo2vQA3jJtHIILVi9KEvSkNminde2fnGsroiiMTonGUE6Jp-XYwIvAaifZM6xGAa0EYbVpe9dT2VJNxZ6mqgdnQk7BpP7-7eJVlG6siM-R-ngRFP7yGGxJwAw" width="135" height="43" marginwidth="0" marginheight="0" frameborder="0" scrolling="no"></iframe>'; // http://devsquare.nate.com/openApi/NateOnAddBuddyButton 에서 발급된소스 삽입
$auto_url = @explode("<iframe src=\"", $auto_if);
$auto_url = @explode("\" width=\"", $auto_url[1]);
$auto_url = $auto_url[0];
include_once("$g4[path]/module/send_nateon/nateon.lib.php"); // lib로드
nateon($auto_url, $board[bo_9], "{$wr_name}님께서 {$board[bo_subject]} 게시판에 \"{$wr_subject}\"의 글을 남기셨습니다.\r\n\r\n{$g4[url]}/{$g4[bbs]}/board.php?bo_table={$bo_table}&wr_id={$wr_id}");
}

이렇게해도 안될까요? 게시판 다적용했는데 ㅎㅎ
개인사정으로 더이상 질문 및 피드 받지 않습니다.
질문게시판을 이용바랍니다.
안되시는분은 3번에서 복사한 소스에서 주소를 복사하여 소스보기를 하신다음.
cmn=?????&pversion
Cmn값을 복사 한다음
nateon.lib.php파일의 cmn=".$nate_code."에 ".$nate_code."를 지우시고 복사한값을 붙여넣으세요.
이거 혹시 지금도 되나요?? 마이피플은 되는데 요건 아무리 해봐도 실패뜨네요~
테스트 결과 : 비정상적인 접근입니다.
위 메세지가 나오는걸 보니 네이트에서 막은듯 ㅎㅎ;
네이트측에서 제공하는 api의 방식중 강제로 추출한 코드로 사용을 했으나... 정책이 변경되면서 차단된것으로 보입니다..
으아니... 아직 실험도 못해봣는데 네이트에서 막아버리다니.. 아아 ..

게시글 목록

번호 제목
12474
12471
12469
12468
12467
12463
12462
12461
12455
12454
12451
12449
12446
12445
12441