| Server IP : 172.67.187.206 / 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/myschool/triamudom/check/webadmin/ |
Upload File : |
<?php
session_start();
$path = "../";
include ($path.'include/config_db.php');
include ($path.'include/class_db.php');
include ($path.'include/class_display.php');
include ($path.'include/function.php');
include ($path.'include/permission_denied.php');
$CLASS['db'] = new db();
$CLASS['db']->connect();
$CLASS['disp'] = new display();
$db = $CLASS['db'];
$disp = $CLASS['disp'];
$date_day = date("Y-m-d").' '.date("H:i:s");
//======Get data from Excel======================//
$dom = DOMDocument::load( $_FILES['file']['tmp_name'] );
$rows = $dom->getElementsByTagName( 'Row' );
$row = 0;
foreach ($rows as $temp) {
$col = 0;
if($row==0) {
$row++; continue;
}
$cells = $temp->getElementsByTagName('Cell');
foreach( $cells as $cell ) {
if($col==0) $data1 = $cell->nodeValue;
if($col==1) $data2 = $cell->nodeValue;
if($col==2) $data3 = $cell->nodeValue;
if($col==3) $data4 = $cell->nodeValue;
if($col==4) $data5 = $cell->nodeValue;
if($col==5) $data6 = $cell->nodeValue;
if($col==6) $data7 = $cell->nodeValue;
if($col==7) $data8 = $cell->nodeValue;
if($col==8) $data9 = $cell->nodeValue;
if($col==9) $data10 = $cell->nodeValue;
if($col==10) $data11 = $cell->nodeValue;
if($col==11) $data12 = $cell->nodeValue;
if($col==12) $data13 = $cell->nodeValue;
if($col==13) $data14 = $cell->nodeValue;
$col++;
}
//======End Get data from Excel======================//
//==================Insert To DB ====================================//
$sql_del = $db->query("delete from tb_students where tb_student_code='".$data2."' ");
$sql = "INSERT INTO tb_students
(tb_student_id,
tb_student_code,
tb_student_tname,
tb_student_name,
tb_student_sname,
tb_student_degree,
tb_student_address,
tb_student_phone,
tb_student_date,
tb_student_status,
tb_student_picture,
tb_student_birthday,
tb_student_idcard)
VALUES (NULL,
'".$data2."',
'".$data3."',
'".$data4."',
'".$data5."',
'".$data6."',
'".$data7."',
'".$data8."',
'".$data9."',
'".$data10."',
'".$data11."',
'".$data12."',
'".$data13."')";
$db->query($sql) or die(mysql_error());
//==================End Insert To DB ====================================//
$row++;
}
print "
<script language='javascript'>
alert('Import Success !!');
window.location.href='display_student_import.php';
</script>
";
?>