현재접속자 페이지에서 그룹별 표시 정보
현재접속자 페이지에서 그룹별 표시
본문
현재접속자 페이지에서 그룹별 접속자를 보거나 게시판별 접속자를 확인하고 싶습니다.
bbs/current_connect.php?gr_id=community
간단하게 이런식으로라도 표시가 ㅤㄷㅚㅆ으면 하는데 sql구문을 어떻게 손봐야할지 모르겠더군요.
고수분들의 도움을 구합니다.
bbs/current_connect.php?gr_id=community
간단하게 이런식으로라도 표시가 ㅤㄷㅚㅆ으면 하는데 sql구문을 어떻게 손봐야할지 모르겠더군요.
고수분들의 도움을 구합니다.
댓글 전체
bbs/current_connect.php 파일을 수정해 봤습니다.
......
$list = array();
if ($gr_id) {
$sql = " select a.mb_id, b.mb_nick, b.mb_name, b.mb_email, b.mb_homepage, b.mb_open, b.mb_point, a.lo_ip, a.lo_location, a.lo_url
from $g4[login_table] a left join $g4[member_table] b on (a.mb_id = b.mb_id)
where a.mb_id <> '$config[cf_admin]' and a.mb_id in (select mb_id from $g4[group_member_table] where gr_id = '$gr_id')
order by a.lo_datetime desc ";
}
else {
$sql = " select a.mb_id, b.mb_nick, b.mb_name, b.mb_email, b.mb_homepage, b.mb_open, b.mb_point, a.lo_ip, a.lo_location, a.lo_url
from $g4[login_table] a left join $g4[member_table] b on (a.mb_id = b.mb_id)
where a.mb_id <> '$config[cf_admin]'
order by a.lo_datetime desc ";
}
$result = sql_query($sql);
.....
......
$list = array();
if ($gr_id) {
$sql = " select a.mb_id, b.mb_nick, b.mb_name, b.mb_email, b.mb_homepage, b.mb_open, b.mb_point, a.lo_ip, a.lo_location, a.lo_url
from $g4[login_table] a left join $g4[member_table] b on (a.mb_id = b.mb_id)
where a.mb_id <> '$config[cf_admin]' and a.mb_id in (select mb_id from $g4[group_member_table] where gr_id = '$gr_id')
order by a.lo_datetime desc ";
}
else {
$sql = " select a.mb_id, b.mb_nick, b.mb_name, b.mb_email, b.mb_homepage, b.mb_open, b.mb_point, a.lo_ip, a.lo_location, a.lo_url
from $g4[login_table] a left join $g4[member_table] b on (a.mb_id = b.mb_id)
where a.mb_id <> '$config[cf_admin]'
order by a.lo_datetime desc ";
}
$result = sql_query($sql);
.....

이걸 어떻게 표시해야 하나요?
bbs/current_connect_ss.php?gr_id=그룹아이디 이런식으로는 안되던데.
bbs/current_connect_ss.php?gr_id=그룹아이디 이런식으로는 안되던데.
파일을 위와 같이 수정하고 bbs/current_connect.php?gr_id=그룹아이디 이런식으로 하면 됩니다.
테스트 해 보고 올렸습니다. 작동 잘 되는데요.
테스트 해 보고 올렸습니다. 작동 잘 되는데요.

select a.mb_id, b.mb_nick, b.mb_name, b.mb_email, b.mb_homepage, b.mb_open, b.mb_point, a.lo_ip, a.lo_location, a.lo_url from g4_login a left join g4_member b on (a.mb_id = b.mb_id) where a.mb_id <> 'typemoon' and a.mb_id in (select mb_id from g4_group_member where gr_id = 'ss') order by a.lo_datetime desc
1064 : 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 'select mb_id from g4_group_member where gr_id = 'ss')
error file : /bbs/current_connect_ss.php
이런 에러가 뜨는데 mysql 버전 문제인가요?
1064 : 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 'select mb_id from g4_group_member where gr_id = 'ss')
error file : /bbs/current_connect_ss.php
이런 에러가 뜨는데 mysql 버전 문제인가요?
Mysql 버전이 4 이상이어야 합니다.
어떤 버전을 쓰시는지 알려 주시면 확인해 보겠습니다.
어떤 버전을 쓰시는지 알려 주시면 확인해 보겠습니다.

