천

포인트관련(아이디 대신 닉네임으로 보내기) 질문입니다.

· 2013-02-14 (목) 09:33:46 · 1160 · 3
(ohora님 조언감사드립니다. )
아래 파일을 수정하였습니다.

point_gift.skin.php 파일

<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

$sql = " select count(*) as cnt from $g4[point_table]
where po_rel_table = '@pg'
and mb_id = '$member[mb_id]'
and substring(po_rel_action,1,10) = '{$g4['time_ymd']}' ";
$row = sql_fetch($sql);
$today_cnt = $row[cnt];
?>
<table width="100%" cellpadding="0" cellspacing="0" style="border-top:2px solid cfcfcf;border-bottom:1px solid e5e5e5;">
<form name=fmemoform method=post onsubmit="return fmemoform_submit(this);" autocomplete="off">
<tr>
<td width="120" height="50" valign="top" bgcolor="f4f4f4" style="border-bottom:1px solid e5e5e5;padding-top:8px;padding-left:8px;"><b>받는 사람</b></td>
<td height="50" valign="top" bgcolor="ffffff" style="border-bottom:1px solid f0f0f0;padding-top:8px;padding-left:8px;"><input type="text" name="me_recv_mb_id" size="25" required itemname="받는 사람" value="<?=$me_recv_mb_id?>" />
<p>여러 회원에게 보낼때는 컴마(,)로 구분하세요.</p></td>
</tr>
<tr>
<td width="120" height="50" valign="top" bgcolor="f4f4f4" style="border-bottom:1px solid e5e5e5;padding-top:8px;padding-left:8px;"><b>선물할 포인트</b></td>
<td height="50" valign="top" bgcolor="ffffff" style="border-bottom:1px solid f0f0f0;padding-top:8px;padding-left:8px;"><? if ($me_send_pointm = "on") { ?>
<input type="text" name="me_send_point" size="25" required itemname="선물할 포인트" value="" />
<? } else if ($me_send_pointm ="no") { ?>
<input type="text" name="me_send_point" size="25" required itemname="선물할 포인트" value="" />
<? } ?>
<p>현재 포인트 <?=number_format($member[mb_point])?> 점, 수수료: <?=$point_mon?>%, 1일 <font color="#006666"><b><?=number_format($today_max )?></b></font> 회만 가능하며 (오늘 : <b><font color="#ff0000"><span id="numberup"><?=$today_cnt?></span></b></font> 회)</p></td>
</tr>
<tr>
<td width="120" height="273" valign="top" bgcolor="f4f4f4" style="border-bottom:1px solid e5e5e5;padding-top:8px;padding-left:8px;"><b>메세지</b></td>
<td height="273" valign="top" bgcolor="ffffff" style="border-bottom:1px solid f0f0f0;padding-top:8px;padding-left:8px;"><textarea name=me_memo rows=10 required itemname='내용' style="width:98%; height:263px;"><?=$content?></textarea></td>
</tr>
<!--tr>
<td width="120" height="100" valign="top" bgcolor="f4f4f4" style="border-bottom:1px solid e5e5e5;padding-top:8px;padding-left:8px;"><b>자동등록방지</b></td>
<td height="100" valign="top" bgcolor="ffffff" style="border-bottom:1px solid f0f0f0;padding-top:8px;padding-left:8px;"><img id='kcaptcha_image' /><p><input type=input size=25 name=wr_key itemname="자동등록방지" required>  위쪽의 글자를 입력하세요.</p></td>
</tr-->
<tr>
<td width="100%" height="38" colspan="2" align="right" bgcolor="f4f4f4" style="padding-right:8px;"><INPUT id=btn_submit type=image src="<?=$member_skin_path?>/img/pgift_ok.gif" border=0></td>
</tr>
</form>
</table>

<script type="text/javascript" src="<?="$g4[path]/js/jquery.kcaptcha.js"?>"></script>
<script language="JavaScript">
with (document.fmemoform) {
if (me_recv_mb_id.value == "")
me_recv_mb_id.focus();
else
me_memo.focus();
}

