<?
require_once('include/global.php');
require_once("include/admin_lib.php");
require_once("include/member_lib.php");


$mode_admin = 1;

// Config
	if ($mode_sadmin)
	{
		$CFG[TITLE] = "<b>메일서버관리</b> >> <b>전체회원관리</b>";
	} else
	{
		if ($_GET['list_type'] == 1)
		{
			$CFG[TITLE] = "<b>관리자메뉴</b> >> <b>회원관리/가입대기</b>";
		} else if ($_GET['list_type'] == 2)
		{
			$CFG[TITLE] = "<b>관리자메뉴</b> >> <b>회원관리/휴면계정</b>";
		} else if ($_GET['list_type'] == 3)
		{
			$CFG[TITLE] = "<b>관리자메뉴</b> >> <b>회원관리/사용기간</b>";
		} else
		{
			$CFG[TITLE] = "<b>관리자메뉴</b> >> <b>회원관리</b>";
		}	// if()
	}	// if()

	$CFG[TITLE] = $CFG[TITLE] . " >> <b>목록</b>";



	$q_sadmin = '';
	$q_sadmin_as = '';
	$q_sadmin_mf = " AND mbf_name != 'm_quota' ";
	if ($mode_admin) {
		if ($mode_sadmin)
		{
			auth_limit("serveradmin");
			// [2007-05-18] 전체회원관리에서 회원가입양식은 관리자의 도메인 설정을 따르도록 함.
			if ($sa_d_no)
			{
				$q_sadmin = " AND d_no='".$sa_d_no."' ";
				$q_sadmin_as = " AND d.d_no='".$sa_d_no."' ";
				$q_sadmin_mf .= " AND d_no='".$sa_d_no."' ";
			} else
			{
				$q_sadmin_mf .= " AND d_no='".$AUTH['auth_d_no']."' ";
			}	// if()
		} else
		{
			auth_limit("admin");
			$q_sadmin = " AND d_no='".$AUTH['auth_d_no']."' ";
			$q_sadmin_as = " AND d.d_no='".$AUTH['auth_d_no']."' ";
			// [2008-01-04] 멀티도메인 사용시 회원목록 필드 보여주기설정이 제대로 안되던 오류 수정.
			$q_sadmin_mf .= " AND d_no='".$AUTH['auth_d_no']."' ";
			$sa_d_no = 0;
		}	// if()

		if (!is_numeric($_GET['page_size']) || $_GET['page_size'] > 100)
			$_GET['page_size'] = 20;

		// Query String
			require_once("include/querystring.php");

			$_ar_qs_text = array("mode_admin", "mode_sadmin", "sa_d_no", "s_mg_no", "s_mc_no", "list_type", "m_no", "reqPage", "s_query", "s_key", "s_key2", "s_kind1", "s_kind2", "s_kind3", "s_kind4", "s_word", "s_word1", "s_word2", "s_word3", "s_word4_1", "s_word4_2", "s_and_or1", "s_and_or2", "s_and_or3", "page_size");
			$_ar_qs_value = array($mode_admin, $mode_sadmin, $sa_d_no, $s_mg_no, $s_mc_no, $list_type, $m_no, $reqPage, $s_query, $s_key, $s_key2, $s_kind1, $s_kind2, $s_kind3, $s_kind4, $s_word, $s_word1, $s_word2, $s_word3, $s_word4_1, $s_word4_2, $s_and_or1, $s_and_or2, $s_and_or3, $_GET['page_size']);

			$CFG[QS]['DEFAULT'] = querystring($_ar_qs_text, $_ar_qs_value);		// $cfg_qs = "local_id=busan&reqPage=2"
			$CFG[QS]['SEARCH'] = querystring_cut($CFG[QS]['DEFAULT'], "m_no", "reqPage", "s_query", "s_key", "s_key2", "s_kind1", "s_kind2", "s_kind3", "s_kind4", "s_word", "s_word1", "s_word2", "s_word3", "s_word4_1", "s_word4_2", "s_and_or1", "s_and_or2", "s_and_or3");
			$CFG[QS]['SORT'] = querystring_cut($CFG[QS]['DEFAULT'], "m_no", "reqPage", "s_key", "s_key2");
			$CFG[QS]['RESET'] = $CFG[QS]['SEARCH'];
			$CFG[QS]['LIST'] = querystring_cut($CFG[QS]['DEFAULT'], "m_no");
			$CFG[QS]['LIST_PAGE'] = querystring_cut($CFG[QS]['DEFAULT'], "m_no", "reqPage");
	} else
	{
		$mode_sadmin = 0;
	}	// if()




$dm = get_domain($G_SYS['MAIL_DOMAIN']);

