검색문제 해결가능하신분 > 그누4 질문답변

그누4 질문답변

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

검색문제 해결가능하신분 정보

검색문제 해결가능하신분

첨부파일

item_search.php (29.0K) 2회 다운로드 2008-03-28 18:55:07

본문

여러가지 옵션을 두어 검색이 가능하게 하고 싶은데 잘 안되네요.
무엇이 문제인지 아시는 분 없을까요.

오류가 나는곳의 주소를 알려주시면 더 빠르고 정확하게 답변 받을 수 있습니다.

오류 주소 : http://deliplus.co.kr/dome/bbs/item_search.php


------itemsearch.php 의 전체내용 ----------------------


<?
include_once("./_common.php");

$board[bo_page_rows] = '1000';

if ($write[wr_is_comment])
{
    /*
    if ($cwin) // 코멘트 보기
        alert_close("코멘트는 상세보기 하실 수 없습니다.");
    else
        alert("코멘트는 상세보기 하실 수 없습니다.");
    */
    goto_url("./item.php?bo_table=$bo_table&price1=$price1&price2=$price2&no1=$no1&no2=$no2&no3=$no3&no4=$no4&no5=$no5&wr_id=$write[wr_parent]#c_{$wr_id}");
}

// wr_id 값이 있으면 글읽기
if ($wr_id)
{
    // 글이 없을 경우 해당 게시판 목록으로 이동
    if (!$write[wr_id])
    {
        $msg = "글이 존재하지 않습니다.\\n\\n글이 삭제되었거나 이동된 경우입니다.";
        if ($cwin)
            alert_close($msg);
        else
            alert($msg, "./item.php?bo_table=$bo_table&price1=$price1&price2=$price2&no1=$no1&no2=$no2&no3=$no3&no4=$no4&no5=$no5");
    }

    // 그룹접근 사용
    if ($group[gr_use_access])
    {
        if (!$member[mb_id]) {
            $msg = "비회원은 이 게시판에 접근할 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.";
            if ($cwin)
                alert_close($msg);
            else
                alert($msg, "./login.php?wr_id=$wr_id{$qstr}&url=".urlencode("./item.php?bo_table=$bo_table&wr_id=$wr_id&price1=$price1&price2=$price2&no1=$no1&no2=$no2&no3=$no3&no4=$no4&no5=$no5"));
        }

        // 그룹관리자 이상이라면 통과
        if ($is_admin == "super" || $is_admin == "group")
            ;
        else
        {
            // 그룹접근
            $sql = " select count(*) as cnt
                      from $g4[group_member_table]
                      where gr_id = '$board[gr_id]' and mb_id = '$member[mb_id]' ";
            $row = sql_fetch($sql);
            if (!$row[cnt])
                alert("접근 권한이 없으므로 글읽기가 불가합니다.\\n\\n궁금하신 사항은 관리자에게 문의 바랍니다.", $g4[path]);
        }
    }

    // 로그인된 회원의 권한이 설정된 읽기 권한보다 작다면
    if ($member[mb_level] < $board[bo_read_level])
    {
        if ($member[mb_id])
            //alert("글을 읽을 권한이 없습니다.");
            alert("글을 읽을 권한이 없습니다.", $g4[path]);
        else
            alert("글을 읽을 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.", "./login.php?wr_id=$wr_id{$qstr}&url=".urlencode("./item.php?bo_table=$bo_table&wr_id=$wr_id&price1=$price1&price2=$price2&no1=$no1&no2=$no2&no3=$no3&no4=$no4&no5=$no5"));
    }

    // 자신의 글이거나 관리자라면 통과
    if (($write[mb_id] && $write[mb_id] == $member[mb_id]) || $is_admin)
        ;
    else
    {
        // 비밀글이라면
        if (strstr($write[wr_option], "secret"))
        {
            // 회원이 비밀글을 올리고 관리자가 답변글을 올렸을 경우
            // 회원이 관리자가 올린 답변글을 바로 볼 수 없던 오류를 수정
            $is_owner = false;
            if ($write[wr_reply] && $member[mb_id])
            {
                $sql = " select mb_id from $write_table
                          where wr_num = '$write[wr_num]'
                            and wr_reply = ''
                            and wr_is_comment = '0' ";
                $row = sql_fetch($sql);
                if ($row[mb_id] == $member[mb_id])
                    $is_owner = true;
            }

            $ss_name = "ss_secret_{$bo_table}_$write[wr_num]";
           
            if (!$is_owner)
            {
                //$ss_name = "ss_secret_{$bo_table}_{$wr_id}";
                // 한번 읽은 게시물의 번호는 세션에 저장되어 있고 같은 게시물을 읽을 경우는 다시 패스워드를 묻지 않습니다.
                // 이 게시물이 저장된 게시물이 아니면서 관리자가 아니라면
                //if ("$bo_table|$write[wr_num]" != get_session("ss_secret"))
                if (!get_session($ss_name))
                    goto_url("./password.php?w=s&bo_table=$bo_table&wr_id=$wr_id{$qstr}");
            }

            set_session($ss_name, TRUE);
        }
    }

    // 한번 읽은글은 브라우저를 닫기전까지는 카운트를 증가시키지 않음
    $ss_name = "ss_view_{$bo_table}_{$wr_id}";
    if (!get_session($ss_name))
    {
        sql_query(" update $write_table set wr_hit = wr_hit + 1 where wr_id = '$wr_id' ");

        // 자신의 글이면 통과
        if ($write[mb_id] && $write[mb_id] == $member[mb_id])
            ;
        else
        {
            // 회원이상 글읽기가 가능하다면
            if ($board[bo_read_level] > 1) {
                if ($member[mb_point] + $board[bo_read_point] < 0)
                    alert("보유하신 포인트(".number_format($member[mb_point]).")가 없거나 모자라서 글읽기(".number_format($board[bo_read_point]).")가 불가합니다.\\n\\n포인트를 모으신 후 다시 글읽기 해 주십시오.");

                insert_point($member[mb_id], $board[bo_read_point], "$board[bo_subject] $wr_id 글읽기", $bo_table, $wr_id, '읽기');
            }
        }

        set_session($ss_name, TRUE);
    }

    $g4[title] = "$group[gr_subject] > $board[bo_subject] > " . strip_tags(conv_subject($write[wr_subject], 255));
}
else
{
    if ($member[mb_level] < $board[bo_list_level])
    {
        if ($member[mb_id])
            alert("목록을 볼 권한이 없습니다.", $g4[path]);
        else
            alert("목록을 볼 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.", "./login.php?wr_id=$wr_id{$qstr}&url=".urlencode("item.php?bo_table=$bo_table&wr_id=$wr_id&price1=$price1&price2=$price2&no1=$no1&no2=$no2&no3=$no3&no4=$no4&no5=$no5"));
    }

    if (!$page) $page = 1;

    $g4[title] = "$group[gr_subject] > $board[bo_subject] $page 페이지";
}


