o

현재접속자 ID, IP출력 (운영자님이 전에 사용하셨죠 *^^* 그걸 구현해보았습니다.

gnu2폴더안에
connip.php파일로 만들어 넣었구요!
사용시는 <? include "gnu2/connip.php"; ?>이렇게 하시면됩니다.
//########################################################
//## 소스입니다. 아주 간단하니깐 ##
//########################################################
<? require_once "lib.inc.php"; ?>

<table width=144 border=0 cellpadding=1 cellspacing=0 bgcolor=#777777>
<tr>
<td>
<table width=100% height=100% cellpadding=2 cellspacing=0>
<tr>
<td height=25 align=center bgcolor=6B9ACE><font color=ffffff><b>현재 접속자</b></font></td>
</tr>
<tr>
<td bgcolor=EFF7FF>
<table width=100% cellpadding=2 cellspacing=0>
<? $result = sql_query_error("select * from $cfg[table_login]");
for ($i = 0; $row = mysql_fetch_array($result); $i++) {
if ($row[mb_id]) {
echo "<tr><td align=center>$row[mb_id]</td></tr>";
} else {
echo "<tr><td align=center>$row[lo_ip]</td></tr>";
}
} ?>

</table>
</td>
</tr>
</table>
</td>
</tr>
</table>



p.s:아무래도 다음주부터는 자주 찾아뵙기 힘들것 같네요 *^^*
원래 웹프로그래머가 아니기 때문에..*^^*
|

댓글 6개

감사합니다.
잘 쓸께요 감사합니다
쩝 점심시간인데 왜케 밥이 안오는지 배거파 죽겠네.... 돌솥비빔밥와 언능와라~~~~
다들 점심들 드셨죠?*^^*
아참 접속자수는 전체 -1이 맞는것 같습니다. 서버 IP까지 잡아 먹는군요! *^^* IP확인해보시면 아실듯...
if ($row[mb_id]) {
echo "<tr><td align=center>$row[mb_id]</td></tr>";
} else {
echo "<tr><td align=center>Guest</td></tr>";

이렇게 수정해주시면 됩니다. IP일부만 보이게 하고 싶으시면
if ($row[mb_id]) {
echo "<tr><td align=center>$row[mb_id]</td></tr>";
} else {
$guestip = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", "\\1.*.*.\\4", $row[lo_ip]);
echo "<tr><td align=center>$guestip</td></tr>";
}
이렇게 수정해주시면 해결되겠죠!
근데 여기서 빠진게 있습니다. 접속자가 많으면 로그인한사람과 그냥 접속자하고 썩일겁니다. 그러니깐 쿼리에 order by mb_id 를 해주시면 로그인한사람 그리고 로그인안사람사람 순으로 화면에 출력되겠죠!
궁금한데요..
이름도 나오게 하려면 어떻게 해야하는지 알려주세요..
댓글을 작성하시려면 로그인이 필요합니다.
+
제목 글쓴이 날짜 조회
03-04-30 조회 3,464
깜깜보
03-04-29 조회 2,431
03-04-29 조회 2,389
03-04-26 조회 2,445
03-04-25 조회 2,805
03-04-25 조회 2,509
03-04-21 조회 4,478
03-04-19 조회 4,480
03-04-17 조회 3,933
03-04-15 조회 2,669
03-04-11 조회 2,720
03-04-11 조회 3,086
03-04-11 조회 2,374
03-04-10 조회 3,680
03-04-09 조회 3,631
03-04-08 조회 2,951
03-04-07 조회 3,855
03-04-04 조회 3,363
03-04-02 조회 2,542
03-04-02 조회 2,698