<?php include_once './_common.php'; $g5['title'] = "상품 검색 결과"; include_once G5_MSHOP_PATH . '/_head.php'; // QUERY 문에 공통적으로 들어가는 내용 // 상품명에 검색어가 포한된것과 상품판매가능인것만 $sql_common = " from {$g5['g5_shop_item_table']} a, {$g5['g5_shop_category_table']} b "; $where = array(); $where[] = " (a.ca_id = b.ca_id and a.it_use = 1 and b.ca_use = 1) "; $search_all = false; // 상세검색 이라면 if (isset($_GET['qname']) || isset($_GET['qexplan']) || isset($_GET['qid'])) { $search_all = false; } $q = utf8_strcut(get_search_string(trim($_GET['q'])), 30, ""); $qname = isset($_GET['qname']) ? trim($_GET['qname']) : ''; $qexplan = isset($_GET['qexplan']) ? trim($_GET['qexplan']) : ''; $qid = isset($_GET['qid']) ? trim($_GET['qid']) : ''; $qcaid = isset($_GET['qcaid']) ? trim($_GET['qcaid']) : ''; $qfrom = isset($_GET['qfrom']) ? preg_replace('/[^0-9]/', '', trim($_GET['qfrom'])) : ''; $qto = isset($_GET['qto']) ? preg_replace('/[^0-9]/', '', trim($_GET['qto'])) : ''; if (isset($_GET['qsort'])) { $qsort = trim($_GET['qsort']); $qsort = preg_replace("/[\\<\\>\\'\"\\\\'\\\"\\%\\=\\(\\)\\s]/", "", $qsort); } else { $qsort = ''; } if (isset($_GET['qorder'])) { $qorder = preg_match("/^(asc|desc)\$/i", $qorder) ? $qorder : ''; } else {
<?php include_once './_common.php'; $g5['title'] = '전체검색 결과'; include_once './_head.php'; $search_table = array(); $table_index = 0; $write_pages = ""; $text_stx = ""; $srows = 0; $stx = strip_tags($stx); //$stx = preg_replace('/[[:punct:]]/u', '', $stx); // 특수문자 제거 $stx = get_search_string($stx); // 특수문자 제거 if ($stx) { $stx = preg_replace('/\\//', '\\/', trim($stx)); $sop = strtolower($sop); if (!$sop || !($sop == 'and' || $sop == 'or')) { $sop = 'and'; } // 연산자 and , or $srows = isset($_GET['srows']) ? (int) preg_replace('#[^0-9]#', '', $_GET['srows']) : 10; if (!$srows) { $srows = 10; } // 한페이지에 출력하는 검색 행수 $g5_search['tables'] = array(); $g5_search['read_level'] = array(); $sql = " select gr_id, bo_table, bo_read_level from {$g5['board_table']} where bo_use_search = 1 and bo_list_level <= '{$member['mb_level']}' "; if ($gr_id) { $sql .= " and gr_id = '{$gr_id}' ";
} else { $sca = ''; } if (isset($_REQUEST['sfl'])) { $sfl = trim($_REQUEST['sfl']); $sfl = preg_replace("/[\\<\\>\\'\"\\\\'\\\"\\%\\=\\(\\)\\s]/", "", $sfl); if ($sfl) { $qstr .= '&sfl=' . urlencode($sfl); } // search field (검색 필드) } else { $sfl = ''; } if (isset($_REQUEST['stx'])) { // search text (검색어) $stx = get_search_string(trim($_REQUEST['stx'])); if ($stx) { $qstr .= '&stx=' . urlencode(cut_str($stx, 20, '')); } } else { $stx = ''; } if (isset($_REQUEST['sst'])) { $sst = trim($_REQUEST['sst']); $sst = preg_replace("/[\\<\\>\\'\"\\\\'\\\"\\%\\=\\(\\)\\s]/", "", $sst); if ($sst) { $qstr .= '&sst=' . urlencode($sst); } // search sort (검색 정렬 필드) } else { $sst = '';
<?php include "db.php"; //set_time_limit(0); //ini_set('display_errors', true); error_reporting(E_ALL); $type = $_POST['type']; if ($type == 'device_search') { $device_data = get_search_string($_REQUEST['device_data']); $res = array(); $q = "SELECT devices.id as id, name, description, location, title, first_name, last_name, address, phone, email " . "FROM devices JOIN persons ON persons.id = devices.person_id " . "WHERE MATCH (name, description) " . "AGAINST ( ? IN BOOLEAN MODE )"; if ($stmt = $db->prepare($q)) { $stmt->bind_param("s", $device_data); $stmt->execute(); $stmt->bind_result($id, $name, $description, $location, $title, $first_name, $last_name, $address, $phone, $email); while ($stmt->fetch()) { $res[] = array("id" => $id, "name" => $name, "description" => utf8_encode($description), "location" => $location, "title" => $title, "first_name" => $first_name, "last_name" => $last_name, "address" => $address, "phone" => $phone, "email" => $email); } $stmt->close(); } echo json_encode($res); } else { if ($type == 'get_all_devices') { $res = array(); $q = "SELECT devices.id as id, name, description, location, title, first_name, last_name, address, phone, email " . "FROM devices JOIN persons ON persons.id = devices.person_id "; if ($stmt = $db->prepare($q)) { $stmt->execute(); $stmt->bind_result($id, $name, $description, $location, $title, $first_name, $last_name, $address, $phone, $email); while ($stmt->fetch()) { $res[] = array("id" => $id, "name" => $name, "description" => utf8_encode($description), "location" => $location, "title" => $title, "first_name" => $first_name, "last_name" => $last_name, "address" => $address, "phone" => $phone, "email" => $email); }
include_once G5_MSHOP_PATH . '/category.php'; // 분류 ?> <button type="button" id="hd_sch_open">검색<span class="sound_only"> 열기</span></button> <form name="frmsearch1" action="<?php echo G5_SHOP_URL; ?> /search.php" onsubmit="return search_submit(this);"> <aside id="hd_sch"> <div class="sch_inner"> <h2>상품 검색</h2> <label for="sch_str" class="sound_only">상품명<strong class="sound_only"> 필수</strong></label> <input type="text" name="q" value="<?php echo stripslashes(get_text(get_search_string($q))); ?> " id="sch_str" required class="frm_input"> <input type="submit" value="검색" class="btn_submit"> <button type="button" class="pop_close"><span class="sound_only">검색 </span>닫기</button> </div> </aside> </form> <script> $(function (){ var $hd_sch = $("#hd_sch"); $("#hd_sch_open").click(function(){ $hd_sch.css("display","block"); }); $("#hd_sch .pop_close").click(function(){ $hd_sch.css("display","none");
function clean_query_string($query, $amp = true) { $qstr = trim($query); parse_str($qstr, $out); if (is_array($out)) { $q = array(); foreach ($out as $key => $val) { $key = strip_tags(trim($key)); $val = trim($val); switch ($key) { case 'wr_id': $val = (int) preg_replace('/[^0-9]/', '', $val); $q[$key] = $val; break; case 'sca': $val = clean_xss_tags($val); $q[$key] = $val; break; case 'sfl': $val = preg_replace("/[\\<\\>\\'\"\\\\'\\\"\\%\\=\\(\\)\\s]/", "", $val); $q[$key] = $val; break; case 'stx': $val = get_search_string($val); $q[$key] = $val; break; case 'sst': $val = preg_replace("/[\\<\\>\\'\"\\\\'\\\"\\%\\=\\(\\)\\s]/", "", $val); $q[$key] = $val; break; case 'sod': $val = preg_match("/^(asc|desc)\$/i", $val) ? $val : ''; $q[$key] = $val; break; case 'sop': $val = preg_match("/^(or|and)\$/i", $val) ? $val : ''; $q[$key] = $val; break; case 'spt': $val = (int) preg_replace('/[^0-9]/', '', $val); $q[$key] = $val; break; case 'page': $val = (int) preg_replace('/[^0-9]/', '', $val); $q[$key] = $val; break; case 'w': $val = substr($val, 0, 2); $q[$key] = $val; break; case 'bo_table': $val = preg_replace('/[^a-z0-9_]/i', '', $val); $val = substr($val, 0, 20); $q[$key] = $val; break; case 'gr_id': $val = preg_replace('/[^a-z0-9_]/i', '', $val); $q[$key] = $val; break; default: $val = clean_xss_tags($val); $q[$key] = $val; break; } } if ($amp) { $sep = '&'; } else { $sep = '&'; } $str = http_build_query($q, '', $sep); } else { $str = clean_xss_tags($qstr); } return $str; }
$pid = $pid ? $pid : 'tag'; $at = apms_page_thema($pid); if (!defined('THEMA_PATH')) { include_once G5_LIB_PATH . '/apms.thema.lib.php'; } $tag_skin_path = get_skin_path('tag', G5_IS_MOBILE ? $config['as_mobile_tag_skin'] : $config['as_tag_skin']); $tag_skin_url = get_skin_url('tag', G5_IS_MOBILE ? $config['as_mobile_tag_skin'] : $config['as_tag_skin']); $g5['title'] = '태그박스'; include_once G5_PATH . '/head.php'; $skin_path = $tag_skin_path; $skin_url = $tag_skin_url; // 검색결과 if ($q || $stx) { $q = $stx ? $stx : $q; $q = strip_tags($q); $q = get_search_string($q); // 특수문자 제거 $op1 = ''; // 검색어를 구분자로 나눈다. 여기서는 공백 $s = explode(',', strip_tags($q)); // 검색필드를 구분자로 나눈다. 여기서는 + $field = array('tag'); $str = '('; for ($i = 0; $i < count($s); $i++) { if (trim($s[$i]) == '') { continue; } $search_str = $s[$i]; // 인기검색어 insert_popular($field, $search_str); $str .= $op1;