Added templates
[bibliodb.git] / index.php
bloba6847dad583b0e4165e6f1bb67301a879eccc340
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
4 <title>z39.5 klient</title>
5 </head>
6 <body>
7 <?php
9 $host=$_REQUEST[host];
10 $query=stripslashes($_REQUEST[query]);
11 $num_hosts = count($host);
12 if (empty($query) || count($host) == 0) {
13 echo '<form method="get">
14 <input type="checkbox"
15 name="host[]" value="bagel.indexdata.dk/gils" />
16 GILS test
17 <input type="checkbox"
18 name="host[]" value="localhost:9999/Default" />
19 local test
20 <input type="checkbox" checked="checked"
21 name="host[]" value="ckis.cuni.cz:9992/PEDF" />
22 PedF UK
23 <br />
24 RPN Query:
25 <input type="text" size="30" name="query" />
26 <input type="submit" name="action" value="Search" />
27 </form>
28 ';
29 } else {
30 echo 'You searched for ' . htmlspecialchars($query) . '<br />';
31 for ($i = 0; $i < $num_hosts; $i++) {
32 $id[] = yaz_connect($host[$i]);
33 $fields = array(
34 "ti" => "1=4",
35 "au" => "1=1",
36 "isbn" => "1=7"
38 yaz_ccl_conf($id[$i], $fields); // see example for yaz_ccl_conf
39 if (!yaz_ccl_parse($id[$i], $query, &$cclresult)) {
40 echo 'Error: ' . $cclresult["errorstring"];
41 } else {
42 $rpn = $cclresult["rpn"];
43 //yaz_search($id, "rpn", $rpn)ů
44 yaz_syntax($id[$i], "usmarc");
45 yaz_range($id[$i], 1, 10);
46 yaz_search($id[$i], "rpn", $rpn);
50 yaz_wait();
51 for ($i = 0; $i < $num_hosts; $i++) {
52 echo '<hr />' . $host[$i] . ':';
53 $error = yaz_error($id[$i]);
54 if (!empty($error)) {
55 echo "Error: $error";
56 } else {
57 $hits = yaz_hits($id[$i]);
58 echo "Result Count $hits";
60 echo '<dl>';
61 for ($p = 1; $p <= 10; $p++) {
62 $rec = yaz_record($id[$i], $p, "string");
63 if (empty($rec)) continue;
64 echo "<dt><b>$p</b></dt><dd>";
65 echo nl2br($rec);
66 echo "</dd>";
68 echo '</dl>';
74 </body>