home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 49 / cda49.iso / VNULabs / BrownOrifice / BOHTTPD-0.2 / BOHTTPD_search.cgi < prev    next >
Encoding:
Text File  |  2000-08-11  |  720 b   |  42 lines

  1. #!/usr/bin/perl
  2.  
  3. use BOHTTPD;
  4. use CGI;
  5.  
  6. print qq{Content-type: text/html\n\n};
  7.  
  8. my $cgi = new CGI;
  9. my $Q = html_escape($cgi->param('q'));
  10.  
  11. BOHTTPD::show_header;
  12.  
  13. print qq<
  14.   <form>
  15.   <table><tr>
  16.     <td>Query</td>
  17.     <td><input name=q size=80 value="$Q"></td>
  18.   </tr>
  19.   <tr><td colspan=2 align=center>
  20.     <input type=submit value="Search!">
  21.   </table>
  22.   </form>
  23. >;
  24.  
  25. if (my $q = $cgi->param('q')) {
  26.   my $dt = $cgi->param('dt') || 600;
  27.   my @u = BOHTTPD::db_search($q, $dt);
  28.  
  29.   if (@u) {
  30.     print qq<<hr><ul>>;
  31.     for my $url (@u) {
  32.       my $URL = html_escape($url);
  33.       print qq<<li><a href="$URL">$URL</a>>;
  34.     }
  35.     print qq<</ul>>;
  36.   } else {
  37.     print "<hr>No matches found.\n";
  38.   }
  39. }
  40.  
  41. BOHTTPD::show_footer;
  42.