/[nn.old]/trunk/search/nn2-search.cgi
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/search/nn2-search.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 28 - (show annotations)
Fri Jan 25 18:56:17 2002 UTC (18 years, 5 months ago) by dpavlin
File MIME type: application/octet-stream
File size: 1346 byte(s)
Initial revision

1 #!/usr/bin/perl -w
2
3 use strict;
4 use CGI qw/:standard -no_xhtml/;
5 use DBI;
6 use Text::Query;
7
8 my $url="http://www.nn.hr/CijeliBrojS.asp?god=%d&br=%d#%d";
9
10 my %labels = ('Simple'=>'jednostavnim', 'Advanced'=>'naprednim');
11
12 print header(-charset=>'iso-8859-2'),start_html(-title=>'NN pretrazivanje',-lang=>'hr'),start_form;
13 print "Traži zakon: ",textfield('search')," sa ";
14 print popup_menu(-name=>'type',-values=>[ keys %labels ],-labels=>\%labels);
15 print submit(-value=>'pretraživanjem');
16 print end_form,hr;
17
18 if (param('search') && param('type')) {
19 my $question;
20 my ($query) = Text::Query->new('blurk', # param('search'),
21 -parse => 'Text::Query::Parse'.param('type') || 'Advanced',
22 -build => 'Text::Query::BuildSQLPg',
23 -fields_searched => 'title_czs',
24 -select => 'select br,god,aname,nr,title from nn where __WHERE__ order by god desc,br desc,nr asc'
25 );
26
27 $query->prepare(param('search'));
28
29 # print "--",$query->matchstring();
30
31 my $dbh = DBI->connect("DBI:Pg:dbname=nn","dpavlin","") || die $DBI::errstr;
32 my $sth=$dbh->prepare($query->matchstring()) || die $dbh->errstr();
33 $sth->execute() || die $dbh->errstr();
34 while (my $row = $sth->fetchrow_hashref()) {
35 print br,"<tt><a href=\"",sprintf($url,$row->{god},$row->{br},$row->{aname}),"\">NN",$row->{god},"/",$row->{br},"</a> ",$row->{nr},"</tt> ",$row->{title},"\n";
36 }
37 }
38

Properties

Name Value
cvs2svn:cvs-rev 1.1
svn:executable *
svn:mime-type application/octet-stream

  ViewVC Help
Powered by ViewVC 1.1.26