#!/usr/bin/perl
# This script asks user a text string, condense the white spaces in it,
# and matches it with all *.txt files in the specified directory
&parse_form;
print "Content-type: text/html\n\n";
print "
查詢結果\n";
$backgroundimage = $FORM{'backgroundimage'};
if ($backgroundimage =~ /\S+/) {
$background = "background=$backgroundimage";
}
$targetDir = $FORM{'targetDir'};
if ($targetDir !~ /\S+/) {
print "沒有指定搜尋路徑, 表單設計錯誤
\n";
print "";
exit;
}
$targetDirURL = $FORM{'targetDirURL'};
if ($targetDirURL !~ /\S+/)
{
$targetDirURL = $targetDir;
}
# input how many days back
#$daysBack = 0.5;
$daysBack = $FORM{'daysBack'};
if ($daysBack =~ /\d+/) {
$seconds = $daysBack * 24 * 60 * 60;
$timeBegin = time - $seconds;
}
# input target string
$targetStr = $FORM{'targetStr'};
if ($targetStr !~ /\S+/) {
print "沒有指定搜尋字串, 請回上一頁重新輸入
\n";
print "