function fmemoform_submit(f)
{

if (f.me_send_point.value.length > 0) {
for (i = 0; i < f.me_send_point.value.length; i++) {
if (f.me_send_point.value.charAt(i) < '0' || f.me_send_point.value.charAt(i) > '9') {
alert(f.me_send_point.value.charAt(i) + "는 숫자가 아닙니다. 숫자만 입력하세요!");
f.me_send_point.focus();
return;
}
}
}
if (f.me_send_point.value < 0 || f.me_send_point.value > <?=$member[mb_point]?>) {
alert("포인트 값은 0보다 크고 <?=$member[mb_point]?>보다 작아야 합니다.");
f.me_send_point.value = "";
f.me_send_point.focus();
return;
}

if (!check_kcaptcha(f.wr_key)) {
return false;
}

document.getElementById("btn_submit").disabled = true;

f.action = "./point_gift_update.php";
f.submit();
}
</script>






소스에서 ohora님의 조언대로

<input type="text" name="me_recv_mb_id" size="25" required itemname="받는 사람" value="<?=$me_recv_mb_id?>" />

부분을 아래와 같이 수정하였습니다.

<input type="hidden" name="me_recv_mb_id" required itemname="받는 사람" value="<?=$me_recv_mb_id?>">
<? $member[mb_nick] = sql_fetch(" select mb_nick from $g4[member_table] where mb_id = '$me_recv_mb_id' ");?>
<input type="text" name="mb_nick" itemname="받는 회원별명" value="<?=$member[mb_nick]?>" >


그런데 문제점이 포인트를 보내도 차감이나 반응이 없이 그냥 전달만 했다고 합니다.
그래서 point_gift.update.php 파일도올려봅니다.


<?
include_once("./_common.php");
//설정 로드
include_once("./pg.setup.php");
$me_send_point = trim($_POST["me_send_point"]);
$me_sendms = $point_mon;
$me_send_points_mb = "no";
$me_sendmscb = $min_point;
$me_sendmsm = 100 - $me_sendms; // 이부분 100이 고정입니다. 손대지마세요.
$me_send_points = (int)($me_send_point * $me_sendmsm / 100);
$me_send_pointsm = $me_send_point - $me_send_points;
if ($me_send_point) {
if ($me_send_point < $me_sendmscb) {
alert("포인트 선물시 최저{$me_sendmscb} 포인트 부터 선물이 가능합니다.");
}
}

if (!$member[mb_id])
alert("회원만 이용하실 수 있습니다.");


$sql = " select count(*) as cnt from $g4[point_table]
where po_rel_table = '@pg'
and mb_id = '$member[mb_id]'
and substring(po_rel_action,1,10) = '{$g4['time_ymd']}' ";
$row = sql_fetch($sql);
$today_cnt = $row[cnt];

if ($today_cnt >= $today_max) {
alert("하루에 선물은 ".$today_max."회만 가능합니다.");
}

$tmp_list = explode(",", $me_recv_mb_id);
$msg = "";
$comma = "";
$mb_list = array();
for ($i=0; $i<count($tmp_list); $i++) {
$row = get_member($tmp_list[$i]);
if (!$row[mb_id] || $row[mb_leave_date] || $row[mb_intercept_date]) {
$msg .= "$comma$tmp_list[$i]";
$comma = ",";
} else {
$mb_list[] = $tmp_list[$i];
$mb_list_nick[] = $row[mb_nick];
$total_spoint = $total_spoint + $me_send_point;
$total_spoints = $total_spoints + $me_send_points;
$total_spointsm = $total_spointsm + $me_send_pointsm;
}
}

if ($msg)
alert($msg . " 은(는) 존재하지 않는 회원아이디 이거나 탈퇴, 접근차단된 회원아이디 입니다.\\n\\n쪽지를 발송하지 않았습니다.");

//★포인트보내기관련추가
if($member[mb_point] < $total_spoint && eregi("-",$member[mb_point]))
alert("포인트가 - 이므로 선물이 불가능 합니다.");

