Stopping Submissions With Empty Fields

Dr. GBooky is here to help you with your guestbook problems ...
cAdams
Posts: 40
Joined: Thu Sep 15, 2011 10:52 pm

Stopping Submissions With Empty Fields

Post by cAdams »

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:

Write your message below:

Since resolving the header issue myself after several days, I have another query.

I've also since changed the guestbook to include the field Image Title but need to ensure this field isn't left empty so added the following code:

/* Check image title */
if (empty($_POST['image_title']))
{
$error_buffer .= $lang['e26'];
}
elseif ( gbook_input($_POST['image_title']) != $settings['apass'] )
{
$error_buffer .= $lang['e27'];
}

after 'approve Entries' in gbook.php but a blank page comes up with an error message pointing to line 235.

To ensure visitors DON'T leave the new field Image Title empty, what is the correct code to put where in what file pls?
To All UALs (Unreliable Arrogant Liars), Go Play On The Motorway
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Re: Stopping Submissions With Empty Fields

Post by Henrie »

Hello cAdams,

The self written code you have added is not valid html.

Code: Select all

<input image="" value="" size="45" type="text">
image="" should probably be name="image"

But it takes much more than just adding that code to add an extra field. And because it has to be stored in the entries text-database a new field has to be added there.
It is just to much work and might give problems with updating the GBook script to a newer version, so we do not give support for that here in the forum.

I have helped someone with a previous version to add an extra field (see here viewtopic.php?p=4318#p4318 ) but version 1.7 is much different so it can not be applied directly. But it will give you an idea about the amount of work.

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.
cAdams
Posts: 40
Joined: Thu Sep 15, 2011 10:52 pm

Re: Stopping Submissions With Empty Fields

Post by cAdams »

well even after hours i spent tweaking the outdated 'adding fields' info given above Henrie, when the image title IS entered, the error message now comes up to say it's not ie 'Enter The Required Image Title As Bold Donates' :x

there is also no mention of the entries text-database file in the out-dated link above

hardly encouraging for my avid followers seen as until this is resolved, NO-ONE can submit ANY feedback :(

given there's only 2 files to look at, surely the missing or incorrect code would be easy enough to spot wouldn't it????? :|
To All UALs (Unreliable Arrogant Liars), Go Play On The Motorway
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Re: Stopping Submissions With Empty Fields

Post by Henrie »

I told you that the current GBook 1.7 is much different than the one I had written it for. So my old manual will be hard to use it as a lead for the the current version.

And I really do not have the time now to help you with it in any way.

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.
cAdams
Posts: 40
Joined: Thu Sep 15, 2011 10:52 pm

Re: Stopping Submissions With Empty Fields

Post by cAdams »

ok well i won't be buying you any beers Henrie any time soon
To All UALs (Unreliable Arrogant Liars), Go Play On The Motorway
Lisaweb
Posts: 94
Joined: Sun Sep 25, 2011 3:23 pm

Re: Stopping Submissions With Empty Fields

Post by Lisaweb »

Aarf! Funny! :mrgreen:
cAdams wrote:ok well i won't be buying you any beers Henrie any time soon
- Lisa
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Re: Stopping Submissions With Empty Fields

Post by Henrie »

cAdams wrote:ok well i won't be buying you any beers Henrie any time soon
:lol: I did not expect you to.

The problem is that I am waaaaay behind on other things I need to do for my new house. So I just can not find any time to do this.
But maybe you can put the changed file(s) in a zip file for me to download, than I can have a look at the code and see what you forgot to change.

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.
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Re: Stopping Submissions With Empty Fields

Post by Klemen »

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
cAdams
Posts: 40
Joined: Thu Sep 15, 2011 10:52 pm

Re: Stopping Submissions With Empty Fields

Post by cAdams »

..........But maybe you can put the changed file(s) in a zip file for me to download, than I can have a look at the code and see what you forgot to change.

Greetings,
Henrie.
sorry but it appears i'm unable to attach any files for you to download as you so generously offered Henrie
Last edited by cAdams on Mon Oct 03, 2011 10:30 pm, edited 1 time in total.
To All UALs (Unreliable Arrogant Liars), Go Play On The Motorway
cAdams
Posts: 40
Joined: Thu Sep 15, 2011 10:52 pm

Re: Stopping Submissions With Empty Fields

Post by cAdams »

Klemen wrote:cAdams, reading here this topic might be of your interest.
i'm a single income solo mortagee on a benefit therefore i cannot afford to hire anyone for any help Klemen
Last edited by cAdams on Mon Oct 03, 2011 10:34 pm, edited 1 time in total.
To All UALs (Unreliable Arrogant Liars), Go Play On The Motorway
Lisaweb
Posts: 94
Joined: Sun Sep 25, 2011 3:23 pm

Re: Stopping Submissions With Empty Fields

Post by Lisaweb »

Perhaps you may want to try Dropbox.com. It's free. That's what I use to upload files for others to access. Hope it helps! :-)
cAdams wrote: sorry but it appears i'm unable to attach any files for you to download as you so generously requested Henrie
Last edited by Lisaweb on Tue Oct 04, 2011 4:39 pm, edited 1 time in total.
- Lisa
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Re: Stopping Submissions With Empty Fields

Post by Henrie »

cAdams, you have a website, so you can host the zip-file there (I think). I will let you know when I have downloaded it so you can remove it afterwards.
Or you could use dropbox.com as Lisaweb suggests.
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.
cAdams
Posts: 40
Joined: Thu Sep 15, 2011 10:52 pm

Re: Stopping Submissions With Empty Fields

Post by cAdams »

thanx so much for your useful suggestion Lisaweb and Henrie which i've heeded and uploaded the files Henrie requested

have also PMed you Henrie 8)
To All UALs (Unreliable Arrogant Liars), Go Play On The Motorway
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Re: Stopping Submissions With Empty Fields