// filed
	// list


		$q = "
			SELECT
				mbf_name, mbf_text
			FROM
				$TB[MEMBER_FIELD]
			WHERE
				mbf_islist = 'Y'
				$q_sadmin_mf
			ORDER BY
				mbf_step, mbf_no
			";
		//echo "<HR>" . $q;
		$_mf = db_get_rows($q, true);

		$_mbf_cnt = sizeof($_mf[mbf_name]);

		if ($_mbf_cnt < 1)
		{
			error("회원가입항목이 없습니다. => ".$G_SYS['MAIL_DOMAIN'], 'SERVER_ERROR', false);
		}	// if()

		// [2025-11-13] 업데이트된 경우 사원번호에 메일용량뒤로 나오는 현상 개선을 위해 사원번호는 레벨 뒤에 나오도록 위치 수동 조정
		if (($m_emp_no_dx = array_search('m_emp_no', $_mf['mbf_name'])) !== false) {
			$_mf_tmp = array(
				'mbf_name' => array(),
				'mbf_text' => array(),
			);
			foreach ($_mf['mbf_name'] as $key => $val) {
				if ($key === $m_emp_no_dx) {
					continue;
				}
				$_mf_tmp['mbf_name'][] = $_mf['mbf_name'][$key];
				$_mf_tmp['mbf_text'][] = $_mf['mbf_text'][$key];

				if ($val === 'm_level') {
					$_mf_tmp['mbf_name'][] = $_mf['mbf_name'][$m_emp_no_dx];
					$_mf_tmp['mbf_text'][] = $_mf['mbf_text'][$m_emp_no_dx];
				}
			}
			$_mf = $_mf_tmp;
			unset($_mf_tmp);
		}

		$CFG[LIST_FIELD] = array();
		$CFG[LIST_FIELD_KEY] = array();

		// [2006-03-07] 휴면/사용기간
		if ($_GET['list_type'] == 2)
		{
			$CFG[LIST_FIELD]['m.m_suspend_start'] = '휴면 시작일자';
			$CFG[LIST_FIELD_KEY]['m_suspend_start'] = '휴면 시작일자';
			$CFG[LIST_FIELD]['m.m_suspend_end'] = '휴면 만료일자';
			$CFG[LIST_FIELD_KEY]['m_suspend_end'] = '휴면 만료일자';
			if (!$s_key)
			{
				$s_key = " m.m_suspend_end ";
				$s_key2 = "ASC";
			}	// if()
		} else if ($_GET['list_type'] == 3)
		{
			$CFG[LIST_FIELD]['m.m_use_start'] = '사용기간 시작일자';
			$CFG[LIST_FIELD_KEY]['m_use_start'] = '사용기간 시작일자';
			$CFG[LIST_FIELD]['m.m_use_end'] = '사용기간 만료일자';
			$CFG[LIST_FIELD_KEY]['m_use_end'] = '사용기간 만료일자';
			if (!$s_key)
			{
				$s_key = " m.m_use_end ";
				$s_key2 = "ASC";
			}	// if()
		}	// if()

		$mbr_group = array();
		$mbr_class = array();

		if ($mode_sadmin)
		{
			$CFG[LIST_FIELD]['d.d_name'] = '도메인';
			$CFG[LIST_FIELD_KEY]['d_name'] = '도메인';
		} else
		{
			// 회원조직
			require_once('include/member_group_lib.php');
			$cg = new NmailMemberGroup;

			$cg_dataall = $cg->getRowsByParent(0, 255, 1, "AND d_no='".$dm['d_no']."'");
			$cg_dataall_cnt = (is_array($cg_dataall[$cg->field_key])) ? sizeof($cg_dataall[$cg->field_key]) : 0;

			$cg_dataall_option = array();
			for ($i=0; $i<$cg_dataall_cnt; $i++)
			{
				$_val = NULL;
				for ($j=1; $j<$cg_dataall[$cg->field_depth][$i]; $j++)
				{
					$_val .= " &nbsp;&nbsp; ";
				}	// for()

				if ($_val != '')
					$_val .= "┗ ";

				if ($_GET['s_mg_no'] == $cg_dataall[$cg->field_key][$i])		// 선택된 상위메뉴일때
				{
					$_val .= $cg_dataall[$cg->field_name][$i] . "(*)";
				} else
				{
					$_val .= $cg_dataall[$cg->field_name][$i];
				}	// if()

				$cg_dataall_option['val'][] = $_val;
				$cg_dataall_option['key'][] = $cg_dataall[$cg->field_key][$i];

				// mbr_group
				$mbr_group['mg_no'][] = $cg_dataall[$cg->field_key][$i];
				$mbr_group['mg_name'][] = $cg_dataall[$cg->field_name][$i];
			}	// for()

			if ($cg_dataall)
			{
				$select_mbr_group = select_list_value ($_GET['s_mg_no'], $cg_dataall_option['val'], $cg_dataall_option['key'], '전체 조직', 0, 1);
				$select_mbr_group_sign = select_list_value ($_GET['s_mg_no'], $cg_dataall_option['val'], $cg_dataall_option['key'], '소속 조직 선택', 0, 1);
			}	// if()

			// 회원직위
			$q = "SELECT * FROM ".$TB['MEMBER_CLASS']." WHERE d_no='".$dm['d_no']."' ORDER BY mc_sort, mc_name";
			$mbr_class = db_get_rows($q, true);
			if ($mbr_class)
			{
				$select_mbr_class = select_list_value($_GET['s_mc_no'], $mbr_class['mc_name'], $mbr_class['mc_no'], '전체 직위', 0, 1);
			}	// if()
		}	// if()


		// 리스트 항목 선언
		if ($mbr_group)
		{
			$CFG[LIST_FIELD]['m.mg_no'] = '조직';
			$CFG[LIST_FIELD_KEY]['mg_no'] = '조직';
		}	// if()

		for ($i=0; $i<$_mbf_cnt; $i++)
		{
			$CFG[LIST_FIELD]["m." . $_mf[mbf_name][$i]] = $_mf[mbf_text][$i];
			$CFG[LIST_FIELD_KEY][$_mf[mbf_name][$i]] = $_mf[mbf_text][$i];

			if ($_GET['list_type'] != 1)
			{
				// 이름 뒤에 직위 표시
				if ($_mf[mbf_name][$i] == 'm_name')
				{
					if ($mbr_class)
					{
						$CFG[LIST_FIELD]['m.mc_no'] = '직위';
						$CFG[LIST_FIELD_KEY]['mc_no'] = '직위';
					}	// if()
				}	// if()
			}	// if()
		}	// for()

		// [2025-11-13] 메일용량은 추가 필드 항목 마지막에 나오도록 직접 선언
		$CFG[LIST_FIELD]['m.m_quota'] = '메일용량';
		$CFG[LIST_FIELD_KEY]['m_quota'] = 'm.m_quota';

		// [2007-12-28] 대용량첨부, 웹하드
		if ($mode_sadmin || $dm['d_bigfile_isuse'] == 'Y')
		{
			$CFG[LIST_FIELD]['m.m_bigfile_quota'] = '대용량첨부';
			$CFG[LIST_FIELD_KEY]['m_bigfile_quota'] = 'm.m_bigfile_quota';
		}	// if()
		if ($G_SYS[WEBHARD_USE] && ($mode_sadmin || $dm['d_webhard_isuse'] == 'Y'))
		{
			$CFG[LIST_FIELD]['m.m_webhard_quota'] = '웹하드';
			$CFG[LIST_FIELD_KEY]['m_webhard_quota'] = 'm.m_webhard_quota';
		}	// if()


		// [2007-03-07] 서비스 항목 추가
		$CFG[LIST_FIELD]['m.m_is_use'] = '<img src=img/svc_u.gif border=0 title="메일 계정 사용여부" align=absmiddle border=0>';
		$CFG[LIST_FIELD_KEY]['m_is_use'] = '';
		$CFG[LIST_FIELD]['m.m_svc_smtp'] = '<img src=img/svc_s.gif border=0 title="SMTP 서비스 허용여부" align=absmiddle border=0>';
		$CFG[LIST_FIELD_KEY]['m_svc_smtp'] = '';
		$CFG[LIST_FIELD]['m.m_svc_pop3'] = '<img src=img/svc_p.gif border=0 title="POP3 서비스 허용여부" align=absmiddle border=0>';
		$CFG[LIST_FIELD_KEY]['m_svc_pop3'] = '';
		$CFG[LIST_FIELD]['m.m_forwarding_type'] = '<img src=img/svc_f.gif border=0 title="메일 포워딩 사용여부" align=absmiddle border=0>';
		$CFG[LIST_FIELD_KEY]['m_forwarding_type'] = '';
		$CFG[LIST_FIELD]['m_mailing_list'] = '<img src=img/svc_m.gif border=0 title="메일링 등록여부" align=absmiddle border=0>';
		$CFG[LIST_FIELD_KEY]['m_mailing_list'] = '';
		$CFG[LIST_FIELD]['m.m_2fa_isuse'] = '<img src=img/svc_2fa.gif border=0 title="메일 2단계 인증 사용여부" align=absmiddle border=0>';
		$CFG[LIST_FIELD_KEY]['m_2fa_isuse'] = '';
		/*
		$CFG[LIST_FIELD]['m.m_is_use'] = 'U';
		$CFG[LIST_FIELD_KEY]['m_is_use'] = '';
		$CFG[LIST_FIELD]['m.m_svc_smtp'] = 'S';
		$CFG[LIST_FIELD_KEY]['m_svc_smtp'] = '';
		$CFG[LIST_FIELD]['m.m_svc_pop3'] = 'P';
		$CFG[LIST_FIELD_KEY]['m_svc_pop3'] = '';
		$CFG[LIST_FIELD]['m.m_forwarding_type'] = 'F';
		$CFG[LIST_FIELD_KEY]['m_forwarding_type'] = '';
		*/

		if (! $mode_sadmin && $G['DINFO']['d_svc_2fa'] !== 'Y') {
			unset($CFG[LIST_FIELD]['m.m_2fa_isuse']);
			unset($CFG[LIST_FIELD]['m_2fa_isuse']);
		}

	// search
		$q = "
			SELECT
				mbf_name, mbf_text
			FROM
				$TB[MEMBER_FIELD]
			WHERE
				mbf_isuse = 'Y' AND
				(
					mbf_name NOT LIKE '%day' AND
					mbf_name NOT LIKE '%date%' AND
					mbf_name NOT LIKE '%date'
				)
				$q_sadmin_mf
			ORDER BY
				mbf_step, mbf_no
			";

		//echo "<HR>" . $q;
		$_mf = db_get_rows($q, true);

		$_mbf_cnt = sizeof($_mf[mbf_name]);

		$CFG[SEARCH_FIELD] = array();

		if ($mode_sadmin)
		{
			$CFG[SEARCH_FIELD]['d.d_name'] = '도메인';
		}	// if()

		for ($i=0; $i<$_mbf_cnt; $i++)
		{
			$CFG[SEARCH_FIELD]["m." . $_mf[mbf_name][$i]] = $_mf[mbf_text][$i];
		}	// for()


	// search2
		$q = "
			SELECT
				mbf_name, mbf_text
			FROM
				$TB[MEMBER_FIELD]
			WHERE
				mbf_isuse = 'Y' AND
				(
					mbf_name LIKE '%day' OR
					mbf_name LIKE '%date%' OR
					mbf_name LIKE '%date'
				)
				$q_sadmin_mf
			ORDER BY
				mbf_step, mbf_no
			";
		//echo "<HR>" . $q;
		$_mf = db_get_rows($q, true);

		$_mbf_cnt = sizeof($_mf[mbf_name]);

		$CFG[SEARCH2_FIELD] = NULL;
		for ($i=0; $i<$_mbf_cnt; $i++)
		{
			$CFG[SEARCH2_FIELD]["m." . $_mf[mbf_name][$i]] = $_mf[mbf_text][$i];
		}	// for()

		// [2025-08-06] 회원관리에 개별 검색 추가
		$CFG['SEARCH_LIST_FIELD'] = array(
			'm_id' => '아이디',
			'm_name' => '이름',
			'm_email' => '보조 E-mail',
			'm_no' => '회원번호',
		);

		if ($mode_sadmin) {
			$CFG['SEARCH_LIST_FIELD1'] = array(
				'd_name' => '도메인',
			);

			$CFG['SEARCH_LIST_FIELD'] = array_merge($CFG['SEARCH_LIST_FIELD'], $CFG['SEARCH_LIST_FIELD1']);
		}

		$select_search_field = select_list_value($_GET['s_field'], array_values($CFG['SEARCH_LIST_FIELD']), array_keys($CFG['SEARCH_LIST_FIELD']), '전체', 0, 1);

		// [2025-08-06] 기간 검색 추가
		$CFG['ADMIN_SECURITY_DATE_TYPE'] = array(
			'm.m_last_logindate'  => '웹메일 로그인',
			'm.m_smtp_auth_date'  => 'SMTP 인증',
			'm.m_pop3_auth_date'  => 'POP3 인증',
			'm.m_receive_date'    => '메일 수신',
			'm.m_2fa_date'        => '2단계 인증 등록',
			'm.m_last_pwdchgdate' => '비밀번호 변경',
			'm.m_regdate'         => '계정 등록',
		);

		if (! $mode_sadmin && $G['DINFO']['d_svc_2fa'] !== 'Y') {
			unset($CFG['ADMIN_SECURITY_DATE_TYPE']['m.m_2fa_date']);
		}

		if ( ! file_exists($G_SYS['PAGE_ROOT'] . '/admin_security_list.php')) {
			unset($CFG['ADMIN_SECURITY_DATE_TYPE']['m.m_smtp_auth_date']);
			unset($CFG['ADMIN_SECURITY_DATE_TYPE']['m.m_pop3_auth_date']);
			unset($CFG['ADMIN_SECURITY_DATE_TYPE']['m.m_receive_date']);
			unset($CFG['ADMIN_SECURITY_DATE_TYPE']['m.m_2fa_date']);
		}

		$select_date_type = select_list_value($_GET['date_type'], array_values($CFG['ADMIN_SECURITY_DATE_TYPE']), array_keys($CFG['ADMIN_SECURITY_DATE_TYPE']), '', 0, 1);

		// [2025-11-19] 접속 초과 검색
		$CFG['ADMIN_SECURITY_DATE_TYPE2'] = array(
			'M_WEB_SMTP_POP3'   => '웹메일/SMTP/POP3',
			'M_SMTP_POP3'       => 'SMTP/POP3 인증',
			'M_WEB'             => '웹메일 로그인',
			'M_LAST_PWDCHGDATE' => '비밀번호 변경',
		);

		$select_date_type2 = select_list_value($_GET['date_type2'], array_values($CFG['ADMIN_SECURITY_DATE_TYPE2']), array_keys($CFG['ADMIN_SECURITY_DATE_TYPE2']), '', 0, 1);

