B

php파일에서 댓글쓰기

필요해서 급하게 만들어서 소스가 개판일수도있습니다.

extend 폴더에 test.php 만드시고 업로드 하세요 아래소스~

한가지 말씀드리면 extend 는 인크루드 안하셔도 작동합니다.

<?php
function comment($bo_table_f,$wr_id_f,$mb_id_f,$mb_pw_f,$mb_nick_f,$content){
global $g4;

$bo_tbe = 'g4_write_'.$bo_table_f;

$row = "select wr_id ,wr_num,wr_parent,wr_comment from $bo_tbe where wr_id = $wr_id_f and wr_is_comment = 0";
$fetch = sql_fetch($row);

$sql = "insert into $bo_tbe
set wr_num = '".$fetch['wr_num']."',
wr_is_comment = 1,
wr_content = '$content',
wr_link1_hit = 0,
wr_link2_hit = 0,
wr_hit = 0,
wr_good = 0,
wr_nogood = 0,
mb_id = '$mb_id_f',
wr_password = '".sql_password($mb_pw_f)."',
wr_name = '$mb_nick_f',
wr_email = '$wr_email',
wr_datetime = '$g4[time_ymdhis]',
wr_last = '$g4[time_ymdhis]',
wr_ip = '$_SERVER[REMOTE_ADDR]' ";

sql_query($sql);
$wr_id = mysql_insert_id();

sql_query(" update $bo_tbe set wr_parent = '$fetch[wr_parent]' where wr_id = '$wr_id' ");
sql_query(" update $bo_tbe set wr_comment = $fetch[wr_comment] + 1 where wr_id = '$fetch[wr_id]' ");

}
?>

사용법
echo comment('게시판',wr_id번호,'아이디','패스워드','닉네임','코멘트내용');

응용하시면
다른사이트 댓글 파싱해와서 자동으로 올리거나 할수도있습니다.
|

댓글 1개

오 때에따라 좋은 팁이네요~^^
댓글을 작성하시려면 로그인이 필요합니다. 로그인

그누4 팁자료실

그누보드4와 관련된 팁을 여러분들과 함께 공유하세요. 나누면 즐거움이 커집니다.

+
제목 글쓴이 날짜 조회
12년 전 조회 5,218
12년 전 조회 6,389
12년 전 조회 4,534
12년 전 조회 5,088
12년 전 조회 5,571
12년 전 조회 5,139
12년 전 조회 8,477
12년 전 조회 5,182
12년 전 조회 4,571
12년 전 조회 3,834
12년 전 조회 6,445
12년 전 조회 3,493
12년 전 조회 4,733
12년 전 조회 5,803
12년 전 조회 6,671
12년 전 조회 1.9만
12년 전 조회 5,404
12년 전 조회 5,351
12년 전 조회 5,278
12년 전 조회 5,560
🐛 버그신고