Post by Henrie »

cAdams,

You tricked me into looking into it earlier than I would have wanted to.

I looked in gbook.php file, you have forgotten to add the ititle field to all the required functions for adding a message to the entries file.

Add it here

Code: Select all

    if ($error_buffer)
    {
    	printSign($name,$from,$email,$url,$comments,$sign_nosmileys,$sign_isprivate,$error_buffer,$spamanswer);
    }
and here

Code: Select all

    /* Create the new entry and add it to the entries file */
	$addline = $name.$delimiter.$from.$delimiter.$email.$delimiter.$url.$delimiter.$comments.$delimiter.$added.$delimiter.$isprivate.$delimiter.'0'.$delimiter.$_SERVER['REMOTE_ADDR']."\n";
Be carefull where you put the field, it is very important because the fields depend on their order in the text database. Make sure it is added in the text database after the REMOTE_ADDR field.

And to display it in the guestbook, I think you also need to edit the functions

Code: Select all

function printSign($name='',$from='',$email='',$url='',$comments='',$nosmileys='',$isprivate='',$error='',$spamanswer='')
{
...
}
and

Code: Select all

function printEntries($lines,$start,$end)
{
...
}
So now you can spent some more hours in adding the code. I hope I gave you some direction where to find. Because I really do not have time to add and test the code.

I can only say that when I first added the code for an extra field myself it took 2 full days (of about 10 hours each) because I did not know where to look and because php was very new to me. But I really learned much from the experience.

Luckily since than the guestbook has evolved, and I do not need the extra fields anymore. If I would have needed the extra field myself I could have given you the changes without to much hassle because I would have done it myself already than.

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.
cAdams
Posts: 40
Joined: Thu Sep 15, 2011 10:52 pm

Re: Stopping Submissions With Empty Fields

Post by cAdams »

As you said yourself Henrie
I will probably not have time to look in on it before thursday or otherwise the weekend. So please be patient.
to which I replied in my PM, 'Whenever you can look at the php files, I'll be grateful Henrie!' so never once have I 'tricked you' into anything.

Secondly I also forewarned the forum at the very beginning I'm a PHP virgin requesting members bear with me because for PHP virgins who have been ran over by a car and left in a coma we weren't expected to come out of Henrie, some things need to be spelt out. Furthermore of my two websites, both of which use php, with a malfunctioning brain I have spent far, far, FAR more than 10hrs/day learning php so if you regard me as a hassle for accepting your offer, I will accept no more.

Finally your suggested modifications haven't worked but thank you for trying all the same and my apologies for wanting to know exactly which image someone is referring to when leaving feedback.
To All UALs (Unreliable Arrogant Liars), Go Play On The Motorway
Post Reply