// search
	$q_where = '';
	if ($s_word)
	{
		set_q_search($s_word);

		// [2013-09-06] m_no=숫자 검색 지원
        // [2020-10-29] m_mail_file_group=그룹번호 검색 지원
		$_tmp = str_replace('m_no=', '', $s_word);
		if (is_numeric($_tmp) && $_tmp > 0 && strlen($_tmp)===strlen((int)$_tmp))
		{
			$q_where .= " AND m.m_no='" . $_tmp . "' ";
		} else
		{
			// [2025-08-06] 회원관리에 개별 검색 추가
			if ($_GET['s_field']) {
				switch ($_GET['s_field']) {
					case 'd_name':
						$q_where .= " AND ( d.d_name LIKE '%" . $_GET['s_word'] . "%' ";
						break;

					case 'm_id':
						$q_where .= " AND ( m.m_id LIKE '%" . $_GET['s_word'] . "%' ";
						break;

					case 'm_name':
						$q_where .= " AND ( m.m_name LIKE '%" . $_GET['s_word'] . "%' ";
						break;

					case 'm_email':
						$q_where .= " AND ( m.m_email LIKE '%" . $_GET['s_word'] . "%' ";
						break;

					case 'm_no':
						$q_where .= " AND ( m.m_no='" . $_GET['s_word'] . "' ";
						break;
				}
			} else {
				$q_where .= " AND ( m.m_id LIKE '%" . $s_word . "%' OR m.m_name LIKE '%" . $s_word
					. "%' OR m.m_email LIKE '%" . $s_word . "%' OR d.d_name LIKE '%" . $s_word . "%'";
			}
			// [2022-09-23] 숫자일 경우만 회원 그룹 번호 검색
			if (is_numeric($s_word)) {
				$q_where .= "  OR m.m_mail_file_group = '" . $s_word . "'";
			}

			$q_where .= ") ";
		}	// if()

		$v_s_word = htmlspecialchars_fix(stripslashes($s_word));
	}	// if()

	// [2025-08-06] 기간 검색 추가, 검색조건이 없을 때 기본적으로 전체 로그 보여주도록 함.
	if ($_GET['sdp'] != 'A' && !$_GET['sd1'] && !$_GET['sd2'])
	{
		$_GET['sdp'] = 'A';
		$_GET['sd1'] = null;
		$_GET['sd2'] = null;
	}	// if()

	if (
		$_GET['sd1']
		&& ($sd1 = date_start($_GET['sd1']))
		&& $_GET['sd2']
		&& ($sd2 = date_end($_GET['sd2']))
		&& isset($CFG['ADMIN_SECURITY_DATE_TYPE'][$_GET['date_type']])     // 변수에 선언된 컬럼만 허용
	) {
		$q_where .= " AND " . $_GET['date_type'] . " BETWEEN '" . $sd1 . "' AND '" . $sd2 . "' ";
	}    // if()

	// [2025-11-19] 미사용 기간 검색
	if ($_GET['sd3'] && ($sd3 = date_end($_GET['sd3']))) {
		switch ($_GET['date_type2'])
		{
			case "M_SMTP_POP3":
				$q_where .= " AND (
							(m.m_smtp_auth_date <= '" . $sd3 . "' OR m.m_smtp_auth_date IS NULL) 
							AND (m.m_pop3_auth_date <= '" . $sd3 . "' OR m.m_pop3_auth_date IS NULL)
						) ";
				break;

			case "M_WEB":
				$q_where .= " AND (
							m.m_last_logindate <= '" . $sd3 . "' OR m.m_last_logindate IS NULL OR m.m_last_logindate = '0000-00-00 00:00:00'
							) ";
				break;

			case "M_LAST_PWDCHGDATE":
				$q_where .= " AND (
							m.m_last_pwdchgdate <= '" . $sd3 . "' OR m.m_last_pwdchgdate IS NULL OR m.m_last_pwdchgdate = '0000-00-00 00:00:00'
							) ";
				break;

			case "M_WEB_SMTP_POP3":
			default:
				$q_where .= " AND (
							(m.m_last_logindate <= '" . $sd3 . "' OR m.m_last_logindate IS NULL OR m.m_last_logindate = '0000-00-00 00:00:00') 
							AND (m.m_smtp_auth_date <= '" . $sd3 . "' OR m.m_smtp_auth_date IS NULL) 
							AND (m.m_pop3_auth_date <= '" . $sd3 . "' OR m.m_pop3_auth_date IS NULL)
						) ";
				break;
		}

		// 미사용 기간 기준일 이전에 추가된 계정만 포함 (신규 계정 생성시 미사용 기간 고려)
		$q_where .= " AND m.m_regdate < '" . $sd3 . "' ";
	}


