회원검색시 검색글자수 제한 문의드립니다 정보
회원검색시 검색글자수 제한 문의드립니다본문
팁 게시판에 올려주신 회원검색 자료를 활용하여
현재 회원검색 페이지를 적용해보았습니다
그런데, 접속을 하면 첫 화면에 모든 회원이 다 나타나는 불편함이 있습니다
그래서 생각한것이
검색어가 2글자 이하이면 검색이 안되게 하고 싶습니다
어느부분을 수정해야될지를 도저히 모르겠습니다
조언 부탁드립니다
----------------------------------
<?
include_once("./_common.php");
$g4[title] = "";
//if (!$member[mb_id]) { alert("로그인해야 사용가능합니다."); }
//else { // 로그인후 사용가능
include_once("./_head.php");
$sql_common = " from $g4[member_table] ";
$qstr = "";
if (isset($Usex)) $qstr .= '&Usex=' . urlencode($Usex);
if (isset($UageF)) $qstr .= '&UageF=' . urlencode($UageF);
if (isset($UageT)) $qstr .= '&UageT=' . urlencode($UageT);
if (isset($Uid)) $qstr .= '&Uid=' . urlencode($Uid);
if (isset($UregF)) $qstr .= '&UregF=' . urlencode($UregF);
if (isset($UregT)) $qstr .= '&UregT=' . urlencode($UregT);
if (isset($Unick)) $qstr .= '&Unick=' . urlencode($Unick);
$sql_search = " where (1) ";
if ($Usex) { $sql_search .= " and (mb_sex = '$Usex') "; }
if ($UageF) { $sql_search .= " and (mb_birth <= '$UageF') "; }
if ($UageT) { $sql_search .= " and (mb_birth >= '$UageT') "; }
//if ($Uid) { $sql_search .= " and (mb_id = '$Uid') "; }
if ($Uid) { $sql_search .= " and (mb_id like '%$Uid%') "; }
if ($UregF) { $sql_search .= " and (mb_datetime >= '$UregF') "; }
if ($UregT) { $sql_search .= " and (mb_datetime <= '$UregT') "; }
if ($Unick) { $sql_search .= " and (mb_nick like '%$Unick%') "; }
if (!$sst) {
$sst = "mb_datetime";
$sod = "desc";
}
$sql_order = " and mb_level != '10' order by $sst $sod ";
$sql = " select count(*) as cnt
$sql_common
$sql_search
$sql_order ";
$row = sql_fetch($sql);
$total_count = $row[cnt];
//$rows = $config[cf_page_rows];
$rows = "15";
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if (!$page) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$listall = "<a href='$_SERVER[PHP_SELF]' class=tt>처음</a>";
$sql = " select *
$sql_common
$sql_search
$sql_order
limit $from_record, $rows ";
$result = sql_query($sql);
?>
<style type="text/css">
<!--
.padd5 { padding:5px; }
.Cgreen { color:#88aa88; }
.Cred { color:#aa8888; }
.Cwhite { color:#ffffff; }
.line { background:#FBBA42; height:1px; }
.line0 { height:5px; }
.inputO { background:#eeeccc; border: solid #DC9003 1px; }
.inputOr { background:#eeeccc; border: solid #DC9003 1px; text-align:right;padding:0 5 0 0; }
.inputW { background:#ffffcc; border: solid #DC9003 1px; }
.td_pdL { padding:5 5 5 0; }
.dotO { font-size:10pt;color:#DC9003; }
.small5 { font-size:8pt;font-family:돋움;color:#555555; }
-->
</style>
<div style="margin-top:0; margin-right:0; margin-bottom:10; margin-left:0; padding:5px; border-top-width:0; border-right-width:0; border-bottom-width:1; border-left-width:0; border-color:rgb(153,153,153); border-style:dashed;">
▶<a href='<?=$g4[path]?>/search_member.php' style='color:#333333;'><b>회원검색
</b></a>
</div>
<form name="frmMemSearch" action="<?=$g4[path]?>/search_member.php" method="get" style='margin:0px;'>
<div style="background-color:rgb(204,202,170); margin-top:10; margin-right:0; margin-bottom:10; margin-left:0; padding:0;">
<table cellpadding=0 cellspacing=0 align=center width=630>
<tr>
<td class='td_pdL' colspan=2><span class='dotO'>●</span> <b>아이디
<input type=text size=10 class=inputO name='Uid' value='<?=$Uid?>'>
<td class='td_pdL' colspan=2><span class='dotO'>●</span> <b>닉네임
<input type=text size=10 class=inputO name='Unick' value='<?=$Unick?>'>
<td class='td_pdL'>
<input type=submit value=' 회 원 검 색 '>
<tr><td colspan=6 height=1 bgcolor=#DC9003>
</table>
</div>
</form>
<!-----------회원검색 목록------------->
<table width="100%" cellpadding=0 cellspacing=0>
<colgroup width='130'><colgroup width=''><colgroup width=''><colgroup width='120'>
<tr align=center bgcolor=#aaa888 height=25>
<td class=Cwhite>아이디<td class=Cwhite>닉네임<td class=Cwhite>성별<td class=Cwhite>가입일<td class=Cwhite>
<?
$colspan = 5;
for ($i=0; $row=sql_fetch_array($result); $i++) {
$pf = get_member($row[mb_id]);
if ($pf[mb_sex] == 'M') { $pf_sex = "男"; }
else if ($pf[mb_sex] == 'F') { $pf_sex = "女"; }
$thisY = date("Y");
$birthY = substr($pf[mb_birth],0,4);
$pf_age = $thisY - $birthY + 1;
echo "<tr><td colspan='$colspan' class=line0>";
echo "<tr align=center>";
echo "<td><b>".$pf[mb_id]."</b>";
echo "<td><b>".$pf[mb_nick]."</b>";
echo "<td>".$pf_sex;
echo "<td>".$pf[mb_datetime];
echo "<tr><td colspan='$colspan' class=line0><tr><td colspan='$colspan' class=line>";
}
if ($i == 0)
echo "<tr><td colspan='$colspan' align=center height=100>자료가 없습니다.</td></tr>";
?>
</tr></table>
<?
$pagelist = get_paging($config[cf_write_pages], $page, $total_page, "?$qstr&page=");
echo "<br /><table width=100% cellpadding=3 cellspacing=1>";
echo "<tr>";
echo "<td align=center>$pagelist</td></tr></table>";
?>
<?
include_once("./_tail.php");
//} // 로그인후 사용가능
?>
현재 회원검색 페이지를 적용해보았습니다
그런데, 접속을 하면 첫 화면에 모든 회원이 다 나타나는 불편함이 있습니다
그래서 생각한것이
검색어가 2글자 이하이면 검색이 안되게 하고 싶습니다
어느부분을 수정해야될지를 도저히 모르겠습니다
조언 부탁드립니다
----------------------------------
<?
include_once("./_common.php");
$g4[title] = "";
//if (!$member[mb_id]) { alert("로그인해야 사용가능합니다."); }
//else { // 로그인후 사용가능
include_once("./_head.php");
$sql_common = " from $g4[member_table] ";
$qstr = "";
if (isset($Usex)) $qstr .= '&Usex=' . urlencode($Usex);
if (isset($UageF)) $qstr .= '&UageF=' . urlencode($UageF);
if (isset($UageT)) $qstr .= '&UageT=' . urlencode($UageT);
if (isset($Uid)) $qstr .= '&Uid=' . urlencode($Uid);
if (isset($UregF)) $qstr .= '&UregF=' . urlencode($UregF);
if (isset($UregT)) $qstr .= '&UregT=' . urlencode($UregT);
if (isset($Unick)) $qstr .= '&Unick=' . urlencode($Unick);
$sql_search = " where (1) ";
if ($Usex) { $sql_search .= " and (mb_sex = '$Usex') "; }
if ($UageF) { $sql_search .= " and (mb_birth <= '$UageF') "; }
if ($UageT) { $sql_search .= " and (mb_birth >= '$UageT') "; }
//if ($Uid) { $sql_search .= " and (mb_id = '$Uid') "; }
if ($Uid) { $sql_search .= " and (mb_id like '%$Uid%') "; }
if ($UregF) { $sql_search .= " and (mb_datetime >= '$UregF') "; }
if ($UregT) { $sql_search .= " and (mb_datetime <= '$UregT') "; }
if ($Unick) { $sql_search .= " and (mb_nick like '%$Unick%') "; }
if (!$sst) {
$sst = "mb_datetime";
$sod = "desc";
}
$sql_order = " and mb_level != '10' order by $sst $sod ";
$sql = " select count(*) as cnt
$sql_common
$sql_search
$sql_order ";
$row = sql_fetch($sql);
$total_count = $row[cnt];
//$rows = $config[cf_page_rows];
$rows = "15";
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if (!$page) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$listall = "<a href='$_SERVER[PHP_SELF]' class=tt>처음</a>";
$sql = " select *
$sql_common
$sql_search
$sql_order
limit $from_record, $rows ";
$result = sql_query($sql);
?>
<style type="text/css">
<!--
.padd5 { padding:5px; }
.Cgreen { color:#88aa88; }
.Cred { color:#aa8888; }
.Cwhite { color:#ffffff; }
.line { background:#FBBA42; height:1px; }
.line0 { height:5px; }
.inputO { background:#eeeccc; border: solid #DC9003 1px; }
.inputOr { background:#eeeccc; border: solid #DC9003 1px; text-align:right;padding:0 5 0 0; }
.inputW { background:#ffffcc; border: solid #DC9003 1px; }
.td_pdL { padding:5 5 5 0; }
.dotO { font-size:10pt;color:#DC9003; }
.small5 { font-size:8pt;font-family:돋움;color:#555555; }
-->
</style>
<div style="margin-top:0; margin-right:0; margin-bottom:10; margin-left:0; padding:5px; border-top-width:0; border-right-width:0; border-bottom-width:1; border-left-width:0; border-color:rgb(153,153,153); border-style:dashed;">
▶<a href='<?=$g4[path]?>/search_member.php' style='color:#333333;'><b>회원검색
</b></a>
</div>
<form name="frmMemSearch" action="<?=$g4[path]?>/search_member.php" method="get" style='margin:0px;'>
<div style="background-color:rgb(204,202,170); margin-top:10; margin-right:0; margin-bottom:10; margin-left:0; padding:0;">
<table cellpadding=0 cellspacing=0 align=center width=630>
<tr>
<td class='td_pdL' colspan=2><span class='dotO'>●</span> <b>아이디
<input type=text size=10 class=inputO name='Uid' value='<?=$Uid?>'>
<td class='td_pdL' colspan=2><span class='dotO'>●</span> <b>닉네임
<input type=text size=10 class=inputO name='Unick' value='<?=$Unick?>'>
<td class='td_pdL'>
<input type=submit value=' 회 원 검 색 '>
<tr><td colspan=6 height=1 bgcolor=#DC9003>
</table>
</div>
</form>
<!-----------회원검색 목록------------->
<table width="100%" cellpadding=0 cellspacing=0>
<colgroup width='130'><colgroup width=''><colgroup width=''><colgroup width='120'>
<tr align=center bgcolor=#aaa888 height=25>
<td class=Cwhite>아이디<td class=Cwhite>닉네임<td class=Cwhite>성별<td class=Cwhite>가입일<td class=Cwhite>
<?
$colspan = 5;
for ($i=0; $row=sql_fetch_array($result); $i++) {
$pf = get_member($row[mb_id]);
if ($pf[mb_sex] == 'M') { $pf_sex = "男"; }
else if ($pf[mb_sex] == 'F') { $pf_sex = "女"; }
$thisY = date("Y");
$birthY = substr($pf[mb_birth],0,4);
$pf_age = $thisY - $birthY + 1;
echo "<tr><td colspan='$colspan' class=line0>";
echo "<tr align=center>";
echo "<td><b>".$pf[mb_id]."</b>";
echo "<td><b>".$pf[mb_nick]."</b>";
echo "<td>".$pf_sex;
echo "<td>".$pf[mb_datetime];
echo "<tr><td colspan='$colspan' class=line0><tr><td colspan='$colspan' class=line>";
}
if ($i == 0)
echo "<tr><td colspan='$colspan' align=center height=100>자료가 없습니다.</td></tr>";
?>
</tr></table>
<?
$pagelist = get_paging($config[cf_write_pages], $page, $total_page, "?$qstr&page=");
echo "<br /><table width=100% cellpadding=3 cellspacing=1>";
echo "<tr>";
echo "<td align=center>$pagelist</td></tr></table>";
?>
<?
include_once("./_tail.php");
//} // 로그인후 사용가능
?>
댓글 전체
<input type=submit value=' 회 원 검 색 '>
이부분을
<input type=button value=' 회 원 검 색 ' onclick='go_search();'>
이런식으로 클릭시 go_search 함수를 호출하게 하신뒤에
function go_search(){
if(document.frmMemSearch.Uid.value.length < 2){
alert('검색어는 2자이상 입력하세요.');
}
}
위와같이 처리하시면 될꺼 같습니다
이부분을
<input type=button value=' 회 원 검 색 ' onclick='go_search();'>
이런식으로 클릭시 go_search 함수를 호출하게 하신뒤에
function go_search(){
if(document.frmMemSearch.Uid.value.length < 2){
alert('검색어는 2자이상 입력하세요.');
}
}
위와같이 처리하시면 될꺼 같습니다
명쾌한 답변 감사드립니다
적용해본 결과 매우 잘되고 있습니다
첫페이지에 모든 검색값이 뜨는거는 어찌할수 없는지요?^^
적용해본 결과 매우 잘되고 있습니다
첫페이지에 모든 검색값이 뜨는거는 어찌할수 없는지요?^^