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 928208
298 웹 프로그래밍 메모리 부족 현상 (allowed memory size of 134217728 bytes..) JaeSoo 2023.08.01 2207
297 웹 프로그래밍 Guzzle - cURL error 60: SSL certificate problem: unable to get local issuer certificate 문제 해결 file JaeSoo 2023.07.30 2188
296 웹 프로그래밍 XE 캐시파일 재성생후 404 Oops, Sorry. Page is not found! 나올때 JaeSoo 2023.07.29 2117
295 웹 프로그래밍 XE - " Fatal error: Class 'Object' not found in " / class 낫파운드 오류 file JaeSoo 2023.03.20 147
294 웹 프로그래밍 iOS 앱 개발을 위한 인증서 생성 및 관리 file JaeSoo 2023.01.18 218
293 웹 프로그래밍 PHP 파서 이해하기 (<?php의 php를 생략하고 간단히 <? 태그 와 ?> 태그를 사용하는 방법) JaeSoo 2016.08.10 322
292 웹 프로그래밍 XE 비회원 글쓰기 항목 지우기 file JaeSoo 2016.04.28 499
291 웹 프로그래밍 오른쪽 마우스 금지 소스 / 드래그 금지 소스 JaeSoo 2016.01.20 475
290 웹 프로그래밍 Strict standards and C5 support errors JaeSoo 2015.12.02 524
289 웹 프로그래밍 ICT노트 :: 반응형웹을 만드는 기술은? file JaeSoo 2015.09.26 490
288 웹 프로그래밍 [번역] 2014년 가장 인기있는 5가지 프론트엔드 프레임워크 비교 file JaeSoo 2015.09.25 862
287 웹 프로그래밍 최고의 반응형 CSS 프레임워크 18선 (2013년 7월기준) file JaeSoo 2015.09.25 586
286 웹 프로그래밍 가장 진보된 반응형 웹을 위한 프레임워크 UIkit file JaeSoo 2015.09.25 560
285 웹 프로그래밍 반응형 웹을 위한 프론트-엔드 프레임 워크 (front-end framework for developing responsive web) file JaeSoo 2015.09.25 739
284 웹 프로그래밍 한국형 반응형웹 프레임웍을 찾아서 - 왜 우리는 IE 7,8때문에 고통받아야 하는가? file JaeSoo 2015.09.25 611
283 웹 프로그래밍 한국을 위한 CSS 그리드 디자인 프레임워크 JaeSoo 2015.09.25 531
282 웹 프로그래밍 과연 반응형 웹 디자인만이 해답일까? file JaeSoo 2015.09.25 536
281 웹 프로그래밍 반응형 웹 디자인의 단점 file JaeSoo 2015.09.25 567
280 웹 프로그래밍 웹디자인 신기술 트렌드 및 적용 사례 file JaeSoo 2015.07.28 510
279 웹 프로그래밍 제이쿼리(jQuery) 튜토리얼(Tutorial) 모음 file JaeSoo 2015.07.28 1255
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 15 Next
/ 15


즐겨찾기 (가족)

JAESOO's HOMEPAGE


YOUNGAE's HOMEPAGE


장여은 홈페이지


장여희 홈페이지


장여원 홈페이지


즐겨찾기 (업무)

알리카페 홀릭

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

말레이시아 KL Sentral 한국인 GuestHouse


즐겨찾기 (취미)

어드민아이디

유에코 사랑회

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

JServer.kr

제이서버 메타블로그

재수 티스토리


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

재수 강의 홈페이지


한소리


VTMODE.COM


숭실대 인공지능학과


숭실대 통신연구실


베너