// [2007-07-21] 메일링 리스트 계정은 제외
	$q_where .= " AND m.m_usertype IS NULL ";


// [대표 계정 관리]
	if (isset($_GET['m_team_mail_is_use']) && $_GET['m_team_mail_is_use'] === 'Y') {
		$q_where .= " AND m.m_team_mail_is_use='Y' ";
	}

// msg / search start
	if (($s_word)||($s_word1)||($s_word2)||($s_word3)||( ($s_word4_1)&&($s_word4_2) ))		// search mode
	{
		$null_msg = "검색된 회원이 없습니다.";
		$count_msg = "검색된 회원";

		$_search_q_where = " ) ";		// search end
	}else		// normal mode
	{
		$null_msg = "등록된 회원이 없습니다.";
		$count_msg = "전체 회원";
		$_search_q_where = NULL;
	}	// if()


// search
	if (  ($s_word2)||($s_word3)||( ($s_word4_1)&&($s_word4_2) )  ) {
		$q_where_start .= " ( ";		// search start
		$q_where_end .= " ) ";		// search end
	}	// if()

	if ($s_word1 == true)		// search mode
	{
		set_q_search($s_word1);
		$q_where .= " AND $q_where_start " . $s_kind1 . " like '%" . $s_word1 . "%' ";
	}	// if()

	if ($s_word2 == true)		// search mode
	{
		set_q_search($s_word2);
		$q_where .= " $s_and_or1 " . $s_kind2 . " like '%" . $s_word2 . "%' ";
	}	// if()

	if ($s_word3 == true)		// search mode
	{
		set_q_search($s_word3);
		$q_where .= " $s_and_or2 " . $s_kind3 . " like '%" . $s_word3 . "%' ";
	}	// if()

