Strafi
Erfahrenes Mitglied
Hier mal den ganzen code
PHP:
error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set('max_execution_time', 30000);
header('Content-Type: text/html; charset=utf-8');
ignore_user_abort(true);
$buffer = 4092;
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$filexml='Webshopbase.xml';
if (file_exists($filexml)) {
$xml = simplexml_load_file($filexml);
}
if(!isset($_GET['reload']) && !isset($_GET['anzahlzeilen'])) {
$anzahlZeilen = count($xml);
$size = $buffer;
$csv = '"id","code","modono","brnno","moddeno","branddeno","itemgroupdeno","itemgroup","percentvat"'."\n";
$i = 0;
if($anzahlZeilen > $size) {
$bool = true;
}
} else {
$anzahlZeilen = $_GET['anzahlzeilen'];
$size = $buffer + $_GET['reload'];
$csv = "";
$i = $size - $buffer;
if($size >= $anzahlZeilen) {
$size = $size - $anzahlZeilen;
$size = $i + $size;
$bool = false;
} else {
$bool = true;
}
}
for ($i=0;$i < $size;$i++) {
$csv .= $i.",".
$xml->Model[$i]->Code.",".
$xml->Model[$i]->Modno.",".
$xml->Model[$i]->Brnno.",".
$xml->Model[$i]->Moddeno.",".
$xml->Model[$i]->Branddeno.",".
$xml->Model[$i]->Itemgroupdeno.",".
$xml->Model[$i]->Itemgroup.",".
$xml->Model[$i]->Percentvat."\n";
}
if(!isset($_GET['file'])) {
$filename = "export_".date("Y-m-d-His",time());
} else {
$filename = $_GET['file'];
}
$fh = fopen($path.$filename.".csv","a");
fwrite($fh,utf8_decode( $csv ) );
fclose($fh);
//$goto = "http://".$host."".$uri."/convert_group.php?reload=".$size."&anzahlzeilen=".$anzahlZeilen."&file=".$filename;
$goto = "convert_group.php?reload=".$size."&anzahlzeilen=".$anzahlZeilen."&file=".$filename;
if($bool) {
header("Location: ".$goto);
//exit();
} else {
echo "Script fertig! File: ".$filename;
}