diff -r ae829f97a638 -r def69d70eb6e index.php --- a/index.php Tue Oct 25 16:45:47 2011 +0200 +++ b/index.php Tue Oct 25 22:24:36 2011 +0200 @@ -1,98 +1,85 @@ $entry[0], - 'tel' => $entry[1], - 'mail' => $entry[2]); - } - return $entries; -} - - -$abook = open_db(FILE); - -switch ($_REQUEST['action']) { - case 'add': add_entry($abook, $_REQUEST); - break; - case 'search': $entries = search_entries($abook, $_REQUEST['pattern']); - break; +switch (@$_REQUEST['action']) { + case 'add': if ($abook->add_entry($_REQUEST)) { + header("Location: $_SERVER[PHP_SELF]?action=add"); + exit(0); + } + break; + case 'search': $entries = $abook->search_entries($_REQUEST['pattern']); + if (@$_REQUEST['format'] == 'table') { + header("Content-Type: text/html; charset=UTF-8"); + if (!$entries) { + echo "Sorry, keine Einträge."; + exit(0); + } + echo ""; + for ($i = 1; $entry = array_shift($entries); $i++) { + echo "" + . "
NameTelMail
" . htmlspecialchars($entry['name']) + . "" . htmlspecialchars($entry['tel']) + . "" . htmlspecialchars($entry['mail']); + if ($i > @$_REQUEST['max']) break; + } + echo "
"; + if ($entries) + echo "

Und noch ".count($entries)." weitere Einträge"; + exit(0); + } + break; } ?> + + + + - + - + [ Home ] [ Add Entries ] +

+ DEBUG +

Adressbuch

- +

@@ -107,13 +94,16 @@ - - - + + +
- +
+ @@ -127,6 +117,7 @@ Sorry. +
NameTelefonMail