// search - date
	if ( ($s_word4_1)&&($s_word4_2) ) {
		if ($G_SYS[DB] == 'oracle')
		{
			$q_where .= "
				$s_and_or3
					(
					$s_kind4 >= '$s_word4_1' AND
					$s_kind4 <= '$s_word4_2'
					)
				";
		} else
		{
			$q_where .= "
				$s_and_or3
					(
					UNIX_TIMESTAMP($s_kind4) >= UNIX_TIMESTAMP('$s_word4_1') AND
					UNIX_TIMESTAMP($s_kind4) <= UNIX_TIMESTAMP('$s_word4_2')+(60*60*24)
					)
				";
		}	// if()
	}	// if()

// serach end
	$q_where .= $q_where_end;

// [2006-02-21] search - 회원조직
	$q_join = '';
	if ($_GET['s_mg_no'])		// search mode
	{
		set_q_search($_GET['s_mg_no']);
		//$q_where .= " AND m.mg_no = '" . $_GET['s_mg_no'] . "' ";
		$q_join = "JOIN ".$TB['MEMBER_GROUP_REL']." mgr ";
		$q_where .= " AND m.m_no = mgr.m_no AND mgr.mg_no = '" . $_GET['s_mg_no'] . "' ";
	}	// if()

	if ($_GET['s_mc_no'])		// search mode
	{
		set_q_search($_GET['s_mc_no']);
		$q_where .= " AND m.mc_no = '" . $_GET['s_mc_no'] . "' ";
	}	// if()

// search - 가입대기
	if ($_GET['list_type'] == 1)
	{
		$q_where .= " AND m.m_level = '" . $G[LEVEL][wait] . "' ";
	} else if ($_GET['list_type'] == 2)
	{
		$q_where .= " AND (m.m_suspend_start IS NOT NULL OR m.m_suspend_start != '') AND m.m_level != '" . $G[LEVEL][wait] . "' ";
	} else if ($_GET['list_type'] == 3)
	{
		$q_where .= " AND (m.m_use_start IS NOT NULL OR m.m_use_start != '') AND m.m_level != '" . $G[LEVEL][wait] . "' ";
	} else
	{
		// [2008-08-12] 전체회원관리에서는 가입대기인 회원도 보이도록 함. (도메인 삭제시 편의를 위함)
		if (!$mode_sadmin)
			$q_where .= " AND m.m_level != '" . $G[LEVEL][wait] . "' ";
	}	// if()

// search - default field
	if (!$s_kind1) $s_kind1 = "m.m_id";
	if (!$s_kind2) $s_kind2 = "m.m_name";
	if (!$s_kind3) $s_kind3 = "m.m_email";
	if (!$s_kind4) $s_kind4 = "m.m_regdate";


// sort
    // [2020-02] KVE SQL Injection
	$q_order = ($s_key) ? " ".del_injection_str($s_key, "m.m_no")." " : " m.m_no ";
	if($s_key2)
	{
		//$q_order .=  " $s_key2 ";
        if($s_key2 == 'ASC'){
            $q_order .= ' ASC';
        }else{
            $q_order .= ' DESC';
        }
		if($s_key2 == "ASC")
		{
			$s_key2_set = "DESC";
		}else
		{
			$s_key2_set = "ASC";
		}
	}else
	{
		$q_order .=  " DESC ";
		$s_key2_set = "ASC";
	}

	$order_field = array_keys($CFG[LIST_FIELD]);
	$order_img = get_order_img($order_field, $s_key, $s_key2, 1);		// array


// list
	$list_field = array_keys($CFG[LIST_FIELD]);
	$list_text = array_values($CFG[LIST_FIELD]);
	$list_field_key = array_keys($CFG[LIST_FIELD_KEY]);

// paging
	require_once("include/page.php");

	if ($G_SYS['NM_ADMIN_MBR_EXCEL_DOWN'] && $_GET['excel_down'])
	{
		set_time_limit(3600);
		$_GET['page_size'] = 999999;
	}
	if ($G_SYS[DB] == 'oracle') {
		$q_count = "
					SELECT
						COUNT(DISTINCT m.m_no)
					FROM
						$TB[MEMBER] m 
						JOIN $TB[DOMAIN] d ON m.d_no=d.d_no
						LEFT JOIN $TB[MAILING_LIST] ml ON ml.ml_email = CONCAT(CONCAT(m.m_id, '@'), d.d_name)
						" . $q_join . "
					WHERE
						1=1
						$q_sadmin_as
						" . $q_where . "
								";
	} else {
		$q_count = "
					SELECT
						COUNT(DISTINCT m.m_no)
					FROM
						$TB[MEMBER] m 
						JOIN $TB[DOMAIN] d ON m.d_no=d.d_no
						LEFT JOIN $TB[MAILING_LIST] ml ON ml.ml_email = CONCAT(m.m_id, '@', d.d_name)
						" . $q_join . "
					WHERE
						1=1
						$q_sadmin_as
						" . $q_where . "
								";
	}
	$strTrans = "&mode=$mode&" . $CFG[QS]['LIST_PAGE'];
	disPgProc($q_count, $_GET['page_size'], $strTrans, "DESC");


