#!/usr/bin/perl
#########################################################
# Auto-FAQ Version 1.0 by Web ScriptsUK #
# http://www.web-scripts.co.uk #
# Originally Released: 23rd May 2001 (v1.0) #
#########################################################
# #
# COPYRIGHT NOTE: #
# Auto-FAQ may be used and modified free of charge by #
# anyone so long as this copyright notice and the #
# comments above remain intact. By using this code you #
# agree to indemnify Neil Skirrow from any liability #
# that might arise from its use. Selling the code for #
# this program without prior written consent is #
# expressly forbidden. In other words, please ask #
# first before you try and make money off of our #
# program. Obtain permission before redistributing #
# this software over the Internet or in any other #
# medium. In all cases copyright and header must #
# remain intact. We cannot be held responsible for #
# any harm this may cause. #
# #
#########################################################
use CGI qw(:standard);
$query = new CGI;
require "config/config.cfg";
require "$datahomepath/config/layout.cfg";
require "$datahomepath/config/version.cfg";
print "Content-type: text/html\n\n";
&main if ($ENV{'REQUEST_METHOD'} eq "GET");
sub main {
if ($ENV{'QUERY_STRING'}) {
my $getid = param("id");
my $getname = param("name");
&header;
print qq~
| $sitename: Top: $getname |
~;
open (DATA, "$catfiles/$getid.db");
@indata = ;
close (DATA);
foreach $entries (@indata){
($queid, $category, $question, $answer, $date) = split(/\|/, $entries);
print "- $question
\n";
}
print " |
| |
\n";
open (DATAA, "$catfiles/$getid.db");
@indataa = ;
close (DATAA);
foreach $entriesa (@indataa){
($queid, $category, $question, $answer, $date) = split(/\|/, $entriesa);
print "| $question |
\n";
print "| $answer |
\n";
print "Posted: $date |
\n";
}
print qq~
$date |
~;
&search;
&footer;
exit;
} else {
$catcount="0";
open (CATDB, "$categories");
@catlines =;
close (CATDB);
foreach $catlines (@catlines) {
$catcount++;
}
$quecount="0";
open (QUEDB, "$faqdb");
@quelines =;
close (QUEDB);
foreach $quelines (@quelines) {
$quecount++;
}
&header;
print qq~
| $sitename: Top |
| Thier are currently $catcount categories and $quecount questions in the $sitename FAQ database. |
~;
open (DATA, "$categories");
@indata = ;
close (DATA);
foreach $entries (@indata){
($id, $name, $description) = split(/\|/, $entries);
print "| $name | \n";
print "| $description | \n";
}
print qq~
|
$date |
~;
&search;
&footer;
exit;
}
}
sub search {
if ($searchform eq "Yes") {
print qq~
~;
}
}
# Generates the date for database use specifically.
sub get_date {
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
@months = ("01","02","03","04","05","06","07","08","09","10","11","12");
@digits = split(//,$sec);
$size = @digits;
if ($size == 1) {
$sec = "0$sec";
}
@digits = split(//,$min);
$size = @digits;
if ($size == 1) {
$min = "0$min";
}
$year=$year+1900;
$date = "@months[$mon]/$mday/$year";
}
sub header {
open(HEADER,"$datahomepath/include/header.inc");
while() {
print $_;
}
}
sub footer {
# Removing the below text breaks the terms of use for Auto-FAQ and may result in legal action!
print "\n";
# Removing the above text breaks the terms of use for Auto-FAQ and may result in legal action!
open(FOOTER,"$datahomepath/include/footer.inc");
while(