if ($total_spoint && ($total_spoint < 0 || $total_spoint > $member[mb_point]))
alert("보내시려는 총 포인트값({$total_spoint})이 현재 포인트값({$member[mb_point]})을 넘었습니다. \\n\\n발송이 취소되었습니다.");

if ($total_spoint) $me_memo = $me_memo."\n\n\n[{$member[mb_nick]}({$member[mb_id]})님의 포인트 선물받음 : ".$me_send_points."]";

for ($i=0; $i<count($mb_list); $i++) {
if (trim($mb_list[$i])) {

$tmp_row = sql_fetch(" select max(me_id) as max_me_id from $g4[memo_table] ");
$me_id = $tmp_row[max_me_id] + 1;

// 쪽지 INSERT
$sql = " insert into $g4[memo_table]
( me_id, me_recv_mb_id, me_send_mb_id, me_send_datetime, me_memo )
values ( '$me_id', '$mb_list[$i]', '$member[mb_id]', '$g4[time_ymdhis]', '$me_memo' ) ";
sql_query($sql);

// 실시간 쪽지 알림 기능
$sql = " update $g4[member_table]
set mb_memo_call = '$member[mb_id]'
where mb_id = '$mb_list[$i]' ";
sql_query($sql);

insert_point($mb_list[$i], $me_send_points, "{$member[mb_nick]}({$member[mb_id]})님께 $me_send_points 포인트 선물받음");
insert_point($member[mb_id], -$me_send_points, "{$mb_list_nick[$i]}({$mb_list[$i]})님께 $me_send_points 포인트 선물보냄", "@pg", $member['mb_id'], $g4['time_ymdhis']);
insert_point($member[mb_id], -$me_send_pointsm, "{$mb_list_nick[$i]}({$mb_list[$i]})님께 $me_send_pointsm 포인트 선물수수료");

}
}

if ($me_send_points_mb =="on") {
if ($total_spoint) {
$pment = "{$me_send_points} 포인트와 함께";

$cpoint = $member[mb_point] - $total_spoint;
$content ="$me_recv_mb_id 님께 {$me_send_points} (총{$total_spoints}포인트이며 수수료 {$total_spointsm} 포인트차감) 를 보내드렸습니다. 자세한 사항은 포인트 내역을 참조하세요.";
$tmp_row = sql_fetch(" select max(me_id) as max_me_id from $g4[memo_table] ");
$me_ids = $tmp_row[max_me_id] + 1;

$sql = " insert into $g4[memo_table]
( me_id, me_recv_mb_id, me_send_mb_id, me_send_datetime, me_memo )
values ( '$me_ids', '$member[mb_id]', '$member[mb_id]', '$g4[time_ymdhis]', '$content' ) ";
sql_query($sql);

$sql = " update $g4[member_table]
set mb_memo_call = '$member[mb_id]'
where mb_id = '$member[mb_id]' ";
sql_query($sql);
}
}
alert("$me_recv_mb_id 님께 $pment 쪽지를 전달하였습니다.", "./point_gift.php");
?>

댓글 3개

우선 point_gift.skin.php 파일에서 포인트값이 넘어가는지 확인해 보세요.
그리고 에러메세지나 확인메세지등 뜨는게 없나요?
에러메시지는 없구. 포인트를 넘겨주지를 못하더군요
그럼 포인트 넘겨주는 부분을 확인 해서 수정해 주셔야 합니다.
댓글을 작성하시려면 로그인이 필요합니다.

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.

+
제목 글쓴이 날짜 조회
13-02-14 조회 1,727
13-02-14 조회 1,161
13-02-14 조회 912
13-02-14 조회 1,204
13-02-14 조회 1,070
13-02-14 조회 2,735
13-02-14 조회 906
13-02-14 조회 1,121
13-02-14 조회 1,666
13-02-13 조회 924
13-02-13 조회 2,435
13-02-13 조회 956
13-02-13 조회 1,156
13-02-13 조회 1,642
13-02-13 조회 881
13-02-13 조회 1,816
13-02-13 조회 920
13-02-13 조회 1,277
13-02-13 조회 2,758
13-02-13 조회 993