$width = $board[bo_table_width];
if ($width <= 100) $width .= '%';

// IP보이기 사용 여부
$ip = "";
$is_ip_view = $board[bo_use_ip_view];
if ($is_admin) {
    $is_ip_view = true;
    $ip = $write[wr_ip];
} else // 관리자가 아니라면 IP 주소를 감춘후 보여줍니다.
    $ip = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", "\\1.♡.\\3.\\4", $write[wr_ip]);

// 분류 사용
$is_category = false;
$category_name = "";
if ($board[bo_use_category]) {
    $is_category = true;
    $category_name = $write[ca_name]; // 분류명
}

// 추천 사용
$is_good = false;
if ($board[bo_use_good])
    $is_good = true;

// 비추천 사용
$is_nogood = false;
if ($board[bo_use_nogood])
    $is_nogood = true;

$admin_href = "";
// 최고관리자 또는 그룹관리자라면
if ($member[mb_id] && ($is_admin == 'super' || $group[gr_admin] == $member[mb_id]))
    $admin_href = "$g4[admin_path]/board_form.php?w=u&bo_table=$bo_table";

if (!($board[bo_use_comment] && $cwin))
    include_once("./board_head.php");

echo "<script language=\"javascript\" src=\"$g4[path]/js/sideview.js\"></script>\n";


?>









<table align=center width=100% cellpadding=0 cellspacing=0>
<form name=fdetailsearch method=get action="../bbs/item_search.php">
<input type=hidden name=bo_table value="item01">
<tr>
    <td align=center>



<table width=100% cellpadding=6 cellspacing=1 border=0 bgcolor="#AFAFAF">
<tr><td bgcolor=white align=center>
<table width=100% cellpadding=0 cellspacing=0 border=0 align=center>
<tr>
<td width=132 align=top>
<img src="../skin/search/basic/images/title.gif" border=0>
</td>
<td width=1 background="../skin/search/basic/images/height_dot.gif">
<td width=16 align=top></td>
<td align=top>


<table width=100% cellpadding=0 cellspacing=0 border=0 align=center>


<tr>
<td width=70 align=top style="padding-top:5px;padding-bottom:5px;">
상품분류
</td>
<td align=top style="padding-top:5px;padding-bottom:5px;">

<?
$all_item = "$config[cate1]";
$mae_cate = explode("\n",$all_item);
$mae_cate_count = count($mae_cate);
?>
<table width=100% cellpadding=0 cellspacing=0 border=0 align=center>
<tr>

<? for ($k=0; $k < $mae_cate_count; $k++) {
$mae_cate[$k] = trim($mae_cate[$k]);
    if ($k && $k%5==0)
        echo "</tr><tr>";

?>
<td align=top width=20%><input type=radio name='no1' value='no1_<?=$k?>'> <?=$mae_cate[$k]?></td>
<? } ?>
</table>


