function edit_php() { //change_csvdataset($iD); $allowedImgs = array('image/gif', 'image/jpg', 'image/jpeg', 'image/pjpeg'); if (isset($_GET['iD'])) $iD = $_GET['iD']; else $iD = $_POST['iD']; $leereFelder = 0; $insert = array("vorname", "nachname", "titel", "iSBN", "kategorie", "preis"); if (isset($_FILES['bildatei']) && $_POST['uploadOK']) { $ret = ''; preg_match('/\.(.+)$/', $_FILES['bildatei']['name'], $ret); $extension = trim($ret[1]); $newFilepath = '../images/'.$iD.'.'.$extension; copy($_FILES['bildatei']['tmp_name'], $newFilepath); $_POST['newFilepath'] = $newFilepath; } if (isset($_POST['submit']) && ($_FILES['bildatei']['size'] > 0) && ($_FILES['bildatei']['size'] < 51200) && in_array($_FILES['bildatei']['type'], $allowedImgs)) { $uploadOK = 1; } else { $uploadOK = 0; } // $content = $_FILES['bildatei']['type']; if (isset($_POST['bildatei']) && !in_array($_FILES['bildatei']['type'], $allowedImgs)) $errorMsg = 'Falscher Datentyp...'; if (isset($_POST['bildatei']) && $_FILES['bildatei']['size'] > 51200) $errorMsg = 'Die Datei ist zu groß'; $content = ''."\n"; $content .= '
'."\n"; $content .= 'DATEN KORRIGIEREN'."\n"; $content .= ''."\n"; $content .= ''."\n". '
DATEN KORRIGIEREN


'."\n"; // Kontrolle /* foreach ($_POST as $key => $val) { $content .= $key.": ".$val."
\n"; }*/ // Kontrolle foreach ($_GET as $key => $val) { $content .= $key.": ".$val."
\n"; } $content .= ''."\n"; $content .= ''."\n"; if (isset($_POST['submit']) && !$_POST['leereFelder'] && ($_POST['uploadOK'] || !isset($_FILES['bildatei']))) { // $fp = @fopen("csv/buecher.csv", "a") or die(ERROR); change_csvdataset($iD); // fclose($fp); $content .= ''; } else { $content .= ''."\n"; if (!isset($_POST['submit'])) { $book = readout_csvdataset($iD); } foreach($insert as $val) { if (!isset($_POST['submit'])) $_POST[$val] = $book[$val]; if (empty($_POST[$val]) && (isset($_POST['submit']))) { $content .= ''."\n"; $leereFelder++; } $markedVal = "*".ucfirst($val); $content .= "".''."\n"; } if (isset($_POST['uploadOK']) && !$_POST['uploadOK']) $content .= ''."\n"; $content .= ''."\n"; $content .= ''."\n"; $content .= ''."\n"; $content .= ''."\n"; $content .= ''; } $content .= '
Zurück zur Liste
Die Daten wurden gespeichert!
Dieses Feld muss ausgefüllt werden!
$markedVal
Upload hat nicht funktioniert!('.$errorMsg.')
Image(GIF oder JPG), max 50kB
'."\n"; $content .= '



'."\n"; $content .= ''."\n"; return $content; }