Log In · Register

 
 
Closed TopicStart new topic
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...
 
freeflow
post Oct 1 2005, 11:57 AM
Post #2


t-t-t-toyaaa
********

Group: Official Member
Posts: 19,821
Joined: Apr 2004
Member No: 11,270



You should take out whatever you did . Your pages are already php! not php includes. You should just leave it not includes to prevent the errors you have.

All you have to do i believe is just include your header file & your footer file & your css in the askme.php page.

I wouldn't of messed with it, since its not made with a "index page"

edit:// that thing means put the path to your directory. Im pretty sure its in your error.
Try this as a path:
/home2/asweetap/public_html/wonder/ask/
 
Mulder
post Oct 1 2005, 12:24 PM
Post #3


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

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



i didnt change that part. that was already there. and i am using includes, not php includes.


and it didnt work
 
freeflow
post Oct 1 2005, 12:35 PM
Post #4


t-t-t-toyaaa
********

Group: Official Member
Posts: 19,821
Joined: Apr 2004
Member No: 11,270



php includes are pretty much includes. The code you posted above is php includes.


What exactly did you change ?
 
*mipadi*
post Oct 1 2005, 12:41 PM
Post #5





Guest






It is an issue with a block of code for sessions, which is basically a thing to maintain an association between a specific user who is viewing your page and the webserver. Session information must be set before HTTP headers are set, which is not happening in this case.
 
Mulder
post Oct 1 2005, 12:41 PM
Post #6


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

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



this is the askme.php file:

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

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



<title>ask me anything</title>
<link rel="stylesheet" href="style.css" type="text/css" />

<?include ("http://wonder.foreverbliss.org/header.php"); ?>
<center>
<h1>Ask<b>&</b>Answer</h1>
<?php include("{$dir}ask.php")?>

<?include ("http://wonder.foreverbliss.org/footer.php"); ?>

</body>
</html>


the header.php has the <html>, <head>, and <body> in it. and this isnt how it originially was..but i think at some point i deleted a whole bucnh of stuff.
 
*mipadi*
post Oct 1 2005, 12:58 PM
Post #7





Guest






Does ask.php modify any headers?
 
Mulder
post Oct 1 2005, 06:23 PM
Post #8


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.
 

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