Private post. Click to view.

Dr. GBooky is here to help you with your guestbook problems ...
Post Reply
Raidersguy
Posts: 18
Joined: Thu Aug 17, 2006 9:30 pm

Private post. Click to view.

Post by Raidersguy »

When you submit a reply to a posting I find the original comments disappear and are replaced by Private post. Click to view. Is this correct as I assumed that the guestbook owner could add a message to the original comments any has anyone else had this.
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

That shouldn't happen unless the post already was private. Have you been editing gbook.php?

Please include following info if you want further help

Script URL:
Version of script:
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when searching for a solution:
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
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Post by Henrie »

He probably has been editing the gbook (see this post viewtopic.php?t=1038).
But he probably has done something wrong, I warned him in my post that some fields are used for very specific tasks that have been coded in gbook.
He posted a reply afterwards in which he asked what he should edit. Later when I wanted to reply, the post was deleted so I did not have the chance to reply.
My guess is that he found what he should edit. But according to this post he has done it the wrong way.

Greetings,
Henrie
Last edited by Henrie on Sun Aug 20, 2006 2:20 pm, edited 1 time in total.
Raidersguy
Posts: 18
Joined: Thu Aug 17, 2006 9:30 pm

Post by Raidersguy »

Hi guys yes I have edited the book, sorry for the delay but I have been fighting with it for 2 days now.
What consumes the time is uploading and testing it on the server.
I found that the message “Private post. Click to view” appears due to my own fault of adding an extra field, also other problems which is connected with this are other fields eg web address, swooping with email address, I am really struggling to add another felid, I feel the problem is when writing to the log file and the guestbook reading the information and display the fields incorrectly, has anyone successfully added a field if so I would really appreciate a look at your gbook.php file.
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Post by Henrie »

Hello Raidersguy,

Here's a step by step description on how to add an extra field.
The changes and line numbers are for the original GBook version 1.43.
The newfield I have introduced is named newfield1
Where the name of the field is printed in the guestbook I have used the name newfield1_name, this can be changed to whatever you want.

Change (starting at line 71)

Code: Select all

        $name=gbook_input($_POST['name']);
        $from=gbook_input($_POST['from']);
        $a=check_mail_url(); $email=$a['email']; $url=$a['url'];
        $comments=gbook_input($_POST['comments']);
        $isprivate=gbook_input($_POST['private']);

        if ($isprivate) {$sign_isprivate='checked';}
        if ($_REQUEST['nosmileys']) {$sign_nosmileys='checked';}

        if (empty($name))
        {
            printSign($name,$from,$email,$url,$comments,$sign_nosmileys,$sign_isprivate,'Please enter your name');
        }
        if ($email=='INVALID')
        {
            printSign($name,$from,'',$url,$comments,$sign_nosmileys,$sign_isprivate,'Enter a valid e-mail address or leave it empty');
        }
        if ($url=='INVALID')
        {
            printSign($name,$from,$email,'',$comments,$sign_nosmileys,$sign_isprivate,'Enter a valid website address or leave it empty');
        }
        if (empty($comments))
        {
            printSign($name,$from,$email,$url,$comments,$sign_nosmileys,$sign_isprivate,'Please enter your comments');
        }
to this

Code: Select all

        $name=gbook_input($_POST['name']);
        $from=gbook_input($_POST['from']);
        $a=check_mail_url(); $email=$a['email']; $url=$a['url'];
        $comments=gbook_input($_POST['comments']);
        $isprivate=gbook_input($_POST['private']);
        $newfield1=gbook_input($_POST['newfield1']);
        if ($isprivate) {$sign_isprivate='checked';}
        if ($_REQUEST['nosmileys']) {$sign_nosmileys='checked';}

        if (empty($name))
        {
            printSign($name,$from,$email,$url,$comments,$sign_nosmileys,$sign_isprivate,$newfield1,'Please enter your name');
        }
        if ($email=='INVALID')
        {
            printSign($name,$from,'',$url,$comments,$sign_nosmileys,$sign_isprivate,$newfield1,'Enter a valid e-mail address or leave it empty');
        }
        if ($url=='INVALID')
        {
            printSign($name,$from,$email,'',$comments,$sign_nosmileys,$sign_isprivate,$newfield1,'Enter a valid website address or leave it empty');
        }
        if (empty($comments))
        {
            printSign($name,$from,$email,$url,$comments,$sign_nosmileys,$sign_isprivate,$newfield1,'Please enter your comments');
        }
Change (line 103)

Code: Select all

printSign($name,$from,$email,$url,$comments,$sign_nosmileys,$sign_isprivate,'Please enter the security number');
to

Code: Select all

printSign($name,$from,$email,$url,$comments,$sign_nosmileys,$sign_isprivate,$newfield1,'Please enter the security number');
and change (line 108)

Code: Select all

printSign($name,$from,$email,$url,$comments,$sign_nosmileys,$sign_isprivate,'Wrong security number');
to

Code: Select all

printSign($name,$from,$email,$url,$comments,$sign_nosmileys,$sign_isprivate,$newfield1,'Wrong security number');
Change (line 124)

