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


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

// data
    // [2020-11] SQL Injection 개선
    $_POST['m_cfg_from_name'] = del_injection_str($_POST['m_cfg_from_name'], $AUTH['auth_m_name']);
    $_POST['m_cfg_from_name'] = to_db_str($_POST['m_cfg_from_name'], 255);

	// 갱신
	$sql = "
		UPDATE
			" .	$TB['MEMBER']	. "
		SET
			m_cfg_from_name = '" . $_POST['m_cfg_from_name'] . "',
			m_send_preview = '" . $_POST['m_send_preview'] . "'
		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);

?>
	<script language="JavaScript">
        <!--
        window.close();
        //-->
	</script>
<?

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