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 "
Name | Tel | |
---|---|---|
" . htmlspecialchars($entry['name']) + . " | " . htmlspecialchars($entry['tel']) + . " | " . htmlspecialchars($entry['mail']); + if ($i > @$_REQUEST['max']) break; + } + echo " |
Und noch ".count($entries)." weitere Einträge"; + exit(0); + } + break; } ?> +=header("Content-Type: text/html; charset=UTF-8");?> +
+ + - + - if ($_REQUEST['action'] == 'add') { ?> + if (@$_REQUEST['action'] == 'add') { ?> [ Home ] } else { ?> [ Add Entries ] } ?> +- if ($entries) { ?> +
Name | Telefon |
---|