#!/usr/mesh/bin/perl # DbRefer.pl is freeware: (c)GOMASUKE # Dept. of Computer Science, Faculty of Engineering, # Shizuoka Univ., Hamamatsu, Japan # Ver.1.0 1998/03/24 # # The following DENY BLOCK: execute permission denied domain(0) $| = 1; require './jcode.pl'; $base = 'http://www.hogehoge.(or|ne).jp/~foo/'; $acl = 0; $file = 'db.txt'; $log = 'dblog.txt'; @cnd = ('or','and'); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdat) = localtime(time); $mon++; $day = sprintf("%02d%02d/%02d%02d", $mon,$mday,$hour,$min); $rh = $ENV{'REMOTE_HOST'}; $ra = $ENV{'REMOTE_ADDR'}; $ref = $ENV{'HTTP_REFERER'}; $ref =~ s/%7E/~/gi; $ENV{'REQUEST_METHOD'} =~ tr/a-z/A-Z/; if ($ENV{'REQUEST_METHOD'} eq "GET") { $dat = $ENV{'QUERY_STRING'}; } else { read(STDIN, $dat, $ENV{'CONTENT_LENGTH'}); } @buf = split('&',$dat); foreach $item (@buf) { ($var,$value) = split('=',$item); $value =~ tr/+/ /; $value =~ s/%([0-9a-fA-F][0-9a-fA-F])/pack("C", hex($1))/eg; $value =~ s/\r\n/\n/g; $value =~ s/\r/\n/g; #Win,Mac $value =~ s/\n//g; if ($var eq "keywd") { $kwd = $value; } &jcode'convert(*value,'euc'); $itm{$var} = $value; } print "Content-type: text/html\n\n"; $keywd = $itm{'keywd'}; @x = split(',', $keywd); $kc = @x; if ($kc == 0) { print "
EOF $rc = 1; $i = 1; if (-e $file) { open(IN,"<$file"); while(!eof(IN) && $i <= $max) { chop($d =); $f = 0; foreach (@x) { if ($d =~ /$_/i) { if ($cd == 0) { $f = $kc; last; } else { $f += 1; } } } if ($f == $kc) { print "$d\n"; $i += 1; } $rc += 1; if (($rc % 2000) == 0) { print "Now! $rc(rec)\n"; } } close(IN); } print <
MAX record:$max cgi script (c)GOMASUKE<DbRefer.pl>