// get
	if ($G_SYS[DB] == 'oracle') {
		$q = "
				SELECT
					m.*, d.d_name, (SELECT COUNT(*)
							          FROM nmail_mailing_list ml
							         WHERE ml.ml_email = m.m_id || '@' || d.d_name
							        ) AS m_mailing_list
				FROM
					$TB[MEMBER] m
					JOIN $TB[DOMAIN] d ON m.d_no=d.d_no
					LEFT JOIN $TB[MAILING_LIST] ml ON ml.ml_email = CONCAT(CONCAT(m.m_id, '@'), d.d_name)
					" . $q_join . "
				WHERE
					1=1
					$q_sadmin_as
					" . $q_where . "
				ORDER BY
				$q_order ";
	} else {
		$q = "
				SELECT
					m.*, d.d_name, count(ml.m_no) AS m_mailing_list
				FROM
					$TB[MEMBER] m
					JOIN $TB[DOMAIN] d ON m.d_no=d.d_no
					LEFT JOIN $TB[MAILING_LIST] ml ON ml.ml_email = CONCAT(m.m_id, '@', d.d_name)
					" . $q_join . "
				WHERE
					1=1
					$q_sadmin_as
					" . $q_where . "
				GROUP BY m.m_no
				ORDER BY
				$q_order ";
	}
		#echo "<HR>" . $q;
		$m = db_get_rows($q, $limitOffset, $limitRows);
		$m_list_cnt = sizeof($m);

		$q_transfer = $q1;

	// set list
		$m_list = $m;

		if ($G_SYS['NM_ADMIN_MBR_EXCEL_DOWN'] && $_GET['excel_down'])
		{
			$m_excel = array();
		}

		if($m)
		{
			for($i=0; $i<sizeof($m); $i++)
			{
				// [2006-06-23] 메일주소 클릭시 이름도 같이 들어가도록 함.
				#$m_list[$i][m_id] = get_mailto_url($m[$i][m_id].'@'.$m[$i][d_name], $m[$i][m_id]);
				$m_list[$i][m_id] = get_mailto_url($m[$i][m_id].'@'.$m[$i][d_name], $m[$i][m_id], false, $m[$i][m_name]);
				// $m_list[$i][m_name] = '<a href="'.$nmpath.'/admin_mbr_mod.php?m_no='.$m[$i][m_no].'&'.$CFG[QS]['LIST'].'"><b>'.$m[$i][m_name].'</b></a>';
				// [2025-09-03] 레이어 메뉴 추가를 위해 수정
				$m_list[$i][m_name] = '<a href="javascript:toggleDropdown(\'' . $m[$i][m_no] . '\')">'. $m[$i][m_name] . '<b class="caret"></b></a>';
				//$m_list[$i][m_level] = $G[LEVEL_NAME][$m[$i][m_level]] . "(" . $m[$i][m_level] . ")";
				$m_list[$i][d_name] = "<a href=\"".$nmpath."/admin_mbr_list.php?mode_sadmin=1&sa_d_no=" . $m[$i][d_no] . "\">" . $m[$i][d_name] . "</a>";
				$m_list[$i][m_level] = "<a href=\"".$nmpath."/admin_mbr_list.php?s_kind1=m.m_level&s_word1=" . $m[$i][m_level] . "&".$CFG[QS][SEARCH]."\">" . $G[LEVEL_NAME][$m[$i][m_level]] . "(" . $m[$i][m_level] . ")</a>";
				$m_list[$i][m_email] = get_mailto_url($m[$i][m_email]);
				$m_list[$i][m_sex] = $G[SEX][$m[$i][m_sex]];
				$m_list[$i][m_birthday] = ($m[$i][m_birthday] != "0000-00-00") ? $m[$i][m_birthday] : NULL;
				$m_list[$i][m_marrydate] = ($m[$i][m_marrydate] != "0000-00-00") ? $m[$i][m_marrydate] : NULL;

				$m_list[$i][m_date1] = ($m[$i][m_date1] != "0000-00-00") ? $m[$i][m_date1] : NULL;
				$m_list[$i][m_date2] = ($m[$i][m_date2] != "0000-00-00") ? $m[$i][m_date2] : NULL;
				$m_list[$i][m_date3] = ($m[$i][m_date3] != "0000-00-00") ? $m[$i][m_date3] : NULL;
				$m_list[$i][m_date4] = ($m[$i][m_date4] != "0000-00-00") ? $m[$i][m_date4] : NULL;
				$m_list[$i][m_date5] = ($m[$i][m_date5] != "0000-00-00") ? $m[$i][m_date5] : NULL;

				$m_list[$i][m_regdate] = ($m[$i][m_regdate] != "0000-00-00 00:00:00") ? substr($m[$i][m_regdate], 2, 8) : NULL;
				$m_list[$i][m_last_logindate] = ($m[$i][m_last_logindate] != "0000-00-00 00:00:00") ? substr($m[$i][m_last_logindate], 2, 8) : NULL;
				$m_list[$i][m_last_modifydate] = ($m[$i][m_last_modifydate] != "0000-00-00 00:00:00") ? substr($m[$i][m_last_modifydate], 2, 8) : NULL;

				#$m_list[$i][m_quota] = filesize_human($m[$i][m_quota]*1024, 0);
				// m_quota
				$mail_file_table = $G_SYS[PRE_FIX] . 'mail_file_' . $m[$i][d_no] . '_' . $m[$i][m_mail_file_group];
				$q_hint = ($G_SYS[DB] == 'oracle') ? "/*+ ORDERED index_asc (".$mail_file_table." MF_".$m[$i][d_no]."_".$m[$i][m_mail_file_group]."_MNO_MBID) */" : "";
				$sql = "SELECT ".$q_hint." SUM(mf_filesize) FROM " . $mail_file_table . " WHERE m_no='" . $m[$i][m_no] . "'";
				$_mf_filesize_sum = db_get_one($sql);
				$_m_quota_rate = @ceil($_mf_filesize_sum / 1024 / $m[$i][m_quota] * 100);
				$m_list[$i][m_quota] = "<div align=right style='font-family:Arial'>".filesize_human($_mf_filesize_sum, 1)." / <b>".filesize_human($m[$i][m_quota]*1024, 1).'</b>&nbsp;</div>';

				// [2025-11-17] 보이지 않는 그래프 영역의 최대 너비 100으로 제한하기 위해 추가
				$_m_quota_rate_width = $_m_quota_rate;
				if ($_m_quota_rate_width > 100) {
					$_m_quota_rate_width = 100;
				}

				// [2025-11-17] 용량이 100일 경우 그래프 표시 안되던 부분 수정
//				if ($_m_quota_rate < 100)
					$m_list[$i][m_quota] .= '
						<div class="progress" title="사용한 용량 : '.$_m_quota_rate .'%" style="height:5px">
							<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'.$_m_quota_rate .'" aria-valuemin="0" aria-valuemax="100" style="width: '. $_m_quota_rate_width .'%;">
								<span class="sr-only">사용한 용량 : '. $_m_quota_rate .'%</span>
							</div>
						</div>
					';

				// [2007-12-28] 대용량첨부, 웹하드
				$sql = "SELECT ms_bigfile FROM " . $TB['MEMBER_SIZE'] . " WHERE m_no='" . $m[$i][m_no] . "'";
				$_ms_bigfile_sum = db_get_one($sql);
				$_m_bigfile_quota_rate = @ceil($_ms_bigfile_sum / 1024 / $m[$i][m_bigfile_quota] * 100);
				$m_list[$i][m_bigfile_quota] = "<div align=right style='font-family:Arial'>".filesize_human($_ms_bigfile_sum, 1)." / <b>".filesize_human($m[$i][m_bigfile_quota]*1024, 1).'</b>&nbsp;</div>';

				// [2025-11-17] 보이지 않는 그래프 영역의 최대 너비 100으로 제한하기 위해 추가
				$_m_bigfile_quota_rate_width = $_m_bigfile_quota_rate;
				if ($_m_bigfile_quota_rate_width > 100) {
					$_m_bigfile_quota_rate_width = 100;
				}

				// [2025-11-17] 용량이 100일 경우 그래프 표시 안되던 부분 수정
//				if ($_m_bigfile_quota_rate < 100)
				$m_list[$i][m_bigfile_quota] .= '
					<div class="progress" title="사용한 용량 : '.$_m_bigfile_quota_rate .'%" style="height:5px">
						<div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="'.$_m_bigfile_quota_rate .'" aria-valuemin="0" aria-valuemax="100" style="width: '. $_m_bigfile_quota_rate_width .'%;">
							<span class="sr-only">사용한 용량 : '. $_m_bigfile_quota_rate .'%</span>
						</div>
					</div>
				';

				$sql = "SELECT ms_webhard FROM " . $TB['MEMBER_SIZE'] . " WHERE m_no='" . $m[$i][m_no] . "'";
				$_ms_webhard_sum = db_get_one($sql);
				$_m_webhard_quota_rate = @ceil($_ms_webhard_sum / 1024 / $m[$i][m_webhard_quota] * 100);
				$m_list[$i][m_webhard_quota] = "<div align=right style='font-family:Arial'>".filesize_human($_ms_webhard_sum, 1)." / <b>".filesize_human($m[$i][m_webhard_quota]*1024, 1).'</b>&nbsp;</div>';

				// [2025-11-17] 보이지 않는 그래프 영역의 최대 너비 100으로 제한하기 위해 추가
				$_m_webhard_quota_rate_width = $_m_webhard_quota_rate;
				if ($_m_webhard_quota_rate_width > 100) {
					$_m_webhard_quota_rate_width = 100;
				}

				// [2025-11-17] 용량이 100일 경우 그래프 표시 안되던 부분 수정
//				if ($_m_webhard_quota_rate < 100)
					$m_list[$i][m_webhard_quota] .= '
						<div class="progress" title="사용한 용량 : '.$_m_webhard_quota_rate .'%" style="height:5px">
							<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'.$_m_webhard_quota_rate .'" aria-valuemin="0" aria-valuemax="100" style="width: '. $_m_webhard_quota_rate_width .'%;">
								<span class="sr-only">사용한 용량 : '. $_m_webhard_quota_rate .'%</span>
							</div>
						</div>
					';
				if ($mbr_group)
				{
					$_as = array_search($m[$i][mg_no], $mbr_group['mg_no']);
					$m_list[$i][mg_no] = ($_as !== false) ? $mbr_group['mg_name'][$_as] : '';
				}	// if()

				if ($mbr_class)
				{
					$_as = array_search($m[$i][mc_no], $mbr_class['mc_no']);
					$m_list[$i][mc_no] = ($_as !== false) ? $mbr_class['mc_name'][$_as] : '';
				}	// if()

				if ($G_SYS['NM_ADMIN_MBR_EXCEL_DOWN'] && $_GET['excel_down'])
				{
					// TODO: 엑셀 내보내기 항목 정의
					$m_excel[$i] = array(
//						'd_no' => $m[$i][d_no],
						'd_name' => $m[$i][d_name],
//						'm_no' => $m[$i][m_no],
						'mg_name' => $m_list[$i][mg_no],
						'mc_name' => $m_list[$i][mc_no],
//						'm_id' => $m[$i][m_id],
						'm_email' => $m[$i][m_id].'@'.$m[$i][d_name],
						'm_name' => $m[$i][m_name],
						'm_level' => $G[LEVEL_NAME][$m[$i][m_level]] . "(" . $m[$i][m_level] . ")",

						'm_use' => $_mf_filesize_sum,
						'm_quota' => $m[$i][m_quota]*1024,

						'm_bigfile_use' => $_ms_bigfile_sum,
						'm_bigfile_quota' => $m[$i][m_bigfile_quota]*1024,

						'm_webhard_use' => $_ms_webhard_sum,
						'm_webhard_quota' => $m[$i][m_webhard_quota]*1024,

						// 등록일자
						'm_regdate' => $m[$i][m_regdate],

						// 웹메일 로그인
						'm_last_logindate' => $m[$i][m_last_logindate],

						// 비밀번호 마지막 변경일
						'm_last_pwdchgdate' => $m[$i][m_last_pwdchgdate],
					);
				}
			}	// for()
		}	// if()

	$s_query = $q;


