B

php파일에서 댓글쓰기

· 2013-03-12 (화) 19:10:21 · 4043 · 1
필요해서 급하게 만들어서 소스가 개판일수도있습니다.

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 팁자료실

3,309건

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

+
제목 글쓴이 날짜 조회
13-03-29 조회 5,729
13-03-27 조회 1.4만
13-03-27 조회 5,465
13-03-27 조회 6,612
13-03-20 조회 4,785
13-03-19 조회 5,315
13-03-19 조회 5,836
13-03-17 조회 5,401
13-03-14 조회 8,677
13-03-13 조회 5,437
13-03-13 조회 4,840
13-03-12 조회 4,044
13-03-12 조회 6,705
13-03-11 조회 3,723
13-03-09 조회 4,953
13-03-09 조회 6,036
13-03-07 조회 6,975
13-03-06 조회 1.9만
13-03-06 조회 5,614
13-03-05 조회 5,572