RadarURL

조회 수 4828 추천 수 0 댓글 1
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
두 그룹으로 나눠진 각각의 홈페이지에서 사용하려고 그룹별 현재접속자 출력하는 방법을 찾다가 이것저것 꿰맞추고 이곳에서 주신 답을 가지고 구현한 겁니다. 구현이라기 보다는 짜맞추기에 가깝겠네요^^;
기쁜마음에 혹시 이런팁을 찾는분이 계실까해서 올려봅니다.

전체소스는 아니고, 각자 사용하는 접속자 출력소스를 보면 비슷한 부분들이 있을겁니다.
해당되는 부분만 참고하시면 쉽게 되리라 생각합니다.
=========================================================================================
// DB 연결
        $connect=dbConn();

// 멤버정보 구하기
        $member=member_info();
        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 = '$keyword' or name = '$keyword' ";
        }


// 로그인 회원의 수
        $temp2=mysql_fetch_array(mysql_query("select count(*) from $member_table where group_no=3 $s_que"));
        $total_member=$temp2[0];

// 전체회원수
        $temp=mysql_fetch_array(mysql_query("select count(*) from $member_table where group_no=3"));
        $total_member=$temp[0];

        if($status) {
                $_str = trim(zReadFile("$zero_path/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=100;
        $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) and (group_no=3) ";  
                $result=mysql_query($que) or Error(mysql_error());

        }


// 화면에 출력
echo"<link rel=StyleSheet HREF=zumanji_style.css type=text/css>
<script language='javascript'>
window.setTimeout('window.location.reload()',50000); //10초마다 리플리쉬 시킨다 1000이 1초가 된다.
</script>


<div align=right>";
echo"전체회원수 : $total_member 분<br>";
                
// 접속 멤버가 많을 경우 표 안에서 스크롤바를 만들기 위해 상단 div레이어를 이용함.
        $loop_number=$total-($page-1)*$page_num;
        while($data=mysql_fetch_array($result)) {
                $name=stripslashes($data[name]);
      
// 특정이름 안보이게
        if($name == "홍길동")
                    continue;
// 끝

                $user_id=stripslashes($data[user_id]);

// 특정ID 안보이게
        if($user_id == "abcde")
                    continue;
// 끝

              echo"<img src=img/ho.gif border=0><a href=.javascriptvoid(window.open('../view_info.php?member_no=$data[no]','view_info','width=400,height=510,toolbar=no,scrollbars=yes')) onfocus=blur()> $name</a> 님<br>";


                $loop_number--;
        }

====================================================================
특정인을 출력에서 제외할때는, 사용하는 접속자 출력 소스에 보면 $user_id=stripslashes($data[user_id]); 이런식의 부분이 있을겁니다. 그 아래에   if($user_id == "abcde")  continue; 를 추가하면 abcde라는 아이디는 제외가 됩니다.
이것은 여러개의 아이디를 추가해서 사용해도 가능하구요.
아이디가 아닌 이름을 제외할때는 name의 홍길동이라는 부분을 추가하시면 되겠구요.

그룹별로 특정 그룹만 출력을 하고 싶을때는 알맞은 위치에 group_no=그룹넘버 만 추가하면 됩니다.(위 소스에서 group_no 이 들어간 부분 // 로그인회원수 //전체회원수 //온라인멤버 뽑는 부분)

원본 소스는 여기서 받은건데...어느분건지 잊어버렸네요. (__)
엉성한 부분이 있으면 지적바랍니다.

출처 : http://www.nzeo.com/bbs/zboard.php?id=cgi_tip&page=1&sn1=&divpage=1&sn=off&ss=on&sc=off&keyword=그룹&select_arrange=headnum&desc=asc&no=5805
?
  • profile
    JaeSoo 2006.01.28 05:25
    위와 같이 하니까.. 특정 그룹인원의 현재 접속자 출력이 잘 안되더라.. 삽질하다가 다음처럼 하니까 되더라..

    $que = "select * from $member_table $s_que) and (group_no=3) ";
    요 부분을
    if($s_que) $s_que .= " or group_no=12 and no = '$member_no' "; else $s_que = " where group_no=12 and no = '$member_no' ";
    요렇게 바꿔주니 잘 되는거 같다..

공부 게시판

공부에 도움되는 글을 올려주세요.

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 [공지] 공부 게시판 입니다. 처누 2003.08.18 928104
346 응용 프로그래밍 WIndows Application의 실행 속도 측정 file JaeSoo 2023.09.06 3185
345 웹 프로그래밍 메모리 부족 현상 (allowed memory size of 134217728 bytes..) JaeSoo 2023.08.01 2207
344 웹 프로그래밍 Guzzle - cURL error 60: SSL certificate problem: unable to get local issuer certificate 문제 해결 file JaeSoo 2023.07.30 2188
343 웹 프로그래밍 XE 캐시파일 재성생후 404 Oops, Sorry. Page is not found! 나올때 JaeSoo 2023.07.29 2117
342 응용 프로그래밍 [Apple] 엔터프라이즈 계정신청 (Enterprise Program) file JaeSoo 2023.03.27 267
341 웹 프로그래밍 XE - " Fatal error: Class 'Object' not found in " / class 낫파운드 오류 file JaeSoo 2023.03.20 147
340 응용 프로그래밍 [MSA] MSA란 무엇인가? 개념 이해하기 file JaeSoo 2023.01.26 210
339 웹 프로그래밍 iOS 앱 개발을 위한 인증서 생성 및 관리 file JaeSoo 2023.01.18 218
338 프로그래밍 [ iOS ] 앱 스토어 개인, 회사, 엔터프라이즈 차이점 file JaeSoo 2023.01.09 237
337 웹 프로그래밍 PHP 파서 이해하기 (<?php의 php를 생략하고 간단히 <? 태그 와 ?> 태그를 사용하는 방법) JaeSoo 2016.08.10 322
336 프로그래밍 SVN의 cleanup 에러시 해결방법 JaeSoo 2016.05.05 728
335 프로그래밍 [오류해결] svn cleanup failed-previous operation has not finished; run cleanup if it was interrupted file JaeSoo 2016.05.05 611
334 프로그래밍 TortoiseSVN 계정변경 file JaeSoo 2016.05.05 582
333 프로그래밍 SVN passwd 설정 : 계정 (users/passwd) file JaeSoo 2016.05.04 543
332 웹 프로그래밍 XE 비회원 글쓰기 항목 지우기 file JaeSoo 2016.04.28 499
331 응용 프로그래밍 메모리 영역 (code, data, stack, heap) file JaeSoo 2016.03.23 747
330 응용 프로그래밍 [SVN] Subversion 명령들 file JaeSoo 2016.02.06 967
329 응용 프로그래밍 IBM JDK 1.6 에서 Spring 2.5.2를 사용할 때 GenericTypeResolver 에서 NullPointerException이 발생하는 문제 JaeSoo 2016.01.27 787
328 웹 프로그래밍 오른쪽 마우스 금지 소스 / 드래그 금지 소스 JaeSoo 2016.01.20 475
327 응용 프로그래밍 [전자정부 표준프레임워크] 톰캣(Tomcat) 설치하기 file JaeSoo 2016.01.02 535
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 18 Next
/ 18


즐겨찾기 (가족)

JAESOO's HOMEPAGE


YOUNGAE's HOMEPAGE


장여은 홈페이지


장여희 홈페이지


장여원 홈페이지


즐겨찾기 (업무)

알리카페 홀릭

숭실대 컴퓨터 통신연구실 (서창진)

말레이시아 KL Sentral 한국인 GuestHouse


즐겨찾기 (취미)

어드민아이디

유에코 사랑회

아스가르드 좋은사람/나쁜사람

JServer.kr

제이서버 메타블로그

재수 티스토리


즐겨찾기 (강의, 커뮤니티)

재수 강의 홈페이지


한소리


VTMODE.COM


숭실대 인공지능학과


숭실대 통신연구실


베너