글 작성자에게 wr_1값의 특정 %만 포인트 지급
본문
안녕하세요.
우선 다들 새해 복 많이 받으세요~
고수님들의 도움이 필요해서 질문 남겨봅니다.
질문게시판이랑 팁게시판 참고해서 현재 링크1을 클릭시 wr_1값에 입력한만큼 클릭한 회원의 포인트가 차감되는걸 만들었는대요.
클릭수만큼 wr_1값에 포인트를 글 작성자에게는 지급도 하고 있습니다.
제가 만들고자하는 기능은,
현재 다른회원이 링크 클릭시 wr_1값에 입력한만큼 글 작성자에게 포인트가 지급되는대
수수료 형식으로 wr_1에 입력한 값의 90%나 95% 정도만 글작성자에게 지급하고 싶은대요.
제가 프로그래밍을 하나도 모르는 쌩초보라 도움 주실 수 있는 고수님들 계시면 도움 간절히 청해봅니다.
감사합니다.
[저의 link.php 내용]
<?php
include_once('./_common.php');
$html_title = '링크 > '.conv_subject($write['wr_subject'], 255);
if (!($bo_table && $wr_id && $no))
alert_close('값이 제대로 넘어오지 않았습니다.');
// SQL Injection 예방
$row = sql_fetch(" select count(*) as cnt from {$g5['write_prefix']}{$bo_table} ", FALSE);
if (!$row['cnt'])
alert_close('존재하는 게시판이 아닙니다.');
if (!$write['wr_link'.$no])
alert_close('링크가 없습니다.');
$ss_name = 'ss_link_'.$bo_table.'_'.$wr_id.'_'.$no;
if (empty($_SESSION[$ss_name]))
{
insert_point($write['mb_id'], $write['wr_1'], ((G5_IS_MOBILE && $board['bo_mobile_subject']) ? $board['bo_mobile_subject'] : $member['mb_nick']).'님이 자료 다운로드', $bo_table, $wr_id, $member['mb_id'].'업로드');
insert_point($member['mb_id'], -$write['wr_1'], ((G5_IS_MOBILE && $board['bo_mobile_subject']) ? $board['bo_mobile_subject'] : $board['bo_subject']).' '.$wr_id.' 다운로드', $bo_table, $wr_id, '다운로드');
$sql = " update {$g5['write_prefix']}{$bo_table} set wr_link{$no}_hit = wr_link{$no}_hit + 1 where wr_id = '{$wr_id}' ";
sql_query($sql);
set_session($ss_name, true);
}
goto_url(set_http($write['wr_link'.$no]));
?>
답변 1
//클릭하신분은 wr_1 값이 나가고 글쓰신분은 해당 퍼센트만 받게
insert_point($write['mb_id'], $write['wr_1'], ((G5_IS_MOBILE && $board['bo_mobile_subject']) ? $board['bo_mobile_subject'] : $member['mb_nick']).'님이 자료 다운로드', $bo_table, $wr_id, $member['mb_id'].'업로드');
insert_point($member['mb_id'], -$write['wr_1'], ((G5_IS_MOBILE && $board['bo_mobile_subject']) ? $board['bo_mobile_subject'] : $board['bo_subject']).' '.$wr_id.' 다운로드', $bo_table, $wr_id, '다운로드');
부분을 아래와 같이 변경해 주세요
//$point1=intval( intval($write[wr_1]) * (해당 퍼센트 /100) ) ;
$point1=intval( intval($write[wr_1]) * (90 /100) ) ;
//insert_point($write['mb_id'], $write['wr_1'], ((G5_IS_MOBILE && $board['bo_mobile_subject']) ? $board['bo_mobile_subject'] : $member['mb_nick']).'님이 자료 다운로드', $bo_table, $wr_id, $member['mb_id'].'업로드');
insert_point($write['mb_id'], $point1, ((G5_IS_MOBILE && $board['bo_mobile_subject']) ? $board['bo_mobile_subject'] : $member['mb_nick']).'님이 자료 다운로드', $bo_table, $wr_id, $member['mb_id'].'업로드');
insert_point($member['mb_id'], -$write['wr_1'], ((G5_IS_MOBILE && $board['bo_mobile_subject']) ? $board['bo_mobile_subject'] : $board['bo_subject']).' '.$wr_id.' 다운로드', $bo_table, $wr_id, '다운로드');
클릭하시는 분 수수료도해당 퍼센트로 변경하시고 싶으시면
insert_point($member['mb_id'], -$write['wr_1'], ((G5_IS_MOBILE && $board['bo_mobile_subject']) ? $board['bo_mobile_subject'] : $board['bo_subject']).' '.$wr_id.' 다운로드', $bo_table, $wr_id, '다운로드');
을
insert_point($member['mb_id'], ($point*-1), ((G5_IS_MOBILE && $board['bo_mobile_subject']) ? $board['bo_mobile_subject'] : $board['bo_subject']).' '.$wr_id.' 다운로드', $bo_table, $wr_id, '다운로드');
변경하시면 됩니다