// view
	$v_rowCount = number_format($rowCount);
	$v_s_query = trim(htmlspecialchars_fix($s_query));
	$v_s_kind1 = select_list_value($s_kind1, array_values($CFG[SEARCH_FIELD]), array_keys($CFG[SEARCH_FIELD]), NULL, 0, 1);
	$v_s_kind2 = select_list_value($s_kind2, array_values($CFG[SEARCH_FIELD]), array_keys($CFG[SEARCH_FIELD]), NULL, 0, 1);
	$v_s_kind3 = select_list_value($s_kind3, array_values($CFG[SEARCH_FIELD]), array_keys($CFG[SEARCH_FIELD]), NULL, 0, 1);
	$v_s_kind4 = select_list_value($s_kind4, array_values($CFG[SEARCH2_FIELD]), array_keys($CFG[SEARCH2_FIELD]), NULL, 0, 1);
	$v_s_word1 = input_value($s_word1,1);
	$v_s_word2 = input_value($s_word2,1);
	$v_s_word3 = input_value($s_word3,1);
	$v_s_word4_1 = input_value($s_word4_1,1);
	$v_s_word4_2 = input_value($s_word4_2,1);
	$v_s_and_or1 = select_list_value($s_and_or1, $G[AND_OR], $G[AND_OR], NULL, 0, 1);
	$v_s_and_or2 = select_list_value($s_and_or2, $G[AND_OR], $G[AND_OR], NULL, 0, 1);
	$v_s_and_or3 = select_list_value($s_and_or3, $G[AND_OR], $G[AND_OR], NULL, 0, 1);

	$v_q_transfer = input_value($q_transfer,1);

	$set_m_quota = ($dm['d_quota_mbr_default']/1024);

	if (!$mode_sadmin)
	{
		$vd = array();
		$q_hint = ($G_SYS[DB] == 'oracle') ? "/*+ ORDERED index_asc (".$TB['MEMBER']." M_M_QUOTA) */" : "";
		$sql = "SELECT ".$q_hint." COUNT(m_id) m_cnt, SUM(m_quota) m_quota_sum, SUM(m_bigfile_quota) m_bigfile_quota_sum, SUM(m_webhard_quota) m_webhard_quota_sum FROM " . $TB['MEMBER'] . " WHERE d_no='" . $dm['d_no'] . "' AND m_level !='".$G[LEVEL][wait]."' AND m_usertype IS NULL";
		$mbrg = db_get_row($sql);
		$vd['m_quota_sum_rate'] = ceil($mbrg['m_quota_sum'] / $dm['d_quota'] * 100);
		$vd['m_cnt_rate'] = ceil($mbrg['m_cnt'] / $dm['d_quota_mbr_count'] * 100);
		$vd['d_quota'] = filesize_human($dm['d_quota']*1024);
		$vd['m_quota_sum'] = filesize_human($mbrg['m_quota_sum']*1024);
		$vd['d_quota_mbr_count'] = number_format($dm['d_quota_mbr_count']);
		$vd['m_cnt'] = number_format($mbrg['m_cnt']);

		// [2007-12-28] 대용량첨부, 웹하드
		$vd['d_bigfile_quota_sum'] = filesize_human($mbrg['m_bigfile_quota_sum']*1024, 2);
		$vd['d_bigfile_quota_sum_rate'] = @ceil($mbrg['m_bigfile_quota_sum'] / $dm['d_bigfile_quota'] * 100);
		$vd['d_bigfile_quota'] = filesize_human($dm['d_bigfile_quota']*1024, 2);

		// [2008-02-20] 공용웹하드 용량 합산
		require_once('include/webhard_lib.php');
		$mbrg['m_webhard_quota_sum'] += get_ws_quota_sum($dm['d_no']);

		$vd['d_webhard_quota_sum'] = filesize_human($mbrg['m_webhard_quota_sum']*1024, 2);
		$vd['d_webhard_quota_sum_rate'] = @ceil($mbrg['m_webhard_quota_sum'] / $dm['d_webhard_quota'] * 100);
		$vd['d_webhard_quota'] = filesize_human($dm['d_webhard_quota']*1024, 2);

	}	// if()

	$page_view = disPgCount($whlPgCount, $reqPage, $strTrans, 3, 1);