</td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#eaeaea></td></tr>

<tr>
<td width=70 align=top style="padding-top:5px;padding-bottom:5px;">
용도별분류
</td>
<td align=top style="padding-top:5px;padding-bottom:5px;">

<?
$all_item = "$config[cate2]";
$mae_cate = explode("\n",$all_item);
$mae_cate_count = count($mae_cate);
?>
<table width=100% cellpadding=0 cellspacing=0 border=0 align=center>
<tr>

<? for ($k=0; $k < $mae_cate_count; $k++) {
$mae_cate[$k] = trim($mae_cate[$k]);
    if ($k && $k%5==0)
        echo "</tr><tr>";

?>
<td align=top width=20%><input type=checkbox name='no2_<?=$k?>' value='no2_<?=$k?>'> <?=$mae_cate[$k]?></td>
<? } ?>
</table>


</td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#eaeaea></td></tr>


<tr height=32>
<td width=70 align=top style="padding-top:5px;padding-bottom:5px;">
상품가격대
</td>
<td align=top style="padding-top:5px;padding-bottom:5px;">

<input type=text name=price1 size=30> ~ <input type=text name=price2 size=30> 사이


</td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#eaeaea></td></tr>


<tr>
<td width=70 align=top style="padding-top:5px;padding-bottom:5px;">
기타 옵션
</td>
<td align=top style="padding-top:5px;padding-bottom:5px;">

<?
$all_item = "$config[cate4]";
$mae_cate = explode("\n",$all_item);
$mae_cate_count = count($mae_cate);
?>
<table width=100% cellpadding=0 cellspacing=0 border=0 align=center>
<tr>

<? for ($k=0; $k < $mae_cate_count; $k++) {
$mae_cate[$k] = trim($mae_cate[$k]);
    if ($k && $k%5==0)
        echo "</tr><tr>";

?>
<td align=top width=20%><input type=checkbox name='no5_<?=$k?>' value='no5_<?=$k?>'> <?=$mae_cate[$k]?></td>
<? } ?>
</table>


</td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#eaeaea></td></tr>


<tr>
<td width=70 align=top style="padding-top:5px;padding-bottom:5px;">
검색어
</td>
<td align=top style="padding-top:5px;padding-bottom:5px;">

<select name=stx_type>
<option value=name <? if ($stx_type == 'name') echo "selected"; ?>>상품명</option>
<option value=model <? if ($stx_type == 'model') echo "selected"; ?>>모델명</option>
<option value=code <? if ($stx_type == 'code') echo "selected"; ?>>상품코드</option>
<option value=country <? if ($stx_type == 'country') echo "selected"; ?>>원산지</option>
<option value=made <? if ($stx_type == 'made') echo "selected"; ?>>제조사</option>
</select>
<input type=text name=stx maxlength=20 size=40 itemname="검색어">
<input type=image src="../_images/btn_search.gif" border=0 align=absmiddle>
<input type=hidden name=sop value=and>
        <!--&nbsp; &nbsp; 연산자 &nbsp;
        <input type="radio" name="sop" value="or" <?=($sop == "or") ? "checked" : "";?>>OR &nbsp;
        <input type="radio" name="sop" value="and" <?=($sop == "and" || !$sop) ? "checked" : "";?>>AND-->
</td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#eaeaea></td></tr>


</table>




</td>
</tr>
</table>
</td></tr></table>

<table width=100% cellpadding=0 cellspacing=0 border=0><tr><td height=6></td></tr></table>





        <script language="javascript">

        function fdetailsearch_submit(f)
        {
            /*
            // 검색에 많은 부하가 걸리는 경우 이 주석을 제거하세요.
            var cnt = 0;
            for (var i=0; i<f.stx.value.length; i++)
            {
                if (f.stx.value.charAt(i) == ' ')
                    cnt++;
            }

            if (cnt > 1)
            {
                alert("빠른 검색을 위하여 검색어에 공백은 한개만 입력할 수 있습니다.");
                f.stx.select();
                f.stx.focus();
                return;
            }
            */
           
            f.action = "../bbs/item_search.php";
            f.submit();
        }
        </script>
    </td>
</tr>
</form>
</table>
<p>










<?

