Page 1 of 1
Multiple answers
Posted: Sat Aug 03, 2013 5:36 pm
by chris98
Hello, I have downloaded your Gbook script, and customised it into a Q and A page.I have removed the admin password for the reply, and turned it into an anti-spam check instead.
The question is now though, how do I add multiple answers? Everytime I try, it just overwrites the previous one.I will post the codes I have been using below if it is any help.(It has been a while since I changed it, so I might not get it exactly correct, but you'll probably get it) Thanks.
Re: Multiple answers
Posted: Sat Aug 03, 2013 5:44 pm
by chris98
I will post the codes I have been using below
The first one from the settings.php file is here.
Code: Select all
/* Spam Check for replies */
$settings['scheck']='g#r*aH2_';
Basically with this next one I just changed one letter I THINK.
Code: Select all
function postReply()
{
global $settings, $lang;
$error_buffer = '';
$num = isset($_POST['num']) ? intval($_POST['num']) : false;
if ($num === false)
{
problem($lang['e02']);
}
/* Check password */
if (empty($_POST['pass']))
{
$error_buffer .= $lang['e09'] . '<br />';
}
elseif ( gbook_input($_POST['pass']) != $settings['scheck'] )
{
$error_buffer .= $lang['e08'];
}
With this next code, I can remember I changed A LOT, so bear with me and I might not have got it all here:
Code: Select all
<?php
if ($error)
{
echo '<div class="gbook_sign_error">'.$error.'</div>';
}
?>
<div class="gbook_sign_text"><?php echo $lang['t14']; ?></div>
<div class="gbook_sign_text"><span class="gbook_entries"><b><?php echo $lang['t89']; ?></b></span><br class="clear" />
<input type="username" name="pass" size="45" /></div>
<div class="clear"></div>
<div class="gbook_left"><span class="gbook_entries"><b><?php echo $lang['t90']; ?></b></span></div>
<textarea name="comments" rows="12" cols="57" id="cmnt"><?php echo $comments; ?></textarea>
A seperate part on the same page
Code: Select all
<input type="hidden" name="a" value="postreply" />
<input type="hidden" name="num" value="<?php echo($num); ?>" />
<input type="submit" value="<?php echo $lang['t29']; ?>" class="submit" />
</div>
<p> </p>
<div class="gbook_sign_text"><a href="gbook.php"><?php echo $lang['t11']; ?></a></div>
I think that's it, but I will have to double check.There are of course a couple of settings I created, such as the "t13" one.etc.etc
You'll get the jist of it, right?
Thanks
Re: Multiple answers
Posted: Sat Aug 03, 2013 7:51 pm
by Klemen
To support multiple answers you would have to modify how the data is stored into and retrieved from the entries.txt file throughout the script.
Modifications of such extent are unfortunately out of the scope of my support.
Re: Multiple answers
Posted: Sat Aug 03, 2013 7:58 pm
by chris98
Do you know how I could at least make it un rewritable?
Re: Multiple answers
Posted: Sat Aug 03, 2013 8:41 pm
by Henrie
Hello Chris98,
You can do this by checking if a reply is already present and if there is, than not allowing to reply.
But unfortunately I have no time to find where to add the code (I am in the process of moving to my new house, I have still many boxes to unpack).
Greetings,
Henrie
Re: Multiple answers
Posted: Sun Aug 04, 2013 8:48 am
by chris98
It would be in the templates/default/admin_reply.php file I think.That's where I changed a lot of the coding above.
EDIT: No, the php for it is in the gbook.php file