Location: PHPKode > scripts > Opening hours > opening-hours/scripte/donnerstag/zeitdo.php
<?php
session_start();
$dir = "../donnerstag"; // type between quotes folder name where are stored your txt files

$chosen = @$_POST['select'];
$chosenfile = $dir . "/" . $chosen;


// open chosen file
if($chosen != "" && $_POST['findfile'] == "GO") {
   $file = file_get_contents($chosenfile);
   list($name, $rest) = explode(".", $chosen);
   $name = str_replace("_", " ", $name);
// change cols and rows below if you want bigger or smaller textbox
   $form = "<h2>$name</h2><textarea name=\"mytext\" cols=\"100\" rows=\"5\">" . $file . "</textarea><input type=\"hidden\" name=\"hidden\" value=\"$chosenfile\" /><br /><input type=\"submit\" name=\"change\" value=\"Change\" />&nbsp;&nbsp;&nbsp;<input type=\"submit\" name=\"cancel\" value=\"Cancel\" />";
   $_POST['findfile']= "";



// change chosen file
} elseif($_POST['hidden'] != "" && $_POST['change'] == "Change"){
$newtext = $_POST['mytext'];
$chosenfile = $_POST['hidden'];
$newdata = fopen($chosenfile, "wb");
   fwrite($newdata, $newtext);
   fclose($newdata);   
   $_POST['change'] = "";
   $form = $_SESSION['change_txt_form'];

// first time opened php read directory with txt files
} else {
    $openDir  = opendir($dir);
    while (false !== ($fileNames = readdir($openDir))) {
   if($fileNames == "." || $fileNames == ".." || is_dir("$dir/$fileNames")) {
                continue;
           } else {
              list($mainName, $rest) = explode(".", $fileNames);   
             if($rest != txt) {
                 continue;
             } else {
                 $mainName = str_replace("_", " ", $mainName);
                 $txtfiles = @$txtfiles . "<option value=$fileNames >$mainName</option>";
             }            
           }
    }
$form = "<select name=\"select\">" . $txtfiles . "&nbsp;&nbsp;</select><input type=\"submit\" name=\"findfile\" value=\"GO\" />";
$_SESSION['change_txt_form'] = $form;
}





?>
<html>
<head>
<title>Praxisampelsteuerung</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">

  

Donnerstag: <br>
<form name="txtfiles" method="post" action="">
  <?php echo $form; ?>
</form>






</body>
</html>
Return current item: Opening hours