1:1문의에 제목, 내용, 글쓴이, 회원아이디 선택후 검색이 가능하도록 수정 (북마크스님,210812)

This commit is contained in:
kagla
2021-08-13 02:02:21 +00:00
parent 8d7bdb331d
commit 0731b57c80
6 changed files with 41 additions and 9 deletions

View File

@ -58,15 +58,33 @@ if(is_file($skin_file)) {
$stx = trim($stx);
if($stx) {
if (preg_match("/[a-zA-Z]/", $stx))
$sql_search .= " and ( INSTR(LOWER(qa_subject), LOWER('$stx')) > 0 or INSTR(LOWER(qa_content), LOWER('$stx')) > 0 )";
else
$sql_search .= " and ( INSTR(qa_subject, '$stx') > 0 or INSTR(qa_content, '$stx') > 0 ) ";
$sfl = trim($sfl);
if ($sfl) {
switch ($sfl) {
case "qa_subject" :
case "qa_content" :
case "qa_name" :
case "mb_id" :
break;
default :
$sfl = "qa_subject";
}
} else {
$sfl = "qa_subject";
}
$sql_search .= " and (`{$sfl}` like '%{$stx}%') ";
}
// $stx = trim($stx);
// if($stx) {
// if (preg_match("/[a-zA-Z]/", $stx))
// $sql_search .= " and ( INSTR(LOWER(qa_subject), LOWER('$stx')) > 0 or INSTR(LOWER(qa_content), LOWER('$stx')) > 0 )";
// else
// $sql_search .= " and ( INSTR(qa_subject, '$stx') > 0 or INSTR(qa_content, '$stx') > 0 ) ";
// }
$sql_order = " order by qa_num ";
$sql = " select count(*) as cnt
$sql = " select count(*) as cnt
$sql_common
$sql_search ";
$row = sql_fetch($sql);

View File

@ -457,6 +457,20 @@ function get_board_sfl_select_options($sfl){
return run_replace('get_board_sfl_select_options', $str, $sfl);
}
function get_qa_sfl_select_options($sfl) {
global $is_admin;
$str = '';
$str .= '<option value="qa_subject" '.get_selected($sfl, 'qa_subject', true).'>제목</option>';
$str .= '<option value="qa_content" '.get_selected($sfl, 'qa_content').'>내용</option>';
$str .= '<option value="qa_name" '.get_selected($sfl, 'qa_name').'>글쓴이</option>';
if ($is_admin)
$str .= '<option value="mb_id" '.get_selected($sfl, 'mb_id').'>회원아이디</option>';
return run_replace('get_qa_sfl_select_options', $str, $sfl);
}
// 읽지 않은 메모 갯수 반환
function get_memo_not_read($mb_id, $add_where='')
{

View File

@ -118,7 +118,7 @@ add_stylesheet('<link rel="stylesheet" href="'.$qa_skin_url.'/style.css">', 0);
<input type="hidden" name="sop" value="and">
<label for="sfl" class="sound_only">검색대상</label>
<select name="sfl" id="sfl">
<?php echo get_board_sfl_select_options($sfl); ?>
<?php echo get_qa_sfl_select_options($sfl); ?>
</select>
<label for="stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<input type="text" name="stx" value="<?php echo stripslashes($stx) ?>" required placeholder="검색어를 입력하세요" id="stx" class="sch_input" size="15" maxlength="15">

View File

@ -44,7 +44,7 @@ add_stylesheet('<link rel="stylesheet" href="'.$qa_skin_url.'/style.css">', 0);
<input type="hidden" name="sop" value="and">
<label for="sfl" class="sound_only">검색대상</label>
<select name="sfl" id="sfl">
<?php echo get_board_sfl_select_options($sfl); ?>
<?php echo get_qa_sfl_select_options($sfl); ?>
</select>
<label for="stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<div class="sch_bar">

View File

@ -118,7 +118,7 @@ add_stylesheet('<link rel="stylesheet" href="'.$qa_skin_url.'/style.css">', 0);
<input type="hidden" name="sop" value="and">
<label for="sfl" class="sound_only">검색대상</label>
<select name="sfl" id="sfl">
<?php echo get_board_sfl_select_options($sfl); ?>
<?php echo get_qa_sfl_select_options($sfl); ?>
</select>
<label for="stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<input type="text" name="stx" value="<?php echo stripslashes($stx) ?>" required placeholder="검색어를 입력하세요" id="stx" class="sch_input" size="15" maxlength="15">

View File

@ -44,7 +44,7 @@ add_stylesheet('<link rel="stylesheet" href="'.$qa_skin_url.'/style.css">', 0);
<input type="hidden" name="sop" value="and">
<label for="sfl" class="sound_only">검색대상</label>
<select name="sfl" id="sfl">
<?php echo get_board_sfl_select_options($sfl); ?>
<?php echo get_qa_sfl_select_options($sfl); ?>
</select>
<label for="stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<div class="sch_bar">