if ($bo_table) {



if (!($board[bo_use_comment] && $cwin)) {
    // 게시물 아이디가 있다면 게시물 보기를 INCLUDE
    if ($wr_id) {





$sql_search = "";
// 검색이면
if ($sca || $stx || $price1 || $price2 || $no1 || $no2_0 || $no2_1 || $no2_2 || $no2_3 || $no2_4 || $no2_5 || $no2_6 || $no2_7 || $no2_8 || $no2_9 || $no2_10 || $no2_1 || $no2_12 || $no2_13 || $no2_14 || $no2_15 || $no2_16 || $no2_17 || $no2_18 || $no2_19 || $no2_20 || $no5_0 || $no5_1 || $no5_2 || $no5_3 || $no5_4 || $no5_5 || $no5_6 || $no5_7 || $no5_8 || $no5_9 || $no5_10 || $no5_11 || $no5_12 || $no5_13 || $no5_14 || $no5_15 || $no5_16 || $no5_17 || $no5_18 || $no5_19 || $no5_20)  {
    // where 문을 얻음
    $sql_search = get_sql_search($sca, $sfl, $stx, $sop);
    $search_href = "./item.php?bo_table=$bo_table&price1=$price1&price2=$price2&no1=$no1&no2=$no2&no3=$no3&no4=$no4&no5=$no5&page=$page" . $qstr;
    $list_href = "./item.php?bo_table=$bo_table&price1=$price1&price2=$price2&no1=$no1&no2=$no2&no3=$no3&no4=$no4&no5=$no5";
} else {
    $search_href = "";
    $list_href = "./item.php?bo_table=$bo_table&price1=$price1&price2=$price2&no1=$no1&no2=$no2&no3=$no3&no4=$no4&no5=$no5&page=$page";
}

if (!$board[bo_use_list_view]) {
    if ($sql_search)
        $sql_search = " and " . $sql_search;

    // 윗글을 얻음
    $sql = " select wr_id, wr_subject from $write_table where wr_is_comment = 0 and wr_num = '$write[wr_num]' and wr_reply < '$write[wr_reply]' $sql_search order by wr_num desc, wr_reply desc limit 1 ";
    $prev = sql_fetch($sql);
    // 위의 쿼리문으로 값을 얻지 못했다면
    if (!$prev[wr_id])    {
        $sql = " select wr_id, wr_subject from $write_table where wr_is_comment = 0 and wr_num < '$write[wr_num]' $sql_search order by wr_num desc, wr_reply desc limit 1 ";
        $prev = sql_fetch($sql);
    }

    // 아래글을 얻음
    $sql = " select wr_id, wr_subject from $write_table where wr_is_comment = 0 and wr_num = '$write[wr_num]' and wr_reply > '$write[wr_reply]' $sql_search order by wr_num, wr_reply limit 1 ";
    $next = sql_fetch($sql);
    // 위의 쿼리문으로 값을 얻지 못했다면
    if (!$next[wr_id]) {
        $sql = " select wr_id, wr_subject from $write_table where wr_is_comment = 0 and wr_num > '$write[wr_num]' $sql_search order by wr_num, wr_reply limit 1 ";
        $next = sql_fetch($sql);
    }
}

// 이전글 링크
$prev_href = "";
if ($prev[wr_id]) {
    $prev_wr_subject = get_text(cut_str($prev[wr_subject], 255));
    $prev_href = "./item.php?bo_table=$bo_table&wr_id=$prev[wr_id]&price1=$price1&price2=$price2&no1=$no1&no2=$no2&no3=$no3&no4=$no4&no5=$no5&page=$page" . $qstr;
}

// 다음글 링크
$next_href = "";
if ($next[wr_id]) {
    $next_wr_subject = get_text(cut_str($next[wr_subject], 255));
    $next_href = "./item.php?bo_table=$bo_table&wr_id=$next[wr_id]&price1=$price1&price2=$price2&no1=$no1&no2=$no2&no3=$no3&no4=$no4&no5=$no5&page=$page" . $qstr;
}

// 쓰기 링크
$write_href = "";
if ($member[mb_level] >= $board[bo_write_level])
    $write_href = "./write.php?bo_table=$bo_table";

// 답변 링크
$reply_href = "";
if ($member[mb_level] >= $board[bo_reply_level])
    $reply_href = "./write.php?w=r&bo_table=$bo_table&wr_id=$wr_id" . $qstr;

// 수정, 삭제 링크
$update_href = $delete_href = "";
// 로그인중이고 자신의 글이라면 또는 관리자라면 패스워드를 묻지 않고 바로 수정, 삭제 가능
if (($member[mb_id] && ($member[mb_id] == $write[mb_id])) || $is_admin) {
    $update_href = "./write.php?w=u&bo_table=$bo_table&wr_id=$wr_id&page=$page" . $qstr;
    $delete_href = "javascript:del('./delete.php?bo_table=$bo_table&wr_id=$wr_id&page=$page".$qstr."');";
}
else if (!$write[mb_id]) { // 회원이 쓴 글이 아니라면
    $update_href = "./password.php?w=u&bo_table=$bo_table&wr_id=$wr_id&page=$page" . $qstr;
    $delete_href = "./password.php?w=d&bo_table=$bo_table&wr_id=$wr_id&page=$page" . $qstr;
}

// 최고, 그룹관리자라면 글 복사, 이동 가능
$copy_href = $move_href = "";
if ($write[wr_reply] == "" && ($is_admin == "super" || $is_admin == "group")) {
    $copy_href = "javascript:win_open('./move.php?sw=copy&bo_table=$bo_table&wr_id=$wr_id&page=$page".$qstr."', 'boardcopy', 'left=50, top=50, width=396, height=550, scrollbars=1');";
    $move_href = "javascript:win_open('./move.php?sw=move&bo_table=$bo_table&wr_id=$wr_id&page=$page".$qstr."', 'boardmove', 'left=50, top=50, width=396, height=550, scrollbars=1');";
}

$scrap_href = "";
$good_href = "";
$nogood_href = "";
if ($member[mb_id]) {
    // 스크랩 링크
    $scrap_href = "./scrap_popin.php?bo_table=$bo_table&wr_id=$wr_id";

    // 추천 링크
    if ($board[bo_use_good])
        $good_href = "./good.php?bo_table=$bo_table&wr_id=$wr_id&good=good";

    // 비추천 링크
    if ($board[bo_use_nogood])
        $nogood_href = "./good.php?bo_table=$bo_table&wr_id=$wr_id&good=nogood";
}

$view = get_view($write, $board, $board_skin_path);

if (strstr($sfl, "subject"))
    $view[subject] = search_font($stx, $view[subject]);

$html = 0;
if (strstr($view[wr_option], "html1"))
    $html = 1;
else if (strstr($view[wr_option], "html2"))
    $html = 2;

$view[content] = conv_content($view[wr_content], $html);
if (strstr($sfl, "content"))
    $view[content] = search_font($stx, $view[content]);
$view[content] = preg_replace("/(\<img )([^\>]*)(\>)/i", "\\1 name='target_resize_image[]' onclick='image_window(this)' style='cursor:pointer;' \\2 \\3", $view[content]);

//$view[rich_content] = preg_replace("/{img\:([0-9]+)[:]?([^}]*)}/ie", "view_image(\$view, '\\1', '\\2')", $view[content]);
$view[rich_content] = preg_replace("/{이미지\:([0-9]+)[:]?([^}]*)}/ie", "view_image(\$view, '\\1', '\\2')", $view[content]);

// 트랙백
$trackback_url = "";
if ($member[mb_level] >= $board[bo_trackback_level])
    $trackback_url = "$g4[url]/$g4[bbs]/tb.php/$bo_table/$wr_id";

$is_signature = false;
$signature = "";
if ($board[bo_use_signature] && $view[mb_id])
{
    $is_signature = true;
    $mb = get_member($view[mb_id]);
    $signature = $mb[mb_signature];
}

include_once("$board_skin_path/view.skin.php");








}


    // 전체목록보이기 사용이 "예" 또는 wr_id 값이 없다면 목록을 보임
    //if ($board[bo_use_list_view] || empty($wr_id))
    if ($member[mb_level] >= $board[bo_list_level] && $board[bo_use_list_view] || empty($wr_id)) {




// 분류 사용 여부
$is_category = false;
if ($board[bo_use_category])
{
    $is_category = true;
    $category_location = "./item.php?bo_table=$bo_table&price1=$price1&price2=$price2&no1=$no1&no2=$no2&no3=$no3&no4=$no4&no5=$no5&sca=";
    $category_option = get_category_option($bo_table); // SELECT OPTION 태그로 넘겨받음
}

$sop = strtolower($sop);
if ($sop != "and" && $sop != "or")
    $sop = "and";

// 분류 선택 또는 검색어가 있다면
if ($sca || $stx || $price1 || $price2 || $no1 || $no2_0 || $no2_1 || $no2_2 || $no2_3 || $no2_4 || $no2_5 || $no2_6 || $no2_7 || $no2_8 || $no2_9 || $no2_10 || $no2_11 || $no2_12 || $no2_13 || $no2_14 || $no2_15 || $no2_16 || $no2_17 || $no2_18 || $no2_19 || $no2_20 || $no5_0 || $no5_1 || $no5_2 || $no5_3 || $no5_4 || $no5_5 || $no5_6 || $no5_7 || $no5_8 || $no5_9 || $no5_10 || $no5_1 || $no5_12 || $no5_13 || $no5_14 || $no5_15 || $no5_16 || $no5_17 || $no5_18 || $no5_19 || $no5_20)
{

$sql_search = "";
    $sop = "";

    if ($no1) {
$sql_search .= $sop." no1 = '$no1' ";
    $sop = "and";
}

if ($no2_0) {
$sql_search .= $sop." no2 like '%$no2_0%' ";
    $sop = "or";
}
if ($no2_1) {
$sql_search .= $sop." no2 like '%$no2_1%' ";
    $sop = "or";
}
if ($no2_2) {
$sql_search .= $sop." no2 like '%$no2_2%' ";
    $sop = "or";
}
if ($no2_3) {
$sql_search .= $sop." no2 like '%$no2_3%' ";
    $sop = "or";
}
if ($no2_4) {
$sql_search .= $sop." no2 like '%$no2_4%' ";
    $sop = "or";
}
if ($no2_5) {
$sql_search .= $sop." no2 like '%$no2_5%' ";
    $sop = "or";
}
if ($no2_6) {
$sql_search .= $sop." no2 like '%$no2_6%' ";
    $sop = "or";
}
if ($no2_7) {
$sql_search .= $sop." no2 like '%$no2_7%' ";
    $sop = "or";
}
if ($no2_8) {
$sql_search .= $sop." no2 like '%$no2_8%' ";
    $sop = "or";
}
if ($no2_9) {
$sql_search .= $sop." no2 like '%$no2_9%' ";
    $sop = "or";
}
if ($no2_10) {
$sql_search .= $sop." no2 like '%$no2_10%' ";
    $sop = "or";
}
if ($no2_11) {
$sql_search .= $sop." no2 like '%$no2_11%' ";
    $sop = "or";
}
if ($no2_12) {
$sql_search .= $sop." no2 like '%$no2_12%' ";
    $sop = "or";
}
if ($no2_13) {
$sql_search .= $sop." no2 like '%$no2_13%' ";
    $sop = "or";
}
if ($no2_14) {
$sql_search .= $sop." no2 like '%$no2_14%' ";
    $sop = "or";
}
if ($no2_15) {
$sql_search .= $sop." no2 like '%$no2_15%' ";
    $sop = "or";
}
if ($no2_16) {
$sql_search .= $sop." no2 like '%$no2_16%' ";
    $sop = "or";
}
if ($no2_17) {
$sql_search .= $sop." no2 like '%$no2_17%' ";
    $sop = "or";
}
if ($no2_18) {
$sql_search .= $sop." no2 like '%$no2_18%' ";
    $sop = "or";
}
if ($no2_19) {
$sql_search .= $sop." no2 like '%$no2_19%' ";
    $sop = "or";
}
if ($no2_20) {
$sql_search .= $sop." no2 like '%$no2_20%' ";
    $sop = "and";
}

    if ($price1 && !$price2) {
$sql_search .= $sop." wr_3 >= '$price1' ";
    $sop = "and";
}
    if (!$price1 && $price2) {
$sql_search .= $sop." wr_3 <= '$price2' ";
    $sop = "and";
}
    if ($price1 && $price2) {
$sql_search .= $sop." (wr_3 >= '$price1' and wr_3 < '$price2') ";
    $sop = "and";
}


if ($no5_0) {
$sql_search .= $sop." no5 like '%$no5_0%' ";
    $sop = "or";
}
    if ($no5_1) {
$sql_search .= $sop." no5 like '%$no5_1%' ";
    $sop = "or";
}
    if ($no5_2) {
$sql_search .= $sop." no5 like '%$no5_2%' ";
    $sop = "or";
}
    if ($no5_3) {
$sql_search .= $sop." no5 like '%$no5_3%' ";
    $sop = "or";
}
    if ($no5_4) {
$sql_search .= $sop." no5 like '%$no5_4%' ";
    $sop = "or";
}
    if ($no5_5) {
$sql_search .= $sop." no5 like '%$no5_5%' ";
    $sop = "or";
}
    if ($no5_6) {
$sql_search .= $sop." no5 like '%$no5_6%' ";
    $sop = "or";
}
    if ($no5_7) {
$sql_search .= $sop." no5 like '%$no5_7%' ";
    $sop = "or";
}
    if ($no5_8) {
$sql_search .= $sop." no5 like '%$no5_8%' ";
    $sop = "or";
}
    if ($no5_9) {
$sql_search .= $sop." no5 like '%$no5_9%' ";
    $sop = "or";
}
    if ($no5_10) {
$sql_search .= $sop." no5 like '%$no5_10%' ";
    $sop = "or";
}
    if ($no5_11) {
$sql_search .= $sop." no5 like '%$no5_11%' ";
    $sop = "or";
}
    if ($no5_12) {
$sql_search .= $sop." no5 like '%$no5_12%' ";
    $sop = "or";
}
    if ($no5_13) {
$sql_search .= $sop." no5 like '%$no5_13%' ";
    $sop = "or";
}
    if ($no5_14) {
$sql_search .= $sop." no5 like '%$no5_14%' ";
    $sop = "or";
}
    if ($no5_15) {
$sql_search .= $sop." no5 like '%$no5_15%' ";
    $sop = "or";
}
    if ($no5_16) {
$sql_search .= $sop." no5 like '%$no5_16%' ";
    $sop = "or";
}
    if ($no5_17) {
$sql_search .= $sop." no5 like '%$no5_17%' ";
    $sop = "or";
}
    if ($no5_18) {
$sql_search .= $sop." no5 like '%$no5_18%' ";
    $sop = "or";
}
    if ($no5_19) {
$sql_search .= $sop." no5 like '%$no5_19%' ";
    $sop = "or";
}
    if ($no5_20) {
$sql_search .= $sop." no5 like '%$no5_20%' ";
    $sop = "and";
}

    if ($stx_type == 'name' && $stx) {
$sql_search .= $sop." wr_subject like '%$stx%' ";
    $sop = "and";
}
    if ($stx_type == 'model' && $stx) {
$sql_search .= $sop." wr_msubject like '%$stx%' ";
    $sop = "and";
}
    if ($stx_type == 'code' && $stx) {
$sql_search .= $sop." wr_1 like '%$stx%' ";
    $sop = "and";
}
    if ($stx_type == 'country' && $stx) {
$sql_search .= $sop." wr_6 like '%$stx%' ";
    $sop = "and";
}
    if ($stx_type == 'made' && $stx) {
$sql_search .= $sop." wr_7 like '%$stx%' ";
    $sop = "and";
}



    $search_href = "./item.php?bo_table=$bo_table&sca=$sca&price1=$price1&price2=$price2&no1=$no1&no2=$no2&no3=$no3&no4=$no4&no5=$no5&page=$page" . $qstr;
    $list_href = "./item.php?bo_table=$bo_table&price1=$price1&price2=$price2&no1=$no1&no2=$no2&no3=$no3&no4=$no4&no5=$no5";






    // 가장 작은 번호를 얻어서 변수에 저장 (하단의 페이징에서 사용)
    $sql = " select MIN(wr_num) as min_wr_num from $write_table ";
    $row = sql_fetch($sql);
    $min_spt = $row[min_wr_num];

    if (!$spt) $spt = $min_spt;

    $sql_search .= " and (wr_num between '".$spt."' and '".($spt + $config[cf_search_part])."') ";

    // 원글만 얻는다. (코멘트의 내용도 검색하기 위함)
    $sql = " select distinct wr_parent from $write_table where $sql_search ";
    $result = sql_query($sql);
    $total_count = mysql_num_rows($result);
}
else
{
    $sql_search = "";

    $total_count = $board[bo_count_write];
}

$total_page  = ceil($total_count / $board[bo_page_rows]);  // 전체 페이지 계산
if (!$page) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $board[bo_page_rows]; // 시작 열을 구함

// 관리자라면 CheckBox 보임
$is_checkbox = false;
if ($member[mb_id] && ($is_admin == "super" || $group[gr_admin] == $member[mb_id] || $board[bo_admin] == $member[mb_id]))
    $is_checkbox = true;

// 정렬에 사용하는 QUERY_STRING
$qstr2 = "bo_table=$bo_table&sop=$sop";

if ($board[bo_gallery_cols])
    $td_width = (int)(100 / $board[bo_gallery_cols]);

// 정렬
// 인덱스 필드가 아니면 정렬에 사용하지 않음
//if (!$sst || ($sst && !(strstr($sst, 'wr_id') || strstr($sst, "wr_datetime")))) {
if (!$sst)
{
    $sst  = "wr_num, wr_reply";
    $sod = "";
}
$sql_order = " order by $sst $sod ";

if ($sca || $stx || $price1 || $price2 || $no1 || $no2_0 || $no2_1 || $no2_2 || $no2_3 || $no2_4 || $no2_5 || $no2_6 || $no2_7 || $no2_8 || $no2_9 || $no2_10 || $no2_1 || $no2_12 || $no2_13 || $no2_14 || $no2_15 || $no2_16 || $no2_17 || $no2_18 || $no2_19 || $no2_20 || $no5_0 || $no5_1 || $no5_2 || $no5_3 || $no5_4 || $no5_5 || $no5_6 || $no5_7 || $no5_8 || $no5_9 || $no5_10 || $no5_1 || $no5_12 || $no5_13 || $no5_14 || $no5_15 || $no5_16 || $no5_17 || $no5_18 || $no5_19 || $no5_20)
{
    $sql = " select distinct wr_parent from $write_table where $sql_search and no = 'ok' $sql_order limit $from_record, $board[bo_page_rows] ";
}
else
{
    $sql = " select * from $write_table where wr_is_comment = 0 and no = 'ok'  $sql_order limit $from_record, $board[bo_page_rows] ";
}
$result = sql_query($sql);

// 년도 2자리
$today2 = $g4[time_ymd];

$list = array();
$i = 0;

if (!$sca && !$stx)
{
    $arr_notice = split("\n", trim($board[bo_notice]));
    for ($k=0; $k<count($arr_notice); $k++)
    {
        $row = sql_fetch(" select * from $write_table where wr_id = '$arr_notice[$k]' ");
        if (!$row[wr_id])
            continue;

        $list[$i] = get_list($row, $board, $board_skin_path, $board[bo_subject_len]);
        $list[$i][is_notice] = true;

        $i++;
    }
}

$k = 0;
$notice_su=$i;

while ($row = sql_fetch_array($result))
{
if (!$sca && !$stx)
if(in_array($row[wr_id],$arr_notice)) continue;
// 검색일 경우 wr_id만 얻었으므로 다시 한행을 얻는다
    if ($sca || $stx || $price1 || $price2 || $no1 || $no2_0 || $no2_1 || $no2_2 || $no2_3 || $no2_4 || $no2_5 || $no2_6 || $no2_7 || $no2_8 || $no2_9 || $no2_10 || $no2_1 || $no2_12 || $no2_13 || $no2_14 || $no2_15 || $no2_16 || $no2_17 || $no2_18 || $no2_19 || $no2_20 || $no5_0 || $no5_1 || $no5_2 || $no5_3 || $no5_4 || $no5_5 || $no5_6 || $no5_7 || $no5_8 || $no5_9 || $no5_10 || $no5_1 || $no5_12 || $no5_13 || $no5_14 || $no5_15 || $no5_16 || $no5_17 || $no5_18 || $no5_19 || $no5_20)
        $row = sql_fetch(" select * from $write_table where wr_id = '$row[wr_parent]' ");

    $list[$i] = get_list($row, $board, $board_skin_path, $board[bo_subject_len]);
    if (strstr($sfl, "subject"))
        $list[$i][subject] = search_font($stx, $list[$i][subject]);
    $list[$i][is_notice] = false;
    //$list[$i][num] = number_format($total_count - ($page - 1) * $board[bo_page_rows] - $k);
    //$list[$i][num] = $total_count - ($page - 1) * $board[bo_page_rows] - $k;
$list[$i][num] = number_format($total_count - ($page - 1) * $board[bo_page_rows] - $k - $notice_su);

    $i++;
    $k++;
}

$write_pages = get_paging($config[cf_write_pages], $page, $total_page, "./item.php?bo_table=$bo_table&price1=$price1&price2=$price2&no1=$no1&no2=$no2&no3=$no3&no4=$no4&no5=$no5".$qstr."&page=");

$list_href = '';
$prev_part_href = '';
$next_part_href = '';
if ($sca || $stx || $price1 || $price2 || $no1 || $no2_0 || $no2_1 || $no2_2 || $no2_3 || $no2_4 || $no2_5 || $no2_6 || $no2_7 || $no2_8 || $no2_9 || $no2_10 || $no2_1 || $no2_12 || $no2_13 || $no2_14 || $no2_15 || $no2_16 || $no2_17 || $no2_18 || $no2_19 || $no2_20 || $no5_0 || $no5_1 || $no5_2 || $no5_3 || $no5_4 || $no5_5 || $no5_6 || $no5_7 || $no5_8 || $no5_9 || $no5_10 || $no5_1 || $no5_12 || $no5_13 || $no5_14 || $no5_15 || $no5_16 || $no5_17 || $no5_18 || $no5_19 || $no5_20) 
{
    $list_href = "./item.php?bo_table=$bo_table&price1=$price1&price2=$price2&no1=$no1&no2=$no2&no3=$no3&no4=$no4&no5=$no5";

    //if ($prev_spt >= $min_spt)
    $prev_spt = $spt - $config[cf_search_part];
    if (isset($min_spt) && $prev_spt >= $min_spt)
        $prev_part_href = "./item.php?bo_table=$bo_table&price1=$price1&price2=$price2&no1=$no1&no2=$no2&no3=$no3&no4=$no4&no5=$no5".$qstr."&spt=$prev_spt";

    $next_spt = $spt + $config[cf_search_part];
    if ($next_spt < 0)
        $next_part_href = "./item.php?bo_table=$bo_table&price1=$price1&price2=$price2&no1=$no1&no2=$no2&no3=$no3&no4=$no4&no5=$no5".$qstr."&spt=$next_spt";
}

$write_href = "";
if ($member[mb_level] >= $board[bo_write_level])
    $write_href = "./write.php?bo_table=$bo_table";

$nobr_begin = $nobr_end = "";
if (preg_match("/gecko|firefox/i", $_SERVER['HTTP_USER_AGENT'])) {
    $nobr_begin = "<nobr style='display:block; overflow:hidden;'>";
    $nobr_end  = "</nobr>";
}

// 4.00.12
$rss_href = "./rss.php?bo_table=$bo_table";

include_once("$board_skin_path/list.skin.php");




}

    include_once("./board_tail.php");
}
else
    include_once("./view_comment.php");

echo "\n<!-- 사용스킨 : $board[bo_skin] -->\n";




}

include_once("$g4[path]/tail.sub.php");
?>
  • 복사

댓글 전체

© SIRSOFT
현재 페이지 제일 처음으로