Log In · Register

 
ask & answer script problem
Mulder
post Oct 1 2005, 11:46 AM
Post #1


i lost weight with Mulder!
*******

Group: Official Designer
Posts: 4,070
Joined: Jan 2005
Member No: 79,019



so, lisa did not convert my "ask" page to php, so i attempted to do it myself. apparently, that was a bad idea. it works, but it has all these error messages at the top...


ask page

CODE
<?php
session_start();
// enter the absolute path to ask&answer directory
$dir = "";

// ask and answer functions
include_once("{$dir}functions.php");
?>


this seems to be the problem. that i dont have anything in the first $dir = "";


but im not sure what to put there...
 
 
Start new topic
Replies
Mulder
post Oct 1 2005, 06:23 PM
Post #2


i lost weight with Mulder!
*******

Group: Official Designer
Posts: 4,070
Joined: Jan 2005
Member No: 79,019



..*blushes*. this is the ask.php file:

CODE
<?php
///////////////////////////////////////////////////////////////////////////////////
//    Wak's Ask&Answer/FAQs Script
//
//    Script by Katie http://luved.org
//
//    This script is linkware and can be used or modified as long as all credit is
//    left attached to this file and a link is placed on your website to
//    http://www.luved.org
//    You are forbidden to sell or distribute this script without permission by
//    it's creator and if a bug is found, report to scripts@luved.org
///////////////////////////////////////////////////////////////////////////////////

// -----------------------------------------------------------------
//    PROCESS QUESTIONS
// -----------------------------------------------------------------
// Below, you can change what response is given when the ASK button is
// pressed
//    Question was successful:
$qSuccess = "<p><b>Your question will be answered as soon as possible.</b></p>";
// Question failed due to double posting:
$qFailed_DoublePost = "<p><b>You can only post a question every $sec seconds.</b></p>";
// Question failed due to a blank post
$qFailed_BlankPost = "<p><b>You can not submit a blank question.</b></p>";

// process questions when button is pressed
if (isSet($_POST['ask'])) {
    $question = $_POST['question'];
    addQuestion($question);
}


// -----------------------------------------------------------------
//    DISPLAYS QUESTIONS AND ANSWERS X Entries Per Page
//
//    Try to read through my comments (any line with a leading //)
//    To customize the script to your liking
// -----------------------------------------------------------------
// Number of all answered questions
$totalAnswered = count(getTotalAnswered());
// Number of all entries in the database (answered and unanswered)
$total = total(DBFILE);
// Number of all unanswered questions
$totalUnAnswered = count(getTotalUnanswered());
// grab data from config.txt file
list($id, $key, $url, $email, $notify, $entryPerPage, $dtFormat, $display) = getFileRow(CONFIGFILE);
// if $entryPerPage is less than 1, set to the default number of entries per page
if ($entryPerPage < 1)
    $entryPerPage = $defaultEntryPerPage;
// --> Status
// display how many answered questions out of total questions asked, how many
// entries per page and the number of unanswered questions in database
echo "<b>$totalAnswered</b> answered questions out of <b>$total</b> asked.<br />";
echo "Now displaying <b>$entryPerPage</b> question/s per page.<br />";
echo "There are currently <b>$totalUnAnswered</b> unanswered question/s.";
?>
<!-- Ask text box:
NOTE: You can copy and paste the following line to a different page eg index.php if you just want to
display the form and not the actual question and answers.
if you place askform.php in its own directory, change the location of askform.php, for example
include('path/to/askform.php')
-->
<?php include('askform.php')?>
<!-- End Ask text box-->

<?php
// -----------------------------------------------------------------
//    DISPLAYS QUESTIONS AND ANSWERS X Entries Per Page
//
//    Try to read through my comments (any line with a leading //)
//    To customize the script to your liking
// -----------------------------------------------------------------
// grabs answered questions into an array
$answeredRows = getTotalAnswered();
if (is_array($answeredRows)) {
    // if user set entries to be displayed in descending order, reverse rows in array
    if ($display == 2) {
 $answeredRows = array_reverse($answeredRows);
    }
    // page number
    $pagenum = $_GET['page'];
    // figures out from entries per page, and how many answered entries in database
    // as to how many pages there should be to display all entries
    $answeredRows = perPage($answeredRows, $entryPerPage, $pagenum);
    $numPages = $answeredRows['numpages'];
    // display 'jump to page' if contains more than one page of entries
    ?>
    <table class="qapost" border="0" width="400" align="center">
 <tr><td align="right"><?php printJumpToPage("$phpSelf?page=", $numPages, $pagenum); ?></td></tr>
    </table>
    <?php
    if (is_array($answeredRows['entries'])) {
 foreach ($answeredRows['entries'] as $ans) {
 // grabs data from each row
 list($id, $q, $a, $ip, $dateAsked, $dateAnswered) = get($ans);?>
 <table class="qapost" border="0" width="400" align="center">
     <tr>
   <td class="td" colspan="2">
   <?php // display Questions?>
   <b>Q.</b> <b title="IP: <?php echo $ip?>"><?php echo convertLinks($q)?></b></td></tr>
     <tr>
   <td colspan="2">
   <?php // display Answers?>
   <b>A.</b> <?php echo convertLinks(fixBrkForHTML($a))?></td></tr>
     <tr>
   <td align="right">
   <?php // date when asked and answered?>
       <small><b>asked:</b> <?php echo dateFormatAdv($dateAsked, $dtFormat)?> <b>answered:</b> <?php echo dateFormatAdv($dateAnswered, $dtFormat)?></small></td></tr>
   </table><br /><br />
    <?php }
    }
    // display 'jump to page' if contains more than one page of entries ?>
    <table class="qapost" border="0" width="400" align="center">
 <tr><td align="right"><?php printJumpToPage("$phpSelf?page=", $numPages, $pagenum); ?></td></tr>
    </table>
    <?php
}
?>
<center>
    <small><a href="http://luved.org" target="_blank">Powered by WakScripts</a></small>
</center>


im...kinda lazy. im not sure if it modifies the header anyway.
 

Posts in this topic


Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members: