묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
멤버리스트 소스 좀 봐주세요..
2003.06.16 03:02
<?
//====================== 설정해주세요 =========================
// 제로보드 절대경로, 뒤에 반드시 / 붙이세요.
$_zb_path="/절대경로/bbs/";
// 제로보드 URL, 뒤에 반드시 / 붙이세요.
$_zb_url = "http://사이트주소/bbs/";
// 멤버리스트 열람 가능 레벨
$permission_level = "10";
// 로그인 회수/점수 최근로그인 시각을 사용하면 1, 사용 안하면 0
$apply_login_point = "0";
// 한화면에 몇명씩 보여줄 것인지....
$max_line = '20';
// 보여줄 페이지수 [이전] [1][2][3][4]....[8][9][10] [다음] 이런식으로...
$max_page = '10';
//======================= 설정 끝 =============================
include $_zb_path."lib.php";
if(!$connect) $connect=dbConn();
$member=member_info();
if($member[level]> $permission_level) Error("죄송합니다.<br>로그인한 회원(레벨:$permission_level)에게만 열람이 허용됩니다. ");
if(!$member[is_admin] == 1 && $member[level] == 1)
$view_admin_menu = "on";
if($apply_login_point == 0){
$hide_start = "<!--";
$hide_end = "-->";
$height = 530;
}else{
$height = 610;
}
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=euc-kr">
<title>숙박업체 리스트</title>
<STYLE type=text/css>
A:link {COLOR: #000000; TEXT-DECORATION: none}
A:visited {COLOR: #000000; TEXT-DECORATION: none}
A:hover {COLOR: #cc0000; TEXT-DECORATION: none}
A:active {COLOR: #cc0000; TEXT-DECORATION: none}
body,td,select,input,div,form,textarea,center,option,pre,blockquote {font-size:9pt; font-family:굴림;color:424040;line-height:160%}
.input {border:solid 1;border-color:739BAB;font-size:9pt;color:042330;background-color:white;height:19px}
.submit {border:solid 1;border-color:1F556A;font-size:9pt;color:white;background-color:50889F;height:19px}
.f1 {font-size:9pt;font-family:굴림;font-weight:bold;color:13485D}
</STYLE>
</head>
<body onLoad=document.search_member.keyword.focus();>
<?
if($search == "on"){
$keyword=stripslashes($keyword);
$keyword=str_replace("`","",$keyword);
$keyword=str_replace(""","",$keyword);
$keyword=str_replace("'","",$keyword);
$keyword=str_replace(".","",$keyword);
$keyword=str_replace("<","",$keyword);
$keyword=str_replace(">","",$keyword);
if(!isblank($keyword)) {
$keyword=addslashes($keyword);
$where = "where house_name like '%$keyword%' ";
if($s_id)
$where .= "or houseimg like '%$keyword%' ";
if($s_em)
$where .= "or email like '%$keyword%'+ '+ ' ";
if($s_no)
$where .= "or no like '%$keyword%' ";
if($s_hp)
$where .= "or handphone like '%$keyword%' ";
$res_count = mysql_num_rows(mysql_query("select no from zetyx_member_table $where "));
$total_member = mysql_num_rows(mysql_query("select no from zetyx_member_table"));
$member_search_result = "검색인원 <font color=blue>$res_count</font> 명 ";
}
}else{
$res_count = mysql_num_rows(mysql_query("select * from zetyx_member_table"));
$total_member = $res_count;
}
if(!$page){
$page = 1;
}
$start = ($page-1)*$max_line;
$end = $start+$max_line;
$over_page = floor($start/($max_line*$max_page));
$total_page = floor($res_count/$max_line+1);
if($end > $res_count){
$end=$res_count;
}
if($page>$total_page){
$page=$total_page;
}
echo("<div align=center>
<table align=center border=0 cellpadding=0 cellspacing=0 height=50>
<tr>
<td colspan=3 align=left>
<a href=$PHP_SELF><font color=blue>전체회원 <b>$total_member</b> 명</font> ($member_search_result$page / $total_page Pages)</a>
</td>
</tr>
</table>");
?>
<table align="center" border="1" cellspacing="0" bordercolor="#CCCCCC" bordercolordark="white" bordercolorlight="#CCCCCC">
<tr>
<td align=center background=images/tb_back.gif>
<b> </b>
<td align=center background=images/tb_back.gif>
<b>이름</b>
</td>
</tr>
<?
for($i= $start ; $i <$end ; $i++){
if(!$code && $apply_login_point == 1)
$code = "lastlogin";
elseif(!$code && $apply_login_point == 0)
$code = "no";
else
$code = $code;
if(!$desc && $apply_login_point == 1)
$desc = "desc";
elseif(!$desc && $apply_login_point == 0)
$desc = "asc";
else
$desc = $desc;
if($code == "house_name"){
$code = "house_name";
$result = mysql_query("SELECT * FROM zetyx_member_table $where order by $code $desc limit $i, 1");
$rows = mysql_num_rows($result);
$code = "house_name";
}else{
$result = mysql_query("SELECT * FROM zetyx_member_table $where order by $code $desc limit $i, 1");
$rows = mysql_num_rows($result);
}
if($rows){
while($row = mysql_fetch_array($result)){
$point1 = $row["point1"];
$point2 = $row["point2"];
$point = $point1 * 10 + $point2;
if($apply_login_point == 1){
$point3 = $row["point3"];
$point4 = $row["point4"];
$lastlogin = $row["lastlogin"];
if($lastlogin != "" && $lastlogin != "0")
$lastlogin = date("m/d H:i",$lastlogin);
else
$lastlogin = "<font color=gray>없음</font>";
}
$no = $row["no"];
$house_name = $row["house_name"];
$id = $row["houseimg"];
$email = $row["email"];
$handphone = $row["handphone"];
if($handphone =="")
$handphone = " ";
$homepage = $row["homepage"];
if($homepage)
$homepage = "<a href=$homepage target=_blank>home</a>";
elseif($homepage =="")
$homepage = " ";
$birth = date('y-m-d',$row["birth"]);
$reg_date = date("y-m-d",$row["reg_date"]);
if($keyword){
$keyword_pattern = "/$keyword/i";
$no_search = preg_replace($keyword_pattern, "<font color=000000 style=background-color:000000;>$keyword</font>", $no);
$name_search = preg_replace($keyword_pattern, "<font color=000000>$keyword</font>", $house_name);
$id_search = preg_replace($keyword_pattern, "<font color=000000 style=background-color:FFF000;>$keyword</font>", $id);
$email_search = preg_replace($keyword_pattern, "<font color=000000 style=background-color:FFF000;>$keyword</font>", $email);
$handphone_search = preg_replace($keyword_pattern, "<font color=000000 style=background-color:FFF000;>$keyword</font>", $handphone);
}
if(!$keyword){
$no_search = $no;
$name_search = $house_name;
$id_search = $houseimg;
$email_search = $email;
$handphone_search = $handphone;
}
$email_search = "<a href=mailto:$email>$email_search</a>";
$num = $i + 1;
echo(" <tr>
<td align=center>
$num
</td>
<td align=center>
<a href=javascript:void(window.open('".$_zb_url."view_info.php?member_no=$no','info','width=400,height=510,statusbar=no,scrollbars=yes,toolbar=no'))><font color=000000>$name_search</font></a>
</td>
");
}// while문 끝
}// if문 끝
}// for문 끝
echo("</table>");
//================= 페이지 이동 리스트 표시 ====================
if($page > $max_page){
$prev = $over_page * $max_page;
echo("<a href='$PHP_SELF?code=$code&desc=$desc&page=$prev&search=$search&keyword=$keyword&s_id=$s_id&s_em=$s_em&s_no=$s_no&s_hp=$s_hp'>[이전]</a> ");
}else{
echo("[이전] ");
}
for($j=0 ; $j < 10 ;$j++){
$link = $j+$max_page*$over_page+1;
$vlink= $over_page*$max_page+$j+1;
if($link <= $total_page){
if($vlink == $page){
echo("<font color=red>$vlink</font> ");
}else{
echo("<a href='$PHP_SELF?code=$code&desc=$desc&page=$link&search=$search&keyword=$keyword&s_id=$s_id&s_em=$s_em&s_no=$s_no&s_hp=$s_hp'>[$vlink]</a> ");
}
}
}
if($total_page > ($over_page+1)*$max_page){
$next = $over_page*$max_page+$max_page+1;
echo("<a href='$PHP_SELF?code=$code&desc=$desc&page=$next&search=$search&keyword=$keyword&s_id=$s_id&s_em=$s_em&s_no=$s_no&s_hp=$s_hp'>[다음]</a>");
}else{
echo("[다음]<br>");
}
?>
<table border=0>
<tr>
<form name=search_member method=get action=<?=$PHP_SELF?>>
<td valign=middle>
<input type=hidden name=code value=<?=$code?>>
<input type=hidden name=desc value=<?=$desc?>>
<input type=hidden name=search value=on>
<input type=checkbox name=s_hp value=on <?if($s_hp)echo("checked");?>>휴대폰
<input type=checkbox name=s_no value=on <?if($s_no)echo("checked");?>>회원번호
<input type=checkbox name=s_em value=on <?if($s_em)echo("checked");?>>이메일
<input type=checkbox name=s_id value=on <?if($s_id)echo("checked");?>>아이디
</td>
<td valign=top>
<input type=text name=keyword class=input value='<?=$keyword?>'>
<input type=submit class=submit value="찾아줘!!!">
</td>
</form>
</tr>
</table>
<?
echo ("</div></body></html>");
mysql_close($connect);
?>
위소스를 보면 아시겠는지 모르지만....특정필드값을 찾아 회원데이터에서 회원정보를 봅아올수 있게 하는 방법으로 하고 싶은데 안되네요...
특정필드 즉 house_name이라는 필드의 값의 존재여부를 확인하여 필드값이 있을 경우 회원데이터를 뽑아오려고 합니다..
house_name이라는 필드의 값이 있을 경우에만 회원정보를 구할수 있는 방법이 없을까요...
위 소스에서 어디부분에 수정해야 특정필드값의 확인여부를 알수 있는지 알려주시기 바랍니다....
이거 급하거든요..제발 부탁드립니다..
//====================== 설정해주세요 =========================
// 제로보드 절대경로, 뒤에 반드시 / 붙이세요.
$_zb_path="/절대경로/bbs/";
// 제로보드 URL, 뒤에 반드시 / 붙이세요.
$_zb_url = "http://사이트주소/bbs/";
// 멤버리스트 열람 가능 레벨
$permission_level = "10";
// 로그인 회수/점수 최근로그인 시각을 사용하면 1, 사용 안하면 0
$apply_login_point = "0";
// 한화면에 몇명씩 보여줄 것인지....
$max_line = '20';
// 보여줄 페이지수 [이전] [1][2][3][4]....[8][9][10] [다음] 이런식으로...
$max_page = '10';
//======================= 설정 끝 =============================
include $_zb_path."lib.php";
if(!$connect) $connect=dbConn();
$member=member_info();
if($member[level]> $permission_level) Error("죄송합니다.<br>로그인한 회원(레벨:$permission_level)에게만 열람이 허용됩니다. ");
if(!$member[is_admin] == 1 && $member[level] == 1)
$view_admin_menu = "on";
if($apply_login_point == 0){
$hide_start = "<!--";
$hide_end = "-->";
$height = 530;
}else{
$height = 610;
}
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=euc-kr">
<title>숙박업체 리스트</title>
<STYLE type=text/css>
A:link {COLOR: #000000; TEXT-DECORATION: none}
A:visited {COLOR: #000000; TEXT-DECORATION: none}
A:hover {COLOR: #cc0000; TEXT-DECORATION: none}
A:active {COLOR: #cc0000; TEXT-DECORATION: none}
body,td,select,input,div,form,textarea,center,option,pre,blockquote {font-size:9pt; font-family:굴림;color:424040;line-height:160%}
.input {border:solid 1;border-color:739BAB;font-size:9pt;color:042330;background-color:white;height:19px}
.submit {border:solid 1;border-color:1F556A;font-size:9pt;color:white;background-color:50889F;height:19px}
.f1 {font-size:9pt;font-family:굴림;font-weight:bold;color:13485D}
</STYLE>
</head>
<body onLoad=document.search_member.keyword.focus();>
<?
if($search == "on"){
$keyword=stripslashes($keyword);
$keyword=str_replace("`","",$keyword);
$keyword=str_replace(""","",$keyword);
$keyword=str_replace("'","",$keyword);
$keyword=str_replace(".","",$keyword);
$keyword=str_replace("<","",$keyword);
$keyword=str_replace(">","",$keyword);
if(!isblank($keyword)) {
$keyword=addslashes($keyword);
$where = "where house_name like '%$keyword%' ";
if($s_id)
$where .= "or houseimg like '%$keyword%' ";
if($s_em)
$where .= "or email like '%$keyword%'+ '+ ' ";
if($s_no)
$where .= "or no like '%$keyword%' ";
if($s_hp)
$where .= "or handphone like '%$keyword%' ";
$res_count = mysql_num_rows(mysql_query("select no from zetyx_member_table $where "));
$total_member = mysql_num_rows(mysql_query("select no from zetyx_member_table"));
$member_search_result = "검색인원 <font color=blue>$res_count</font> 명 ";
}
}else{
$res_count = mysql_num_rows(mysql_query("select * from zetyx_member_table"));
$total_member = $res_count;
}
if(!$page){
$page = 1;
}
$start = ($page-1)*$max_line;
$end = $start+$max_line;
$over_page = floor($start/($max_line*$max_page));
$total_page = floor($res_count/$max_line+1);
if($end > $res_count){
$end=$res_count;
}
if($page>$total_page){
$page=$total_page;
}
echo("<div align=center>
<table align=center border=0 cellpadding=0 cellspacing=0 height=50>
<tr>
<td colspan=3 align=left>
<a href=$PHP_SELF><font color=blue>전체회원 <b>$total_member</b> 명</font> ($member_search_result$page / $total_page Pages)</a>
</td>
</tr>
</table>");
?>
<table align="center" border="1" cellspacing="0" bordercolor="#CCCCCC" bordercolordark="white" bordercolorlight="#CCCCCC">
<tr>
<td align=center background=images/tb_back.gif>
<b> </b>
<td align=center background=images/tb_back.gif>
<b>이름</b>
</td>
</tr>
<?
for($i= $start ; $i <$end ; $i++){
if(!$code && $apply_login_point == 1)
$code = "lastlogin";
elseif(!$code && $apply_login_point == 0)
$code = "no";
else
$code = $code;
if(!$desc && $apply_login_point == 1)
$desc = "desc";
elseif(!$desc && $apply_login_point == 0)
$desc = "asc";
else
$desc = $desc;
if($code == "house_name"){
$code = "house_name";
$result = mysql_query("SELECT * FROM zetyx_member_table $where order by $code $desc limit $i, 1");
$rows = mysql_num_rows($result);
$code = "house_name";
}else{
$result = mysql_query("SELECT * FROM zetyx_member_table $where order by $code $desc limit $i, 1");
$rows = mysql_num_rows($result);
}
if($rows){
while($row = mysql_fetch_array($result)){
$point1 = $row["point1"];
$point2 = $row["point2"];
$point = $point1 * 10 + $point2;
if($apply_login_point == 1){
$point3 = $row["point3"];
$point4 = $row["point4"];
$lastlogin = $row["lastlogin"];
if($lastlogin != "" && $lastlogin != "0")
$lastlogin = date("m/d H:i",$lastlogin);
else
$lastlogin = "<font color=gray>없음</font>";
}
$no = $row["no"];
$house_name = $row["house_name"];
$id = $row["houseimg"];
$email = $row["email"];
$handphone = $row["handphone"];
if($handphone =="")
$handphone = " ";
$homepage = $row["homepage"];
if($homepage)
$homepage = "<a href=$homepage target=_blank>home</a>";
elseif($homepage =="")
$homepage = " ";
$birth = date('y-m-d',$row["birth"]);
$reg_date = date("y-m-d",$row["reg_date"]);
if($keyword){
$keyword_pattern = "/$keyword/i";
$no_search = preg_replace($keyword_pattern, "<font color=000000 style=background-color:000000;>$keyword</font>", $no);
$name_search = preg_replace($keyword_pattern, "<font color=000000>$keyword</font>", $house_name);
$id_search = preg_replace($keyword_pattern, "<font color=000000 style=background-color:FFF000;>$keyword</font>", $id);
$email_search = preg_replace($keyword_pattern, "<font color=000000 style=background-color:FFF000;>$keyword</font>", $email);
$handphone_search = preg_replace($keyword_pattern, "<font color=000000 style=background-color:FFF000;>$keyword</font>", $handphone);
}
if(!$keyword){
$no_search = $no;
$name_search = $house_name;
$id_search = $houseimg;
$email_search = $email;
$handphone_search = $handphone;
}
$email_search = "<a href=mailto:$email>$email_search</a>";
$num = $i + 1;
echo(" <tr>
<td align=center>
$num
</td>
<td align=center>
<a href=javascript:void(window.open('".$_zb_url."view_info.php?member_no=$no','info','width=400,height=510,statusbar=no,scrollbars=yes,toolbar=no'))><font color=000000>$name_search</font></a>
</td>
");
}// while문 끝
}// if문 끝
}// for문 끝
echo("</table>");
//================= 페이지 이동 리스트 표시 ====================
if($page > $max_page){
$prev = $over_page * $max_page;
echo("<a href='$PHP_SELF?code=$code&desc=$desc&page=$prev&search=$search&keyword=$keyword&s_id=$s_id&s_em=$s_em&s_no=$s_no&s_hp=$s_hp'>[이전]</a> ");
}else{
echo("[이전] ");
}
for($j=0 ; $j < 10 ;$j++){
$link = $j+$max_page*$over_page+1;
$vlink= $over_page*$max_page+$j+1;
if($link <= $total_page){
if($vlink == $page){
echo("<font color=red>$vlink</font> ");
}else{
echo("<a href='$PHP_SELF?code=$code&desc=$desc&page=$link&search=$search&keyword=$keyword&s_id=$s_id&s_em=$s_em&s_no=$s_no&s_hp=$s_hp'>[$vlink]</a> ");
}
}
}
if($total_page > ($over_page+1)*$max_page){
$next = $over_page*$max_page+$max_page+1;
echo("<a href='$PHP_SELF?code=$code&desc=$desc&page=$next&search=$search&keyword=$keyword&s_id=$s_id&s_em=$s_em&s_no=$s_no&s_hp=$s_hp'>[다음]</a>");
}else{
echo("[다음]<br>");
}
?>
<table border=0>
<tr>
<form name=search_member method=get action=<?=$PHP_SELF?>>
<td valign=middle>
<input type=hidden name=code value=<?=$code?>>
<input type=hidden name=desc value=<?=$desc?>>
<input type=hidden name=search value=on>
<input type=checkbox name=s_hp value=on <?if($s_hp)echo("checked");?>>휴대폰
<input type=checkbox name=s_no value=on <?if($s_no)echo("checked");?>>회원번호
<input type=checkbox name=s_em value=on <?if($s_em)echo("checked");?>>이메일
<input type=checkbox name=s_id value=on <?if($s_id)echo("checked");?>>아이디
</td>
<td valign=top>
<input type=text name=keyword class=input value='<?=$keyword?>'>
<input type=submit class=submit value="찾아줘!!!">
</td>
</form>
</tr>
</table>
<?
echo ("</div></body></html>");
mysql_close($connect);
?>
위소스를 보면 아시겠는지 모르지만....특정필드값을 찾아 회원데이터에서 회원정보를 봅아올수 있게 하는 방법으로 하고 싶은데 안되네요...
특정필드 즉 house_name이라는 필드의 값의 존재여부를 확인하여 필드값이 있을 경우 회원데이터를 뽑아오려고 합니다..
house_name이라는 필드의 값이 있을 경우에만 회원정보를 구할수 있는 방법이 없을까요...
위 소스에서 어디부분에 수정해야 특정필드값의 확인여부를 알수 있는지 알려주시기 바랍니다....
이거 급하거든요..제발 부탁드립니다..
예를 들면.. select * from 테이블명 where house_name<>""
이런식이 되겠네요.