// [2006-02-24] 부가기능
	// [2007-03-08] 서버관리자가 도메인관리에서 'SMTP/POP3'을 차단해둔 경우 '회원관리'에서도 '허용'이 안되도록 제한.
	if ($AUTH['auth_m_level'] < $G['LEVEL']['serveradmin'])
	{
		if ($G['DINFO']['d_svc_smtp'] == 'N')
		{
			unset($G_SYS['MBR_ADMIN_CMD']['SMTP_SET']);
			unset($G_SYS['MBR_ADMIN_CMD']['SMTP_UNSET']);
		}	// if()
		if ($G['DINFO']['d_svc_pop3'] == 'N')
		{
			unset($G_SYS['MBR_ADMIN_CMD']['POP3_SET']);
			unset($G_SYS['MBR_ADMIN_CMD']['POP3_UNSET']);
		}	// if()
	}	// if()

	if ($G['DINFO']['d_svc_2fa'] !== 'Y') {
		unset(
			$G_SYS['MBR_ADMIN_CMD']['2FA_REQUIRED_SET'],
			$G_SYS['MBR_ADMIN_CMD']['2FA_REQUIRED_UNSET'],
			$G_SYS['MBR_ADMIN_CMD']['2FA_SET'],
			$G_SYS['MBR_ADMIN_CMD']['2FA_UNSET']
		);
	}

// [2023-06-21] 회원 엑셀 내보내기
	if ($G_SYS['NM_ADMIN_MBR_EXCEL_DOWN'])
	{
		$G_SYS['MBR_ADMIN_CMD']['_4'] = '';
		$G_SYS['MBR_ADMIN_CMD']['MBR_EXCEL_DOWN'] = '- 회원 엑셀 내보내기';

		// export
		if ($_GET['excel_down'])
		{
			function csv_data_replace($str)
			{
				// htmlspecialchars_fix 로 변경된 문자열 되돌리기
				$trans = array("&quot;" => "\"", "&#039;" => "＇", "&lt;"=>"<", "&gt;"=>">");
				$str = strtr($str, $trans);
				return str_replace('"', '""', $str);
			}	// function()
			$crlf = "\r\n";
			$data = '';

			// 헤더
			if (count($m_excel) > 0)
			{
				foreach ($m_excel[0] as $key => $val)
				{
					$data .= '"' . csv_data_replace($key) . '",';
				}    // foreach()
				$data .= $crlf;
			}

			for ($i=0; $i<$m_list_cnt; $i++)
			{
				foreach ($m_excel[$i] as $key=>$val)
				{
					$data .= '"'.csv_data_replace($m_excel[$i][$key]).'",';
				}	// foreach()
				$data .= $crlf;
			}	// for()

			// UTF-8
			if (strtoupper($G_SYS[CHARSET]) == 'UTF-8')
				$data = iconv_fix('UTF-8', $data, 'CP949');

			require_once('include/file.php');
			file_down_headeronly($data, 'NmailMember_'.date('Ymd_His').'.csv');
			exit;
		}	// if()
	}

// [2025-07-07] 편지쓰기
	if ($_POST['cmd']) {
		if (!$_POST['chk_m_no'])
			msg('올바른 URL로 접근하여 주십시오');

		// 회원 주소 가져오기
		$q = "SELECT m.m_id, d.d_name, m.m_name
				FROM " . $TB['MEMBER'] . " m,
				" . $TB['DOMAIN'] . " d
			  WHERE m.d_no=d.d_no
			    AND m.m_no IN " . set_array2comma(" (", ") ", $_POST['chk_m_no']) . "
			    AND m.m_is_use='Y' 
			    AND d.d_is_use='Y'";

		$rows = db_get_rows($q);

		$address = null;
		for ($i=0; $i<sizeof($rows); $i++) {
			$address .= '"' . $rows[$i]['m_name'] . '" <' . $rows[$i]['m_id'] . '@' . $rows[$i]['d_name'] .'>, ';
		}

		movepage("mail_write.php?mf_to=" . urlencode($address));
	}

	$select_cmd = select_list_value('', array_values($G_SYS['MBR_ADMIN_CMD']), array_keys($G_SYS['MBR_ADMIN_CMD']), lang_conv('부가 기능').' ▼', 0, 1);

// skin view
	nskinset('sadmin', 'admin_mbr_list.html');
	include($NSKIN['view_layout']);


require_once('include/global_end.php');
?>