Code: Select all

addEntry($name,$from,$email,$url,$comments,$isprivate);
to

Code: Select all

addEntry($name,$from,$email,$url,$comments,$isprivate,$newfield1);
Change (line 353)

Code: Select all

function print_secimg($name,$from,$email,$url,$comments,$isprivate,$message=0) {
to

Code: Select all

function print_secimg($name,$from,$email,$url,$comments,$isprivate,$newfield1,$message=0) {
Add (after line 383, which is the following line)

Code: Select all

<input type="hidden" name="private" value="<?php echo $isprivate; ?>">
the following code (it does not have to be at that line exactly but must be somewhere in that paragraph with the other "hidden" input fields)

Code: Select all

<input type="hidden" name="newfield1" value="<?php echo $newfield1; ?>">
Change (line 430)

Code: Select all

list($name,$from,$email,$url,$comment,$added,$isprivate,$reply)=explode($delimiter,$lines[$num]);
to (notice that ,$ip,$newfield1 is added and not only $newfield)

Code: Select all

list($name,$from,$email,$url,$comment,$added,$isprivate,$reply,$ip,$newfield1)=explode($delimiter,$lines[$num]);
Add after (starting at line 448)

Code: Select all

if ($email)
{
	echo '<font class="smaller">E-mail:</font> <a href="mailto:'.$email.'" target="_blank" class="smaller">'.$email.'</a>';
}
the following code (it can also be placed before the previous lines of code, depending on where you want the field to be displayed in the private messages)

Code: Select all

if ($newfield1)
{
	echo '<font class="smaller">newfield1_name: '.$newfield1.'</font><br>';
}
Change (line 607)

Code: Select all

function addEntry($name,$from,$email,$url,$comments,$isprivate="0") {
to

Code: Select all

function addEntry($name,$from,$email,$url,$comments,$isprivate="0",$newfield1) {
Change (line 632), these are the fields that are added to the entries.txt file

Code: Select all

$addline = $name.$delimiter.$from.$delimiter.$email.$delimiter.$url.$delimiter.$comments.$delimiter.$added.$delimiter.$isprivate.$delimiter.'0'.$delimiter.$_SERVER['REMOTE_ADDR']."\n";
to

Code: Select all

$addline = $name.$delimiter.$from.$delimiter.$email.$delimiter.$url.$delimiter.$comments.$delimiter.$added.$delimiter.$isprivate.$delimiter.'0'.$delimiter.$_SERVER['REMOTE_ADDR'].$delimiter.$newfield1."\n";
Add a new line somewhere in this code (starting at line 651)

Code: Select all

Name: $name
From: $from
E-mail: $email
Website: $url
with the following code (this is adding the new field to the notifying mail)

Code: Select all

newfield1_name: $newfield1
Change (line 686)

Code: Select all

function printSign($name='',$from='',$email='',$url='',$comments='',$nosmileys='',$isprivate='',$error='') {
to

Code: Select all

function printSign($name='',$from='',$email='',$url='',$comments='',$nosmileys='',$isprivate='',$newfield1='',$error='') {
Add after (starting at line 713)

Code: Select all

<tr>
<td>Your e-mail:</td>
<td><input type="text" name="email" size="30" maxlength="50" value="<?php echo $email; ?>"></td>
</tr>
The following code can also be added before that piece of code but has to be an entire table row ( <tr>...</tr> ). This is the field in the "sign guestbook" page

Code: Select all

<tr>
<td>newfield1_name:</td>
<td><input type="text" name="newfield1" size="30" maxlength="50" value="<?php echo $newfield1; ?>"></td>
</tr>
Change (line 779)

Code: Select all

list($name,$from,$email,$url,$comment,$added,$isprivate,$reply)=explode($delimiter,$lines[$i]);
to (notice that ,$ip,$newfield1 is added and not only $newfield)

Code: Select all

list($name,$from,$email,$url,$comment,$added,$isprivate,$reply,$ip,$newfield1)=explode($delimiter,$lines[$i]);
Add after (starting at line 796)

Code: Select all

if ($email)
{
	echo '<font class="smaller">E-mail:</font> <a href="mailto:'.$email.'" target="_blank" class="smaller">'.$email.'</a><br>';
}
the following code (it can also be placed before that code, depending on where you want the line with the new field to be displayed in the guestbook)

Code: Select all

if ($newfield1)
{
	echo '<font class="smaller">newfield1_name: '.$newfield1.'</font><br>';
}
This should be everything and works in my test guestbook.
I just hope I have not made an error when I added all this to this forum.

Greetings,
Henrie
Raidersguy
Posts: 18
Joined: Thu Aug 17, 2006 9:30 pm

Post by Raidersguy »

Absolutely brilliant Henrie that’s really nice of you, I will give it a go and get back to you
Raidersguy
Posts: 18
Joined: Thu Aug 17, 2006 9:30 pm

Post by Raidersguy »

:D Hello Henrie totally successful many thanks, your help was very very much appreciated.
Post Reply