php8.0 버전 호환 코드 적용 및 PHP 끝 태그 삭제 일괄적용
This commit is contained in:
@ -2,7 +2,10 @@
|
||||
$sub_menu = "900900";
|
||||
include_once("./_common.php");
|
||||
|
||||
auth_check($auth[$sub_menu], "r");
|
||||
$bg_no = isset($_REQUEST['bg_no']) ? clean_xss_tags($_REQUEST['bg_no'], 1, 1) : '';
|
||||
$no_hp = isset($_REQUEST['no_hp']) ? clean_xss_tags($_REQUEST['no_hp'], 1, 1) : '';
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
if ($bg_no != 'all' && $bg_no < 1)
|
||||
alert_just('다운로드 할 휴대폰번호 그룹을 선택해주세요.');
|
||||
@ -18,50 +21,49 @@ if (!$total['cnt']) alert_just('데이터가 없습니다.');
|
||||
|
||||
$qry = sql_query("select * from {$g5['sms5_book_table']} where 1 $sql_bg $sql_hp order by bk_name");
|
||||
|
||||
/*================================================================================
|
||||
php_writeexcel http://www.bettina-attack.de/jonny/view.php/projects/php_writeexcel/
|
||||
=================================================================================*/
|
||||
if(! function_exists('column_char')) {
|
||||
function column_char($i) {
|
||||
return chr( 65 + $i );
|
||||
}
|
||||
}
|
||||
|
||||
include_once(G5_LIB_PATH.'/Excel/php_writeexcel/class.writeexcel_workbook.inc.php');
|
||||
include_once(G5_LIB_PATH.'/Excel/php_writeexcel/class.writeexcel_worksheet.inc.php');
|
||||
include_once(G5_LIB_PATH.'/PHPExcel.php');
|
||||
$excel = new PHPExcel();
|
||||
|
||||
$fname = tempnam(G5_DATA_PATH, "tmp.xls");
|
||||
$workbook = new writeexcel_workbook($fname);
|
||||
$worksheet = $workbook->addworksheet();
|
||||
|
||||
$num2_format =& $workbook->addformat(array(num_format => '\0#'));
|
||||
|
||||
// Put Excel data
|
||||
$data = array('이름', '전화번호');
|
||||
$data = array_map('iconv_euckr', $data);
|
||||
$headers = array('이름', '전화번호');
|
||||
$widths = array(18, 25);
|
||||
$header_bgcolor = 'FFABCDEF';
|
||||
$last_char = column_char(count($headers) - 1);
|
||||
$rows = array();
|
||||
|
||||
$col = 0;
|
||||
foreach($data as $cell) {
|
||||
$worksheet->write(0, $col++, $cell);
|
||||
}
|
||||
|
||||
for($i=1; $res=sql_fetch_array($qry); $i++)
|
||||
{
|
||||
$res = array_map('iconv_euckr', $res);
|
||||
//$res = array_map('iconv_euckr', $res);
|
||||
|
||||
$hp = get_hp($res['bk_hp'], $hyphen);
|
||||
|
||||
if ($no_hp && $res['bk_hp'] != '' && !$hp) continue;
|
||||
|
||||
$worksheet->write($i, 0, $res['bk_name']);
|
||||
$worksheet->write($i, 1, $hp, $num2_format);
|
||||
$rows[] = array($res['bk_name'], ' '.$hp);
|
||||
}
|
||||
|
||||
$workbook->close();
|
||||
$data = array_merge(array($headers), $rows);
|
||||
|
||||
$excel->setActiveSheetIndex(0)->getStyle( "A1:${last_char}1" )->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB($header_bgcolor);
|
||||
$excel->setActiveSheetIndex(0)->getStyle( "A:$last_char" )->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER)->setWrapText(true);
|
||||
foreach($widths as $i => $w) $excel->setActiveSheetIndex(0)->getColumnDimension( column_char($i) )->setWidth($w);
|
||||
$excel->getActiveSheet()->fromArray($data,NULL,'A1');
|
||||
|
||||
$filename = "휴대폰번호목록-".date("ymd", time()).".xls";
|
||||
if( is_ie() ) $filename = utf2euc($filename);
|
||||
|
||||
header("Content-Type: application/x-msexcel; name=".$filename);
|
||||
header("Content-Disposition: inline; filename=".$filename);
|
||||
$fh=fopen($fname, "rb");
|
||||
fpassthru($fh);
|
||||
unlink($fname);
|
||||
header("Content-Type: application/octet-stream");
|
||||
header("Content-Disposition: attachment; filename=".$filename);
|
||||
header("Cache-Control: max-age=0");
|
||||
|
||||
exit;
|
||||
?>
|
||||
$writer = PHPExcel_IOFactory::createWriter($excel, 'Excel5');
|
||||
$writer->save('php://output');
|
||||
|
||||
exit;
|
||||
Reference in New Issue
Block a user