묻고답하기
My sql..문젠데요. 현재접속자.
2009.11.03 01:22
<script language=JavaScript>
function bluring(){
if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
}
document.onfocusin=bluring;
</script>
<?
// 라이브러리 함수 파일 인크루드
require "lib.php";
// DB 연결
$connect=dbConn();
// 멤버정보 구하기
$member=member_info();
if(!$member[no]) Error("로그인된 회원만이 사용할수 있습니다","window.close");
if(!$page&&!$status) $status=1;
// 그룹데이타 읽어오기;;
$group_data=mysql_fetch_array(mysql_query("select * from $group_table where no='$member[group_no]'"));
// 검색어 처리;;
if($keyword) {
if(!$status) $s_que=" where user_id like '%$keyword%' or name like '%$keyword%' ";
}
// 전체 회원의 수
$temp2=mysql_fetch_array(mysql_query("select count(*) from $member_table $s_que"));
$total_member=$temp2[0];
if($status) {
$_str = trim(zReadFile("data/now_member_connect.php"));
if($_str) {
$_str = str_replace("<?/*","",$_str);
$_str = str_replace("*/?>","",$_str);
$_connector = explode(":",$_str);
$total = count($_connector);
}
} else $total=$total_member;
// 페이지 계산
$page_num=10;
$total_page=(int)(($total-1)/$page_num)+1; // 전체 페이지 구함
if(!$page) $page=1;
if($page>$total_page) $page=1; // 페이지가 전체 페이지보다 크면 페이지 번호 바꿈
$start_num=($page-1)*$page_num; // 페이지 수에 따른 출력시 첫번째가 될 글의 번호 구함
// 데이타 뽑아오는 부분
// 오프라인 멤버
if(!$status) {
$que="select * from $member_table $s_que order by no desc limit $start_num,$page_num";
$result=mysql_query($que) or Error(mysql_error());
// 온라인 멤버
} else {
$endnum = $start_num + $page_num;
if($endnum>$total) $endnum=$total;
unset($s_que);
for($i=$start_num;$i<$endnum;$i++) {
$member_no = substr($_connector[$i],12);
if($s_que) $s_que .= " or no = '$member_no' "; else $s_que = " where no = '$member_no' ";
}
$que = "select * from $member_table $s_que";
$result=mysql_query($que) or Error(mysql_error());
}
// 페이지 계산 $print_page 라는 변수에 저장
$print_page="";
$show_page_num=10;
$start_page=(int)(($page-1)/$show_page_num)*$show_page_num;
$i=1;
if($page>$show_page_num) {
$prev_page=$start_page;
$print_page="<a href=$PHP_SELF?page=$prev_page&status=$status&keyword=$keyword>[Prev]</a> ";
$print_page.="<a href=$PHP_SELF?page=1&status=$status&keyword=$keyword>[1]</a>..";
}
while($i+$start_page<=$total_page&&$i<=$show_page_num) {
$move_page=$i+$start_page;
if($page==$move_page) $print_page.=" <b>$move_page</b> ";
else $print_page.="<a href=$PHP_SELF?page=$move_page&status=$status&keyword=$keyword>[$move_page]</a>";
$i++;
}
if($total_page>$move_page) {
$next_page=$move_page+1;
$print_page.="..<a href=$PHP_SELF?page=$total_page&status=$status&keyword=$keyword>[$total_page]</a>";
$print_page.=" <a href=$PHP_SELF?page=$next_page&status=$status&keyword=$keyword>[Next]</a>";
}
head("bgcolor=white");
?>
<style type='text/css'>
body {color:#666666}
A:link {color:666666;text-decoration:none;}
A:visited {color:666666;text-decoration:none;}
A:active {color:666666;text-decoration:none;}
A:hover {color:333333;text-decoration:none;}
.input {border:1px #dddddd solid;height:18px;font-family:tahoma;font-size:9pt;color:#666666;background-color:#fafafa;}
</style>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td align=center align="100%" height="10" >
</td>
</tr>
<tr>
<td align="center"><img src="memo_images/memo_topright_user.gif" width="400" height="50" border="0"></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td> <a href=member_memo.php><img src=memo_images/vi_B_inbox.gif border=0></a> <a href=member_memo2.php><img src=memo_images/vi_B_sent.gif border=0></a> <a href=member_memo3.php><img src=memo_images/vi_B_write.gif border=0></a></td>
<td align=right><font style=font-family:Tahoma;font-size:7pt;color:#666666>All Members : <b><?=$total?></b></font> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="16"></td>
<td >
<script>
function check_status()
{
if(document.list.status.checked) {
if(document.list.keyword.value) {
alert("온라인 상태에서는 검색할수가 없습니다");
return false;
}
}
return true;
}
</script>
<TABLE><TR><TD HEIGHT=15></TD></TR></TABLE>
<table border=0 cellspacing=0 cellpadding=0 width=100%>
<form method=post action=<?=$PHP_SELF?> name=list onsubmit="return check_status()">
<input type=hidden name=page value=<?=$page?>>
<tr>
<td colspan=4 height=1 bgcolor=#eeeeee></td>
</tr>
<tr align=center height=15>
<td width=30% style="border-width:1px; border-color:rgb(231,228,228);" height="25" bgcolor="white">
<p align="center"><b><font style=font-family:Tahoma;font-size:7pt;color:#666666>LEVEL</font><b></td>
<td width=30% style="border-width:1px; border-color:rgb(231,228,228);" height="25" bgcolor="white">
<p align="center"><b><font style=font-family:Tahoma;font-size:7pt;color:#666666>ID</font><b></td>
<td width=25% style="border-width:1px; border-color:rgb(231,228,228);" height="25" bgcolor="white">
<p align="center"><b><font style=font-family:Tahoma;font-size:7pt;color:#666666>NAME</font><b></td>
<?if($status){?><td width=15% style="border-width:1px; border-color:rgb(231,228,228);" height="25" bgcolor="white">
<p align="center"><b><font style=font-family:Tahoma;font-size:7pt;color:#666666>STATUS</font><b></td>
<?}?>
</tr>
<?
// 출력
$loop_number=$total-($page-1)*$page_num;
while($data=mysql_fetch_array($result)) {
$name=stripslashes($data[name]);
$temp_name = get_private_icon($data[no], "2");
if($temp_name) $name="<img src='$temp_name' border=0 align=absmiddle>";
$temp_name = get_private_icon($data[no], "1");
if($temp_name) $name="<img src='$temp_name' border=0 align=absmiddle> ".$name;
$user_id=stripslashes($data[user_id]);
//$check=mysql_fetch_array(mysql_query("select count(*) from $now_table where user_id='$data[user_id]'"));
if($check[0]) $stat="<img src=images/memo_online.gif>";
else $stat="<img src=images/memo_offline.gif>";
if($data[is_admin]==1) $kind="<font color=#666666 style=font-family:Tahoma;font-size:8pt;><b>Super Administrator</b>($data[level])</font>";
elseif($data[is_admin]==2) $kind="<font color=#666666 style=font-family:Tahoma;font-size:8pt;><b>Group Administrator</b>($data[level])</font>";
else $kind="<font style=font-family:Tahoma;font-size:8pt;><b>Member</b>($data[level])</font>";
echo"
<tr>
<td colspan=5 bgcolor=#f4f4f4 align=center><img src=images/t.gif width=10 height=1></td>
</tr>
<tr align=center height=23 onMouseOver=this.style.backgroundColor=\"#Fafafa\" onMouseOut=this.style.backgroundColor=\"\" style=cursor:hand; onclick=location.href=\"javascript:void(window.open('+
'+
'view_info.php?member_no=$data[no]','view_info','width=400,height=500,toolbar=no,scrollbars=yes'))\">
<td style='word-break:break-all;'>$kind</td>
<td style='word-break:break-all;'+
'><img src=images/t.gif width=10 height=3><br><a href=javascript:void(window.open('view_info.php?member_no=$data[no]','view_info','width=400,height=500,toolbar=no,scrollbars=yes'))>$user_id</a></td>
<td style='word-break:break-all;'><img src=images/t.gif width=10 height=3><br>$name</td>";
if($status) echo"<td style='word-break:break-all;'><img src=images/memo_online.gif></td>";
echo"
</tr>
";
$loop_number--;
}
?>
<tr>
<td colspan=4 height=1 bgcolor=#eeeeee></td>
</tr>
<tr>
<td colspan=5 bgcolor="white" align=center height="23" style="border-style:none;"><span style="font-size:1pt;"> </span></td>
</tr>
<tr align=center>
<? $checked[$status]="checked"; ?>
<td colspan=5 height="42" valign="bottom" bgcolor="white" width="100%">
<table border=0 cellpadding=0 cellspacing=0 style="border:1px #eeeeee solid;" align=center>
<tr>
<td height=3 colspan=5></td>
</tr>
<tr>
<td><input type=checkbox value=1 name=status <?=$checked[1]?>></td>
<td><b><font style=font-family:Tahoma;font-size:7pt;color:#666666>ONLINE</font><b> </td>
<td>
<input type=text name=keyword value="<?=$keyword?>" size=20 style=font-size:9pt;width:140px;height:18px;border-color:#eeeeee;background-color:#fafafa; class=input></td>
<td><INPUT TYPE="submit" class=input value=Search style=color:#FFFFFF;border-color:#666666;background-color:#666666;font-size:7pt;font-family:Tahoma;height:18px;> </td>
<td><a href=<?=$PHP_SELF?>?page=<?=$page?>><b><font style=font-family:Tahoma;font-size:7pt;color:#666666>CANCLE</font><b></a> </td>
</tr>
<tr>
<td height=3 colspan=5></td>
</tr>
</table>
</td>
</tr>
</form>
</table>
</td>
<td width="17"> </td>
</tr>
</table>
<p align="center" style="line-height:100%; margin-top:0; margin-bottom:0;"> </p>
<table width="100%" border="0" cellspacing="0" cellpadding="5" align="center">
<tr>
<td> <font style=font-family:Tahoma;font-size:7pt;color:#666666><?=$print_page?></font></td>
<td align="right">
<p style="margin-right:20;" align="right"><a href=JavaScript:window.close()><img src="memo_images/memo_close_m.gif" width="50" height="30" border="0"></a> </td>
</tr>
</table>
<?
// MySQL 닫기
if($connect) mysql_close($connect);
foot();
?>
현재접속자 누르면
이렇게 나와요..
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ');/*200911030115189' or no = '1'' at line 1
호스팅업체에선 원래 제로보드가 4.0x인데 제껀 버전이 5.x라서 그렇다고 하더군요..
어떻게 해야하는걸까요?;ㅁ;..
누가 좀 도와주세요..