403Webshell
Server IP : 104.21.80.248  /  Your IP : 172.71.28.155
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/elearning/admin/Import_Excel2007/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /Inetpub/www/news/elearning/admin/Import_Excel2007//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);
error_reporting(E_ALL ^ E_DEPRECATED);

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 '../../configs/host.php';

$i = 0;
foreach ($namedDataArray as $result) {
		$i++;
		$strSQL = "";
		$strSQL .= "INSERT INTO exp_users ";
		$strSQL .= "(user_fullname,user_email,user_class,user_pass,number_no) ";
		$strSQL .= "VALUES ";
		$strSQL .= "('".$result["user_fullname"]."','".$result["user_email"]."' ";
		$strSQL .= ",'".$result["user_class"]."','".md5($result["user_pass"])."','".$result["number_no"]."') ";
		mysql_query($strSQL) or die(mysql_error());
		echo "Row $i '".$result["user_fullname"]."'...<br>";
}
mysql_close($cn);

} else {

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

Youez - 2016 - github.com/yon3zu
LinuXploit