Tryag File Manager
Home
||
Turbo Force
||
B-F Config_Cpanel
Current Path :
/
home
/
nonga.eemo.co.kr
/
public_html
/
www
/
Or
Select Your Path :
Upload File :
New :
File
Dir
/home/nonga.eemo.co.kr/public_html/www/test_exel_input_weather.php
<? session_cache_limiter('no-cache, must-revalidate'); session_start(); header("Pragma: no-cache"); header("Cache-Control: no-cache,must-revalidate"); header("Content-Type: text/html; charset=UTF-8"); foreach($_POST as $key => $value) { ${$key}=trim($value); } include_once("dbconn.php"); include_once("lib.php"); require('XLSXReader.php'); ini_set('max_execution_time',86400); ini_set('ft_min_word_len',2); $uploadFolder="upload"; $xlsx = new XLSXReader("/home/nonga.eemo.co.kr/public_html/www/weather_code.xlsx"); $sheetNames = $xlsx->getSheetNames(); $ss=1; foreach($sheetNames as $sheetName) { $sheet = $xlsx->getSheet($sheetName); $vv=$sheet->getData(); $nn=1; foreach($vv as $row) { $sido=""; $sigungu=""; $code_number=""; if($nn==1) {} else { $col=1; foreach($row as $cell) { if($col==1) {$code=escape($cell);} else if($col==2) {$sido=escape($cell);} else if($col==3) {$sigungu=escape($cell);} else if($col==4) {$dong=escape($cell);} //echo "" . escape($cell) . " /"; $col++; } //echo '<hr></hr>'; if($code_number) { $is_rs=RS("select * from weather_zone_code where code='$code' "); if($is_rs[no]) { } else { $query="insert into weather_zone_code set code='$code', sido='$sido', sigungu='$sigungu', dong='$dong' "; echo $query."<br>"; mysql_query($query) or die(mysql_error()); } } } $nn++; } $ss++; } function array2Table($data) { echo '<table>'; foreach($data as $row) { echo "<tr>"; foreach($row as $cell) { echo "<td>" . escape($cell) . "</td>"; } echo "</tr>"; } echo '</table>'; } function debug($data) { echo '<pre>'; print_r($data); echo '</pre>'; } function escape($string) { return htmlspecialchars($string, ENT_QUOTES); } ?>