Multiple answers

Dr. GBooky is here to help you with your guestbook problems ...
Post Reply
chris98
Posts: 7
Joined: Sat Aug 03, 2013 5:32 pm

Multiple answers

Post 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.
Last edited by chris98 on Sat Aug 03, 2013 5:46 pm, edited 1 time in total.
chris98
Posts: 7
Joined: Sat Aug 03, 2013 5:32 pm

Re: Multiple answers

Post 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>&nbsp;</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
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Re: Multiple answers

Post 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.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
chris98
Posts: 7
Joined: Sat Aug 03, 2013 5:32 pm

Re: Multiple answers

Post by chris98 »

Do you know how I could at least make it un rewritable?
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Re: Multiple answers

Post 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
I do not monitor the Gbook forums regularly anymore since I do not use the Gbook script myself anymore for a long time. But it helped me a lot in learning to understand php.
chris98
Posts: 7
Joined: Sat Aug 03, 2013 5:32 pm

Re: Multiple answers

Post 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
Post Reply