<?
require_once('include/global.php');
#require_once('sadmin_conf.inc.php');


// check
	if (!$_GET['m_no'])
		msg('올바른 URL로 접근하여 주십시오');

	$q_where = " AND m_usertype='M' ";
	if ($_GET['isadmin'])
	{
		auth_limit('admin');
		$_GET['d_no'] = $G['DINFO']['d_no'];
		$q_where .= " AND d_no='" . $_GET['d_no'] . "'";
	} else 
	{
		auth_limit('serveradmin');
	}	// if()


// get
	$q = "SELECT m_id, d_no FROM " . $TB['MEMBER'] . " WHERE m_no='" . $_GET['m_no'] . "'".$q_where;
	$mbr = db_get_row($q);
	if (!$mbr)
		msg("존재하지 않는 메일링 주소입니다.");

// data
	to_db_str(&$_POST['m_name'], 255);
	to_db_str(&$_POST['m_email'], 255);
	to_db_str(&$_POST['m_memo'], $G_SYS['DB_TEXT']);

	$sql = "
		UPDATE
			" . $TB['MEMBER'] . "
		SET
			m_name='" . $_POST['m_name'] . "',
			m_email='" . $_POST['m_email'] . "',
			m_etc1='" . $_POST['m_etc1'] . "',
			m_etc2='" . $_POST['m_etc2'] . "',
			m_memo='" . $_POST['m_memo'] . "'
		WHERE
			m_no='" . $_GET['m_no'] . "'
			$q_where
		";
	db_query($sql);

	// 메일엔진 - 메일링 리스트 세부설정
		if (!$_GET['isadmin'])
		{
			$sql = "SELECT d_name FROM ".$TB['DOMAIN']." WHERE d_no='". $mbr['d_no'] . "' AND d_is_use='Y' ";
			$G_SYS['MAIL_DOMAIN'] = db_get_one($sql);
		}	// if()

		require_once('include/admin_lib.php');
		mbr_var_mod_mailing($mbr['m_id'], $_POST['m_etc1'], $_POST['m_email'], $_POST['m_etc2']);


// end
	#msg("수정되었습니다.", 0);
	movepage('admin_mailing_list.php?' . get_qs('m_no'));


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