file_get_contents
1#@!#!123s
D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
u247928417
/
domains
/
riddi.in
/
public_html
/
admin
/
Filename :
brand-upload.php
back
Copy
<?php include("config/config.php"); include("Excel/reader.php"); include("Excel/function.php"); error_reporting(0); if (isset($_REQUEST['uploadfile'])) { $data = new Spreadsheet_Excel_Reader(); $file = $_FILES['file_excel']['name']; move_uploaded_file($_FILES['file_excel']['tmp_name'], "upload/" . $_FILES['file_excel']['name']); $data->read('upload/' . $_FILES['file_excel']['name']); $mxRows = $data->sheets[0]['numRows']; $mxCols = $data->sheets[0]['numCols']; /********************************************READ XLS DATA START HERE************************************************* */ for ($i = 2; $i <= $mxRows; $i++) { // $SERIAL = $data->sheets[0]['cells'][$i][1]; /* --- PRODUCT INFOMATION */ $brand_name = $data->sheets[0]['cells'][$i][2]; $sel="select * from interface_manufactured where brand_name like '%".$brand_name."'"; $num=mysqli_num_rows($sel); if($num>0){ echo ''; }else{ $insertProduct = "INSERT INTO `interface_manufactured`(`brand_name`) VALUES ('".$brand_name."')"; $resultProduct =mysqli_query($conn,$insertProduct)or die(mysqli_error($conn)); } } if ($resultProduct) { $message = 'Data is uploaded successfully.'; } else { $error_msg = 'Unable to upload data, Server issue.'; } unlink('upload/' . $_FILES['file_excel']['name']); echo "<meta http-equiv='refresh' content='0; url=view-brands-list'/>"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <script> function checkfile() { var file = document.getElementById("file_excel").value; if (file == '' && file == null) { alert('Please upload xls file format only'); document.getElementById("file_excel").focus(); return false; } if (file != '') { var valid_extensions = /(.xls)$/i; if (!valid_extensions.test(file)) /*{ alert('OK'); } else*/ { alert('Please upload xls file format only'); document.getElementById("file_excel").value = ''; document.getElementById("file_excel").focus(); return false; } } } </script> <body> <table> <form method="post" action="" enctype="multipart/form-data" onsubmit="return checkfile();"> <tr> <td align="center"> <input type="file" required name="file_excel" id="file_excel" value="" style="width:165px;" /> <input type="submit" name="uploadfile" value="OK" style="width: 46px;margin-top:-64px;margin-left: 221px;"/> <span><b><a href="">Download XLS format For Brand Upload</a></b></span> </td> </tr> </form> </table> </body> </html>