테스트 사이트 - 개발 중인 베타 버전입니다

[Q] 상품 후기 회원만 등록 하게 하려고 하는데? 소스좀 봐주세요.

· 14년 전 · 212 · 1
로그인한 회원만 후기를 남기려고 하는데 활성화가 안되는데 소스 내용좀 봐주세요?
/* 이걸 다 풀었는데도 이상하네요? 빠른 답변 바랍니다.

/ship/itemuse.inc.php 파일 입니다.

{
 
    if (!g4_is_member) {
        alert("로그인 하시기 바랍니다.");
        return;
    }
 
위에처럼 풀었으나 작동이 안됩니다.


---------------------------------------------


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

<!-- 사용후기 -->
<style type="text/css">
.ddd {
color: #999;
}
</style>

<a name="use"></a>
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><img src='<?=$g4[shop_img_path]?>/re.gif' align="absbottom"></td>
  </tr>
 
</table>
<!-- 사용후기 폼 -->
        <div id=itemuse style='display:block;'>
        <form name="fitemuse" method="post" onSubmit="return fitemuse_submit(this);" autocomplete=off style="padding:0px;">
        <input type=hidden name=w value=''>
        <input type=hidden name=token value='<?=$token?>'>
        <input type=hidden name=is_id value=''>
        <input type=hidden name=it_id value='<?=$it[it_id]?>'>
        <table width=600 border=0 align="center" cellpadding=0 cellspacing=0>
       

        <? if (!$is_member) { ?>
        <tr >
            <td height=30 align=right>이름&nbsp;</td>
            <td >&nbsp;<input type="text" name="is_name" class=ed maxlength=20 minlength=2 required itemname="이름"></td>
            <td width="65" rowspan="2" ><img id='kcaptcha_image_use' /></td>
            <td rowspan="2" >&nbsp;<input type='text' name='is_key' class='ed' required itemname='자동등록방지용 코드'>
                &nbsp;<br>
            * 코드번호 입력하세요</td>
            <td colspan="6" rowspan="2" ></td>
          </tr>
        <tr >
            <td height=30 align=right>패스워드&nbsp;</td>
          <td width="168" >&nbsp;<input type="password" name="is_password" class=ed maxlength=20 minlength=3 required itemname="패스워드"></td>
          </tr>
        <? } ?>

        <tr >
            <td height=30 align=right>제목&nbsp;</td>
            <td colspan="9" >&nbsp;<input type="text" name="is_subject" style="width:70%;" class=ed required itemname="제목"></td></tr>
        <tr >
            <td align=right >내용&nbsp;</td>
            <td colspan="8">&nbsp;<textarea name="is_content" rows="5" style="width:400;" class=ed required itemname="내용"></textarea></td>
            <td width="114" align="center" ><input type=image src='<?=$g4[shop_img_path]?>/btn_confirm.jpg' border=0></td>
        </tr>
        <tr >
            <td height=30 align=right >평가&nbsp;</td>
            <td colspan="9">
                <input type=radio name=is_score value='10' checked><img src='<?=$g4[shop_img_path]?>/star5.gif' align=absmiddle>
                <input type=radio name=is_score value='8'><img src='<?=$g4[shop_img_path]?>/star4.gif' align=absmiddle>
                <input type=radio name=is_score value='6'><img src='<?=$g4[shop_img_path]?>/star3.gif' align=absmiddle>
                <input type=radio name=is_score value='4'><img src='<?=$g4[shop_img_path]?>/star2.gif' align=absmiddle>
                <input type=radio name=is_score value='2'><img src='<?=$g4[shop_img_path]?>/star1.gif' align=absmiddle></td></tr>
        <tr >
            <td width=76 align=right></td>
            <td colspan="9">
                </td></tr>
                </table>
        </form>
</div>
<div id='item_use' style='display:block;'>
<table width=600 align="center" cellpadding=0 cellspacing=0>
<tr><td height=2 ></td></tr>
<tr><td >
        <table width=100% cellpadding=0 cellspacing=0 border=0>
        <tr><td height=2 bgcolor=#aaaaaa colspan=9></td></tr>
        <tr>
            <td width=11>&nbsp;</td>
            <td valign=top>
                <table width=100% height=31 cellpadding=0 cellspacing=0 border=0>
               
                <tr align=center>
                    <td width=40>번호</td>
                    <td>제목</td>
                    <td width=80 >작성자</td>
                    <td width=100 >작성일</td>
                    <td width=80 >평가점수</td>
                </tr>
                <tr><td height=1 bgcolor=#aaaaaa colspan=9></td></tr>
                </table></td>           
            <td width=11>&nbsp;</td>
        </tr>
        <?
        $sql_common = " from $g4[yc4_item_ps_table] where it_id = '$it[it_id]' and is_confirm = '1' ";

        // 테이블의 전체 레코드수만 얻음
        $sql = " select COUNT(*) as cnt " . $sql_common;
        $row = sql_fetch($sql);
        $use_total_count = $row[cnt];

        $use_total_page  = ceil($use_total_count / $use_page_rows); // 전체 페이지 계산
        if ($use_page == "") $use_page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
        $use_from_record = ($use_page - 1) * $use_page_rows; // 시작 레코드 구함

        $sql = "select * $sql_common order by is_id desc limit $use_from_record, $use_page_rows ";
        $result = sql_query($sql);
        for ($i=0; $row=sql_fetch_array($result); $i++)
        {
            if ($i > 0)
                echo "<tr><td colspan=3 background='$g4[shop_img_path]/dot_line.gif'></td></tr>";

            $num = $use_total_count - ($use_page - 1) * $use_page_rows - $i;

            $star = get_star($row[is_score]);

            $is_name = get_text($row[is_name]);
            $is_subject = conv_subject($row[is_subject],50,"…");
            $is_content = conv_content($row[is_content],0);

            $is_time = substr($row[is_time], 2, 14);

            echo "
            <tr>
                <td width=11 ></td>
                <td valign=top>
                    <table width=100% cellpadding=0 cellspacing=0 border=0>
                    <tr align=center>
                        <td width=40 height=25>$num</td>
                        <td align=left>
                            <b><a href='javascript:;' onclick=\"use_menu('is$i')\"><b>$is_subject</b></a></b>
                        <td width=80>$is_name</td>
                        <td width=100>$is_time</td>
                        <td width=80><img src='$g4[shop_img_path]/star{$star}.gif' border=0></td>
                    </tr>
                    </table>
               
                    <div id='is$i' style='display:none;'>
                    <table width=100% cellpadding=0 cellspacing=0 border=0>
                    <tr>
                        <td style='padding:10px;' class=lh>{$is_content}</td>
                    </tr>
                    <tr>
                        <td align=right height=30>
                            <textarea id='tmp_is_id{$i}' style='display:none;'>{$row[is_id]}</textarea>
                            <textarea id='tmp_is_name{$i}' style='display:none;'>{$row[is_name]}</textarea>
                            <textarea id='tmp_is_subject{$i}' style='display:none;'>{$row[is_subject]}</textarea>
                            <textarea id='tmp_is_content{$i}' style='display:none;'>{$row[is_content]}</textarea>";

            if ($row[mb_id] == $member[mb_id])
            {
                echo "<a href='javascript:itemuse_update({$i});'><span class=small><b>수정</b></span></a>&nbsp;";
                echo "<a href='javascript:itemuse_delete(fitemuse_password{$i}, {$i});'><span class=small><b>삭제</b></span></a>&nbsp;";
            }

            echo "
                        </td>
                    </tr>
                    <!-- 사용후기 삭제 패스워드 입력 폼 -->
                    <tr id='itemuse_password{$i}' style='display:none;'>
                        <td align=right height=30>
                            <form name='fitemuse_password{$i}' method='post' action='./itemuseupdate.php' autocomplete=off style='padding:0px;'>
                            <input type=hidden name=w value=''>
                            <input type=hidden name=is_id value=''>
                            <input type=hidden name=it_id value='{$it[it_id]}'>
                            패스워드 : <input type=password class=ed name=is_password required itemname='패스워드'>
                            <input type=image src='{$g4[shop_img_path]}/btn_confirm.gif' border=0 align=absmiddle></a>
                            </form>
                        </td>
                    </tr>
                    </table>
                    </div></td>
                <td width=11 >&nbsp;</td></tr>
            </tr>
            ";
        }

        if (!$i)
        {
            echo "
            <tr>
                <td width=11 ></td>
                <td height=100 align=center class=lh>
                    이 상품에 대한 사용후기가 아직 없습니다.<br>
                    사용후기를 작성해 주시면 다른 분들께 많은 도움이 됩니다.</td>
                <td width=11 >&nbsp;</td></tr>
            </tr>";
        }

        $use_pages = get_paging(10, $use_page, $use_total_page, "./item.php?it_id=$it_id&$qstr&use_page=", "#use");
        if ($use_pages)
        {
            echo "<tr><td colspan=3 ></td></tr>";
            echo "<tr>";
            echo "<td width=11 ></td>";
            echo "<td height=22 align=center>$use_pages</td>";
            echo "<td width=11 >&nbsp;</td></tr>";
            echo "</tr>";
        }
        ?>
        <tr>
            <td width=11>&nbsp;</td>
            <td></td>
            <td width=11>&nbsp;</td>
        </tr>
        <tr><td height=1 bgcolor=#aaaaaa colspan=9></td></tr>
        </table>
       
       
       
        <table width=100% cellpadding=0 cellspacing=0>

        </table>

       
    </td>
</tr>
<tr><td colspan=2 height=1></td></tr>
</table>
</div>


<script type="text/javascript">
function fitemuse_submit(f)
{
    if (!check_kcaptcha(f.is_key)) {
        return false;
    }

    f.action = "itemuseupdate.php"
    return true;
}


function itemuse_insert()
{
 
    if (!g4_is_member) {
        alert("로그인 하시기 바랍니다.");
        return;
    }
 

var f = document.fitemuse;
    var id = document.getElementById('itemuse');

    id.style.display = 'block';

    f.w.value = '';
    f.is_id.value = '';
    if (!g4_is_member)
    {
        f.is_name.value = '';
        f.is_name.readOnly = false;
        f.is_password.value = '';
    }
    f.is_subject.value = '';
    f.is_content.value = '';
}

function itemuse_update(idx)
{
    var f = document.fitemuse;
    var id = document.getElementById('itemuse');

    id.style.display = 'block';

    f.w.value = 'u';
    f.is_id.value = document.getElementById('tmp_is_id'+idx).value;
    if (!g4_is_member)
    {
        f.is_name.value = document.getElementById('tmp_is_name'+idx).value;
        f.is_name.readOnly = true;
    }
    f.is_subject.value = document.getElementById('tmp_is_subject'+idx).value;
    f.is_content.value = document.getElementById('tmp_is_content'+idx).value;
}

function itemuse_delete(f, idx)
{
    var id = document.getElementById('itemuse');

    f.w.value = 'd';
    f.is_id.value = document.getElementById('tmp_is_id'+idx).value;

    if (g4_is_member)
    {
        if (confirm("삭제하시겠습니까?"))
            f.submit();
    }
    else
    {
        id.style.display = 'none';
        document.getElementById('itemuse_password'+idx).style.display = 'block';
    }
}
</script>
<br>
<br>
<br>
<!-- 사용후기 end -->

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

댓글 1개

14년 전
질문과답변 게시판에 등록하세요
여기는 팁&자료실 게시판입니다

게시글 목록

번호 제목
1304
1301
1296
1290
1289
1287
1282
1281
1280
1276
1271
1264
1260
1259
1250
1243
1242
1241
1234
1231