PATH:
home
/
centosnipponia
/
public_html
/
wh
/
sales_rd
<?php require __DIR__ . '/functions_csv_handle.php'; $folder_path='/home/centosnipponia/public_html/wh/eurostock/'; check_for_updates($folder_path); function create_insert_db($filepath) { //echo $filepath; $sql_delivery = "DROP TABLE IF EXISTS `europe_warehouse`; CREATE TABLE IF NOT EXISTS `europe_warehouse` ( `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, `ItemCode` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `ItemDescription` text COLLATE utf8mb4_unicode_ci, `Warehouse` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `VIN` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `Colour` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `Speed` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `Balance` int(11) DEFAULT NULL, `Sales` int(11) DEFAULT NULL, `Purchases` int(11) DEFAULT NULL, `Imports` int(11) DEFAULT NULL, `Exports` int(11) DEFAULT NULL, `OtherImports` int(11) DEFAULT NULL, `OtherExports` int(11) DEFAULT NULL, `Document` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `Order` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; INSERT INTO `europe_warehouse` (`ItemCode`, `ItemDescription`, `Warehouse`, `VIN`, `Colour`, `Speed`, `Balance`, `Sales`, `Purchases`, `Imports`, `Exports`, `OtherImports`, `OtherExports`, `Document`, `Order`) VALUES "; $max_rows=count_csv_rows($filepath); if($max_rows>0){ $row_current_nbr=2; $lines=""; $row_comma_separated=""; $first_row=false;//den exei epikefalides fix_file($filepath); $file = fopen($filepath,"r"); while($row_current_nbr<$max_rows-1) { $row_current_nbr=$row_current_nbr+1; if($first_row) { $first_row=false; fgetcsv($file); } else { //echo fgetcsv($file)[0]; //$cleaned_row=str_replace(",","",); $cleaned_row=str_replace("'","\'",fgetcsv($file)[0]); //$cleaned_row=str_replace(",",";", $cleaned_row); $row_array =explode(";",$cleaned_row); // print_r($row_array); $row_comma_separated="('".implode("','", $row_array)."'),"; //print_r($row_comma_separated); //echo ($row_comma_separated); } $lines.= $row_comma_separated; } fclose($file); $sql_delivery.=$lines; $sql_delivery=substr_replace($sql_delivery,";",-1); } else { $sql_delivery ="SELECT 1"; } //echo $sql_delivery; return $sql_delivery; } ?>
[+]
..
[-] functions_csv_handle.php
[edit]
[-] sql_command_import_eurostock.php
[edit]
[+]
imported
[-] .htaccess.disabled
[edit]