#!/usr/bin/perl
require 'parse.pl';
&parse_form;
print "Content-type:text/html\n\n";
if (length($v{'keyword'}) < "3") { &breakerror('Keyword ไม่เหมาะสม โปรดกรอกใหม่'); }
$filename = ".";
opendir(flist,"$filename");
@allf = readdir flist;
closedir(flist);
@allf = sort @allf;
for $i (0 .. @allf) {
if (length($allf[$i]) eq "17") {
open(myfile,"$allf[$i]");
@getrec = <myfile>;
close(myfile);
$found = 0;
$v{'keyword'} = lc $v{'keyword'};
foreach $r(@getrec) { if(lc $r =~ /(.*)$v{'keyword'}(.*)/) { $found = 1; } }
if ($found eq "1") { push @ar,$getrec[0]; }
}
}
@ar = reverse sort @ar;
$tot = @ar-1;
print'ผลการสืบค้น ใน Board<ol>';
for $i (0..$tot) {
@rec = split (/:/,$ar[$i]);
print "<li><a href=boardread.pl?id=$rec[0]>$rec[1]</a> ";
print "<font color=#808080>$rec[2]</font>";
}
print'</ol>';
จำนวน : 30 บรรทัด