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

set_time_limit(1200);


// check


// select
	$DEBUG['db_select']['start'] = getmicrotime();
	$sql = "
		SELECT
			ssw_word, ssw_memo, ssw_regdate
		FROM
			" . $TB['SADMIN_SPAM_WORD'] . "
		ORDER BY
			ssw_word
		";
	$rows = db_get_rows($sql, true);
	$rows_cnt = getarraycount($rows['ssw_word']);
	$DEBUG['db_select']['exec'] += getmicrotime() - $DEBUG['db_select']['start'];
	if (!$rows)
		msg('스팸단어 데이타가 없습니다.');

// proc
	if ($_GET['excel_down'])
	{
		$excel_down_name = 'NmailSAdminSpamWord_' . date('Ymd_His') . '.xls';
		header("Content-type: application/vnd.ms-excel; charset=utf-8");
		header("Content-Disposition: attachment; filename=$excel_down_name");
		header("Expires: 0");
		header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
		header("Pragma: public");

		include('sadmin/sadmin_spam_word_excel.html');

		exit;
	}

	$crlf = "\r\n";
	$data = implode($crlf, $rows['ssw_word']).$crlf;

	file_down_headeronly($data, 'NmailSAdminSpamWord_'.date('Ymd_His').'.txt');

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