insert_point 펑션 변형좀..부탁드려요 정보
insert_point 펑션 변형좀..부탁드려요본문
// 포인트 부여
function insert_point($mb_id, $point, $content='', $rel_table='', $rel_id='', $rel_action='')
{
global $config;
global $g4;
global $is_admin;
// 포인트 사용을 하지 않는다면 return
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[mb_id]) { return 0; }
// 이미 등록된 내역이라면 건너뜀
if ($rel_table || $rel_id || $rel_action)
{
$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'
and po_rel_action = '$rel_action' ";
$row = sql_fetch($sql);
if ($row[cnt])
return -1;
}
// 포인트 건별 생성
$sql = " insert into $g4[point_table]
set mb_id = '$mb_id',
po_datetime = '$g4[time_ymdhis]',
po_content = '".addslashes($content)."',
po_point = '$point',
po_rel_table = '$rel_table',
po_rel_id = '$rel_id',
po_rel_action = '$rel_action' ";
sql_query($sql);
// 포인트 내역의 합을 구하고
$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];
// 포인트 UPDATE
$sql = " update $g4[member_table] set mb_point = '$sum_point' where mb_id = '$mb_id' ";
sql_query($sql);
return 1;
}
po_point2 라는 필드로 포인트가 들어가도록 설정하고싶습니다.
function insert_point($mb_id, $point, $content='', $rel_table='', $rel_id='', $rel_action='')
{
global $config;
global $g4;
global $is_admin;
// 포인트 사용을 하지 않는다면 return
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[mb_id]) { return 0; }
// 이미 등록된 내역이라면 건너뜀
if ($rel_table || $rel_id || $rel_action)
{
$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'
and po_rel_action = '$rel_action' ";
$row = sql_fetch($sql);
if ($row[cnt])
return -1;
}
// 포인트 건별 생성
$sql = " insert into $g4[point_table]
set mb_id = '$mb_id',
po_datetime = '$g4[time_ymdhis]',
po_content = '".addslashes($content)."',
po_point = '$point',
po_rel_table = '$rel_table',
po_rel_id = '$rel_id',
po_rel_action = '$rel_action' ";
sql_query($sql);
// 포인트 내역의 합을 구하고
$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];
// 포인트 UPDATE
$sql = " update $g4[member_table] set mb_point = '$sum_point' where mb_id = '$mb_id' ";
sql_query($sql);
return 1;
}
po_point2 라는 필드로 포인트가 들어가도록 설정하고싶습니다.
댓글 전체
이거.. 어드민에서는 포인트추가되는데요
[제가 바꾼걸로요]
근데 제가 게시물작성시 올려주려고
write.php 에 insert_point 아래에 넣어줬는데 안올라가더군요 -_ -..
[제가 바꾼걸로요]
근데 제가 게시물작성시 올려주려고
write.php 에 insert_point 아래에 넣어줬는데 안올라가더군요 -_ -..
음냐............................
뭐지...
만약에 500 포인트다 있다고 했을 가정하에 50포인트를 지급하면 500은 삭제되버리고 50이되버리네요
그리고 다시 포인트지급하면 정상적으로되구요 ㅠ.ㅠ ;; 이건 왜이러는경우일까요
뭐지...
만약에 500 포인트다 있다고 했을 가정하에 50포인트를 지급하면 500은 삭제되버리고 50이되버리네요
그리고 다시 포인트지급하면 정상적으로되구요 ㅠ.ㅠ ;; 이건 왜이러는경우일까요