팁텍 회원의 온라인 여부 표시하기
페이지 정보
본문
우선 개발자(사용자) 라이브러리에 온라인 체크 함수를 추가합니다.
./lib/developer.lib.php
=======================================================================================
// 회원의 온라인 여부 확인
function dev_online($mb_id)
{
global $cfg;
if ($mb_id) {
$sql = "select mb_id from $cfg[table_login] where mb_id='$mb_id'";
$result = @sql_fetch($sql);
if($result[mb_id]) {
$img_tag=" <img src=./image/icon_online.gif border=0 alt='현재 온라인중입니다.'> ";
}
else {
$img_tag="";
}
return $img_tag;
}
}
=======================================================================================
그 다음은 원하는 곳에서 함수를 호출하시면 됩니다.
게시판 스킨에 적용시 (글 읽기에서)
./bbs/skin/board/basic/gbview.skin.php
* 글 게시자의 온라인 여부 표시 --> <?=dev_online($write[mb_id])?>
=======================================================================================
<table width=<?=$width?> border=0 align=center cellpadding=0 cellspacing=0>
<tr height=30 bgcolor=#F5F3EE>
<td> <span class=tt><b><? if ($is_category) echo "[$category_name] "; ?><?=$subject?></b></span></td>
<td align=right><span class=tt><?=$datetime?></span> </td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#C3BEB2></td></tr>
<tr><td colspan=2 height=25> <font color="cf4900">이름</font> : <?=$name?> <?=dev_online($write[mb_id])?> (<?=$ip?>) <font color="cf4900">조회</font> : <?=$hit?> <? if ($is_good) echo "<font color='#cf4900'>추천</font> : " . $good; ?> <? if ($is_nogood) echo "<font color='#cf4900'>비추천</font> : " . $nogood; ?></td></tr>
<tr><td colspan=2 height=1 bgcolor=#D4CFC3></td></tr>
* 코멘트 게시자의 온라인 여부 표시 --> <?=dev_online($list[$i][mb_id])?>
=======================================================================================
<? if ($is_comment) { ?>
<!-- 코멘트 내용 -->
<? for ($i=0; $i<count($list); $i++) { ?>
<a name='c<?=$list[$i][wr_id]?>'></a>
<table width=<?=$width?> border=0 align=center cellpadding=0 cellspacing=0>
<tr>
<td height=25 bgcolor=#F1F1F1> <?=$list[$i][name]?> <?=dev_online($list[$i][mb_id])?> </td>
<td align=right bgcolor=#F1F1F1><font color="cf4900"><?=$list[$i][datetime]?></font> <? if ($list[$i][is_del]) { echo "{$list[$i][del_href]}<img src='$board_skin/com_del.gif' border=0 align=absmiddle></a> "; } ?></td>
</tr>
<tr>
=======================================================================================
관리자 접속여부를 나타내지 않으려면.. ($result[mb_id] && !is_admin($result[mb_id]))
아래 처럼 하면 되지 않을까요?
function dev_online($mb_id)
{
global $cfg;
if ($mb_id) {
$sql = "select mb_id from $cfg[table_login] where mb_id='$mb_id'";
$result = @sql_fetch($sql);
if($result[mb_id] && !is_admin($result[mb_id])) {
$img_tag=" <img src=./image/icon_online.gif border=0 alt='현재 온라인중입니다.'> ";
}
else {
$img_tag="";
}
return $img_tag;
}
}
//smc님
[이 게시물은 까만도둑님에 의해 2004-06-06 22:33:24 자료실(으)로 부터 이동됨]
./lib/developer.lib.php
=======================================================================================
// 회원의 온라인 여부 확인
function dev_online($mb_id)
{
global $cfg;
if ($mb_id) {
$sql = "select mb_id from $cfg[table_login] where mb_id='$mb_id'";
$result = @sql_fetch($sql);
if($result[mb_id]) {
$img_tag=" <img src=./image/icon_online.gif border=0 alt='현재 온라인중입니다.'> ";
}
else {
$img_tag="";
}
return $img_tag;
}
}
=======================================================================================
그 다음은 원하는 곳에서 함수를 호출하시면 됩니다.
게시판 스킨에 적용시 (글 읽기에서)
./bbs/skin/board/basic/gbview.skin.php
* 글 게시자의 온라인 여부 표시 --> <?=dev_online($write[mb_id])?>
=======================================================================================
<table width=<?=$width?> border=0 align=center cellpadding=0 cellspacing=0>
<tr height=30 bgcolor=#F5F3EE>
<td> <span class=tt><b><? if ($is_category) echo "[$category_name] "; ?><?=$subject?></b></span></td>
<td align=right><span class=tt><?=$datetime?></span> </td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#C3BEB2></td></tr>
<tr><td colspan=2 height=25> <font color="cf4900">이름</font> : <?=$name?> <?=dev_online($write[mb_id])?> (<?=$ip?>) <font color="cf4900">조회</font> : <?=$hit?> <? if ($is_good) echo "<font color='#cf4900'>추천</font> : " . $good; ?> <? if ($is_nogood) echo "<font color='#cf4900'>비추천</font> : " . $nogood; ?></td></tr>
<tr><td colspan=2 height=1 bgcolor=#D4CFC3></td></tr>
* 코멘트 게시자의 온라인 여부 표시 --> <?=dev_online($list[$i][mb_id])?>
=======================================================================================
<? if ($is_comment) { ?>
<!-- 코멘트 내용 -->
<? for ($i=0; $i<count($list); $i++) { ?>
<a name='c<?=$list[$i][wr_id]?>'></a>
<table width=<?=$width?> border=0 align=center cellpadding=0 cellspacing=0>
<tr>
<td height=25 bgcolor=#F1F1F1> <?=$list[$i][name]?> <?=dev_online($list[$i][mb_id])?> </td>
<td align=right bgcolor=#F1F1F1><font color="cf4900"><?=$list[$i][datetime]?></font> <? if ($list[$i][is_del]) { echo "{$list[$i][del_href]}<img src='$board_skin/com_del.gif' border=0 align=absmiddle></a> "; } ?></td>
</tr>
<tr>
=======================================================================================
관리자 접속여부를 나타내지 않으려면.. ($result[mb_id] && !is_admin($result[mb_id]))
아래 처럼 하면 되지 않을까요?
function dev_online($mb_id)
{
global $cfg;
if ($mb_id) {
$sql = "select mb_id from $cfg[table_login] where mb_id='$mb_id'";
$result = @sql_fetch($sql);
if($result[mb_id] && !is_admin($result[mb_id])) {
$img_tag=" <img src=./image/icon_online.gif border=0 alt='현재 온라인중입니다.'> ";
}
else {
$img_tag="";
}
return $img_tag;
}
}
//smc님
[이 게시물은 까만도둑님에 의해 2004-06-06 22:33:24 자료실(으)로 부터 이동됨]
관련링크
댓글목록
등록된 댓글이 없습니다.