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


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

// data
	$_POST['m_cfg_new_mail_box_db'] = is_array($_POST['m_cfg_new_mail_box'])
		? implode('|', $_POST['m_cfg_new_mail_box'])
		: null;
    // [2020-11] SQL Injection 개선
    $_POST['m_cfg_new_mail_box_db'] = del_injection_str($_POST['m_cfg_new_mail_box_db'], 'inbox');
    $_POST['m_cfg_from_name'] = del_injection_str($_POST['m_cfg_from_name'], $AUTH['auth_m_name']);
    $_POST['m_cfg_new_mail_box_db'] = to_db_str($_POST['m_cfg_new_mail_box_db'], 255);
    $_POST['m_cfg_from_name'] = to_db_str($_POST['m_cfg_from_name'], 255);
    $_POST['m_mail_box_backup_type'] = to_db_str($_POST['m_mail_box_backup_type'], 255);

	// 갱신
	$sql = "
		UPDATE
			" .	$TB['MEMBER']	. "
		SET
			m_cfg_new_mail_box = '" . $_POST['m_cfg_new_mail_box_db'] . "',
			m_cfg_new_cnt = '" . $_POST['m_cfg_new_cnt'] . "',
			m_cfg_week_diray_cnt = '" . $_POST['m_cfg_week_diray_cnt'] . "',
			m_cfg_from_name = '" . $_POST['m_cfg_from_name'] . "',
			m_cfg_mail_list_cnt = '" . $_POST['m_cfg_mail_list_cnt'] . "',
			m_send_preview = '" . $_POST['m_send_preview'] . "',
			m_mail_box_backup_type = '" . $_POST['m_mail_box_backup_type'] . "'
		WHERE
			m_no = '" . $AUTH['auth_m_no'] . "'
		";
	db_query($sql);

	// [2013-01-28] 보낸사람 선택기능 (앨리어스 도메인/주소 연동)
	if (is_array($_POST['alias_name']) && sizeof($_POST['alias_name']) > 0)
	{
		foreach ($_POST['alias_name'] as $key=>$val)
		{
            // [2020-11] SQL Injection 개선
            $val = del_injection_str($val, $AUTH['auth_m_name']);
			$q = "UPDATE " . $TB['MEMBER'] . " SET m_cfg_from_name = '" . $val . "', m_cfg_from_addr = '" . $_POST['alias_isuse'][$key] ."' WHERE d_no='" . $G['DINFO']['d_no'] . "' AND m_usertype='A' AND m_name='" . $AUTH['auth_m_id'] . "' AND m_id='" . addslashes($key) . "'";
			db_query($q);
		}	// foreach()
	}	// if()

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

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