<?php

session_start();
$_SESSION['ansicht']="OffenePosten";

$hb = $_SESSION['hb'];
$hp = $_SESSION['hp'];
$filenamehtm = dirname($_SERVER["PATH_TRANSLATED"]) . "/warenkorb.htm";

if (!$filehtm = fopen($filenamehtm, "r+")) {
print "Kann im Moment die Kunden-HTM nicht öffnen";
exit;
}

$contenttxt="";
$dir=opendir('../php/texte'); 
while ($file = readdir ($dir)) { 
    if ($file != "." && $file != "..") {
	   $pos = strpos ($file, $hp);
	   if ($pos != 0) {
         $zeilennummer=$zeilennummer+1;
         $filename = "../php/texte/".$file;
         $filetxt = fopen($filename, "r");
         $contenttxt= $contenttxt.fread($filetxt,filesize($filename));
//         $contenttxt= $contenttxt . " " . date("F d Y H:i:s.", filemtime($filename));
         $contenttxt= $contenttxt . " " . date("d F Y", filemtime($filename));
         $contenttxt=str_replace("checkboxname","checkbox".$zeilennummer,$contenttxt);
         $contenttxt=str_replace("checkboxwert","../php/texte/".$file,$contenttxt);
         fclose($filetxt); 
	   } 
    }          
}
closedir($dir);

//$contenttxt=fread($filetxt,filesize($filenametxt));
$contenthtm=fread($filehtm,filesize($filenamehtm));

$content=str_replace("startstop",$contenttxt,$contenthtm);
print $content;
//fclose($filetxt);
fclose($filehtm);


?>