5.0.45 버전인데 이상하군요.
뭔가 잘못 적용한 곳이 있으려나요...
<?
include_once("./_common.php");
$g4[title] = $config[cf_title]." > 현재접속자";
include_once("./_head.php");
$list = array();
if ($gr_id) {
$sql = " select a.mb_id, b.mb_nick, b.mb_name, b.mb_email, b.mb_homepage, b.mb_open, b.mb_point, a.lo_ip, a.lo_location, a.lo_url
from $g4[login_table] a left join $g4[member_table] b on (a.mb_id = b.mb_id)
where a.mb_id <> '$config[cf_admin]' and a.mb_id in (select mb_id from $g4[group_member_table] where gr_id = '$gr_id')
order by a.lo_datetime desc ";
}
else {
$sql = " select a.mb_id, b.mb_nick, b.mb_name, b.mb_email, b.mb_homepage, b.mb_open, b.mb_point, a.lo_ip, a.lo_location, a.lo_url
from $g4[login_table] a left join $g4[member_table] b on (a.mb_id = b.mb_id)
where a.mb_id <> '$config[cf_admin]'
order by a.lo_datetime desc ";
}
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$list[$i] = $row;
if ($row[mb_id])
$list[$i][name] = get_sideview($row[mb_id], $row[mb_nick], $row[mb_email], $row[mb_homepage]);
else
{
if ($is_admin)
$list[$i][name] = $row[lo_ip];
else
$list[$i][name] = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", "\\1.♡.\\3.\\4", $row[lo_ip]);
}
$list[$i][num] = sprintf("%03d",$i+1);
}
$write_pages = get_paging($config[cf_write_pages], $page, $total_page, "?gr_id=$gr_id&page=");
echo "<script language=\"javascript\" src=\"$g4[path]/js/sideview.js\"></script>\n";
$connect_skin_path = "$g4[path]/skin/connect/$config[cf_connect_skin]";
include_once("$connect_skin_path/current_connect.skin.php");
include_once("./_tail.php");
?>
뭔가 잘못 적용한 곳이 있으려나요...
<?
include_once("./_common.php");
$g4[title] = $config[cf_title]." > 현재접속자";
include_once("./_head.php");
$list = array();
if ($gr_id) {
$sql = " select a.mb_id, b.mb_nick, b.mb_name, b.mb_email, b.mb_homepage, b.mb_open, b.mb_point, a.lo_ip, a.lo_location, a.lo_url
from $g4[login_table] a left join $g4[member_table] b on (a.mb_id = b.mb_id)
where a.mb_id <> '$config[cf_admin]' and a.mb_id in (select mb_id from $g4[group_member_table] where gr_id = '$gr_id')
order by a.lo_datetime desc ";
}
else {
$sql = " select a.mb_id, b.mb_nick, b.mb_name, b.mb_email, b.mb_homepage, b.mb_open, b.mb_point, a.lo_ip, a.lo_location, a.lo_url
from $g4[login_table] a left join $g4[member_table] b on (a.mb_id = b.mb_id)
where a.mb_id <> '$config[cf_admin]'
order by a.lo_datetime desc ";
}
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$list[$i] = $row;
if ($row[mb_id])
$list[$i][name] = get_sideview($row[mb_id], $row[mb_nick], $row[mb_email], $row[mb_homepage]);
else
{
if ($is_admin)
$list[$i][name] = $row[lo_ip];
else
$list[$i][name] = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", "\\1.♡.\\3.\\4", $row[lo_ip]);
}
$list[$i][num] = sprintf("%03d",$i+1);
}
$write_pages = get_paging($config[cf_write_pages], $page, $total_page, "?gr_id=$gr_id&page=");
echo "<script language=\"javascript\" src=\"$g4[path]/js/sideview.js\"></script>\n";
$connect_skin_path = "$g4[path]/skin/connect/$config[cf_connect_skin]";
include_once("$connect_skin_path/current_connect.skin.php");
include_once("./_tail.php");
?>
Mysql 5.0.77 인데 문제 없습니다.
위 코드 그대로 테스트 했습니다.
http://www.hojusports.com/main/bbs/current_connect_ss.php?gr_id=ss
위 코드 그대로 테스트 했습니다.
http://www.hojusports.com/main/bbs/current_connect_ss.php?gr_id=ss

뭐가 문제인지 모르겠군요.
아무튼 답변 감사합니다.^^
아무튼 답변 감사합니다.^^

그룹별 현재 접속자 표시