<?php
######################################################################
# PHP-NUKE 4.2: FAQ Add-On
# ===========================
#
# Brought to you by PHP Nuke Add-On Team
#
# Copyright (c) 2000 by Richard Tirtadji (rtirtadji@hotmail.com)
#
# http://www.phpnuke.web.id
#
#
######################################################################
if (!isset($mainfile)) { include("mainfile.php"); }
function ShowFaq($id_cat) {
global $bgcolor2;
$result = mysql_query(" select categories from faqCategories " .
" where id_cat='$id_cat' ");
list($categories) = mysql_fetch_row($result);
echo"
<center>
<table cellpadding=0 cellspacing=1 bgcolor=000000 width=100% border=0>
<tr> <td>
<table cellpadding=8 cellspacing=1 bgcolor=FFFFFF width=100% border=0>
<tr><td> <center> <font size=4>" .translate("FAQ (Frequently Asked Questions)").
"</font> </center> <br><br>
<a name=top><a href=faq.php>".translate("Home")."</a> | $categories
<table width=100% cellpadding=4 cellspacing=0 border=0>
<tr bgcolor=$bgcolor2><td colspan=2><font color=white><b>Questions</b></font></td></tr><tr><td colspan=2>";
$result = mysql_query("select id, id_cat, question, answer from faqAnswer where id_cat='$id_cat'");
while(list($id, $id_cat, $question, $answer) = mysql_fetch_row($result)) {
echo"<li><a href=\"#$id\">$question</a>";
}
echo "</td></tr></table>
<br>";
}
function ShowFaqAll($id_cat) {
global $bgcolor2;
echo"
<table width=100% cellpadding=4 cellspacing=0 border=0>
<tr bgcolor=$bgcolor2><td colspan=2><font color=white><b>Answers</b></font></td></tr>";
$result = mysql_query("select id, id_cat, question, answer from faqAnswer where id_cat='$id_cat'");
while(list($id, $id_cat, $question, $answer) = mysql_fetch_row($result)) {
echo"<tr><td><a name=\"#$id\"><b>$question</b>
<p align=justify>$answer</p>
<a href=#top>".translate("Back to Top")."</a>
<hr>
</td></tr>";
}
echo"
</table>";
}
if (!$myfaq) {
include ("header.php");
echo"<center>
<table cellpadding=0 cellspacing=1 bgcolor=000000 width=100% border=0><tr><td>
<table cellpadding=8 cellspacing=1 bgcolor=FFFFFF width=100% border=0><tr><td>
<center><font size=4>".translate("FAQ (Frequently Asked Questions)")."</font></center><br><br>
<table width=100% cellpadding=4 cellspacing=0 border=0>
<tr bgcolor=$bgcolor2><td colspan=2><font color=white><b>".translate("Categories")."</b></font></td></tr><tr><td>";
$result = mysql_query("select id_cat, categories from faqCategories");
while(list($id_cat, $categories) = mysql_fetch_row($result)) {
echo"<li><a href=\"faq.php?myfaq=yes&id_cat=$id_cat&".
"categories=$categories\">$categories</a>";
}
echo"</td></tr></table></td></tr></table></td></tr></table>";
include ("footer.php");
}
else {
include("header.php");
ShowFaq($id_cat);
ShowFaqAll($id_cat);
echo"</td></tr></table></td></tr></table>";
}
include("footer.php");
?>