[제나플러스] 비회원 추천가능하게 하기
본문
list.skin.php
**********
sql_query("alter table `$g4[board_good_table]` add guest_ip varchar(255) not null", false);
비회원 추천시 아이피를 기록하기 위해 상단에 추가해 줍니다..
view.skin.php
*******************
<div style="float:right;padding:30px 0 0 0;">
<? if($is_member) {?>
<? if ($good_href) {?>
<a class='button01 bold' href="<?=$good_href?>" target="hiddenframe"><span><img src="<?=$board_skin_path?>/img/icon_good01.gif" style="vertical-align:middle;"> 拍手 (<?=number_format($view[wr_good])?>)</span></a>
<? } ?>
<? if ($nogood_href) {?>
<a class='button01 bold' href="<?=$nogood_href?>" target="hiddenframe"><span><img src="<?=$board_skin_path?>/img/icon_nogood01.gif" style="vertical-align:middle;"> 非推薦 (<?=number_format($view[wr_nogood])?>)</span></a>
<? } ?>
<? } else { ?>
<a class='button01 bold' href="./good_guest.php?bo_table=<?=$bo_table?>&wr_id=<?=$view[wr_id]?>&good=good" target="hiddenframe"><span><img src="<?=$board_skin_path?>/img/icon_good01.gif" style="vertical-align:middle;"> 拍手 (<?=number_format($view[wr_good])?>)</span></a>
<? } ?>
</div>
회원과 비회원을 구분하기 위해 기존 good.php파일을 복사해서 이름을 변경해 줍니다..
bbs/good_guest.php
*************************
/*
if (!$is_member)
{
$href = "./login.php?$qstr&url=".urlencode("./board.php?bo_table=$bo_table&wr_id=$wr_id");
echo "<script type='text/javascript'>alert('ご利用いただくにはログインが必要です。'); top.location.href = '$href';</script>";
exit;
}
*/
if (!($bo_table && $wr_id))
alert_close("値が正しく渡されておりません。");
//$ss_name = "ss_view_{$bo_table}_{$wr_id}";
//if (!get_session($ss_name))
// alert_close("該当掲示文のみ推薦又は非推薦できます。");
~~~~
$sql = " select bg_flag from $g4[board_good_table]
where bo_table = '$bo_table'
and wr_id = '$wr_id'
and mb_id = '$member[mb_id]'
and guest_ip = '$_SERVER[REMOTE_ADDR]'
and bg_flag in ('good', 'nogood') ";
$row = sql_fetch($sql);
if ($row[bg_flag])
{
if ($row[bg_flag] == "good")
$status = "拍手";
else
$status = "非推薦";
echo "<script type='text/javascript'>alert(''$status'は一度のみです。');</script>";
}
else
{
// 拍手(賛成), 非推薦(反対) カウント増加
sql_query(" update {$g4[write_prefix]}{$bo_table} set wr_{$good} = wr_{$good} + 1 where wr_id = '$wr_id' ");
// 内訳生成
sql_query(" insert $g4[board_good_table] set bo_table = '$bo_table', wr_id = '$wr_id', mb_id = '$member[mb_id]', bg_flag = '$good', bg_datetime = '$g4[time_ymdhis]', guest_ip = '$_SERVER[REMOTE_ADDR]' ");
**********
sql_query("alter table `$g4[board_good_table]` add guest_ip varchar(255) not null", false);
비회원 추천시 아이피를 기록하기 위해 상단에 추가해 줍니다..
view.skin.php
*******************
<div style="float:right;padding:30px 0 0 0;">
<? if($is_member) {?>
<? if ($good_href) {?>
<a class='button01 bold' href="<?=$good_href?>" target="hiddenframe"><span><img src="<?=$board_skin_path?>/img/icon_good01.gif" style="vertical-align:middle;"> 拍手 (<?=number_format($view[wr_good])?>)</span></a>
<? } ?>
<? if ($nogood_href) {?>
<a class='button01 bold' href="<?=$nogood_href?>" target="hiddenframe"><span><img src="<?=$board_skin_path?>/img/icon_nogood01.gif" style="vertical-align:middle;"> 非推薦 (<?=number_format($view[wr_nogood])?>)</span></a>
<? } ?>
<? } else { ?>
<a class='button01 bold' href="./good_guest.php?bo_table=<?=$bo_table?>&wr_id=<?=$view[wr_id]?>&good=good" target="hiddenframe"><span><img src="<?=$board_skin_path?>/img/icon_good01.gif" style="vertical-align:middle;"> 拍手 (<?=number_format($view[wr_good])?>)</span></a>
<? } ?>
</div>
회원과 비회원을 구분하기 위해 기존 good.php파일을 복사해서 이름을 변경해 줍니다..
bbs/good_guest.php
*************************
/*
if (!$is_member)
{
$href = "./login.php?$qstr&url=".urlencode("./board.php?bo_table=$bo_table&wr_id=$wr_id");
echo "<script type='text/javascript'>alert('ご利用いただくにはログインが必要です。'); top.location.href = '$href';</script>";
exit;
}
*/
if (!($bo_table && $wr_id))
alert_close("値が正しく渡されておりません。");
//$ss_name = "ss_view_{$bo_table}_{$wr_id}";
//if (!get_session($ss_name))
// alert_close("該当掲示文のみ推薦又は非推薦できます。");
~~~~
$sql = " select bg_flag from $g4[board_good_table]
where bo_table = '$bo_table'
and wr_id = '$wr_id'
and mb_id = '$member[mb_id]'
and guest_ip = '$_SERVER[REMOTE_ADDR]'
and bg_flag in ('good', 'nogood') ";
$row = sql_fetch($sql);
if ($row[bg_flag])
{
if ($row[bg_flag] == "good")
$status = "拍手";
else
$status = "非推薦";
echo "<script type='text/javascript'>alert(''$status'は一度のみです。');</script>";
}
else
{
// 拍手(賛成), 非推薦(反対) カウント増加
sql_query(" update {$g4[write_prefix]}{$bo_table} set wr_{$good} = wr_{$good} + 1 where wr_id = '$wr_id' ");
// 内訳生成
sql_query(" insert $g4[board_good_table] set bo_table = '$bo_table', wr_id = '$wr_id', mb_id = '$member[mb_id]', bg_flag = '$good', bg_datetime = '$g4[time_ymdhis]', guest_ip = '$_SERVER[REMOTE_ADDR]' ");
추천0
댓글목록 0
등록된 댓글이 없습니다.