--- db/prgsrc/db.cgi 2001/11/30 23:48:53 1.38 +++ db/prgsrc/db.cgi 2001/12/03 02:28:56 1.39 @@ -7,7 +7,7 @@ use strict; use Time::Local; use POSIX qw(locale_h); use locale; -#open STDERR, ">errors"; +#open STDERR, ">errors1"; my $printqueries=0; my %forbidden=(); my $debug=0; #added by R7 @@ -192,9 +192,9 @@ print "$query",br if $printqueries; $_= " word2question.word=".$_. ' ' foreach @arr; $_= " nf.id=".$_. ' ' foreach @arr1; - +# @arr=(0) unless @arr; $query="select questions from word2question where". (join ' OR ', @arr); -print "$query\n",br if $printqueries; +print STDERR "!$query\n",br if $printqueries; $sth=$dbh -> prepare($query); $sth->execute; @@ -332,9 +332,18 @@ if $$words{$first}; sub Search { my ($dbh, $sstr,$metod,$all,$allnf) = @_; my (@arr, @Questions, @fields); - my (@sar, $i, $sth,$where); + my (@sar, $i, $sth,$where,$query); + my $ip=$ENV{'REMOTE_ADDR'}; -# push @fields, 'Question'; + $ip=$dbh->quote($ip); + $query= + "INSERT into queries (query,metod,searchin,ip) + values (". $dbh->quote($sstr).', '. + $dbh->quote($metod) . ', ' . + $dbh->quote(join ' ', grep $searchin{$_}, keys %searchin) . + ", $ip)"; +print $query if $printqueries; + $dbh -> do ($query); if ($metod eq 'rus') { @@ -362,7 +371,7 @@ sub Search { -fields_searched => $fields); $where= $$q{'matchexp'}; - my $query= "SELECT Questionid FROM Questions + $query= "SELECT Questionid FROM Questions WHERE $where"; print br."Query is: $query".br if $debug;