New Comment Validation

Dr. GBooky is here to help you with your guestbook problems ...
iosefl
Posts: 10
Joined: Thu Dec 23, 2010 5:53 pm

New Comment Validation

Post by iosefl »

Script URL: http://www.wellnessfoods.ca/simplyswitc ... /gbook.php
Version of script: 1.7
Hosting company: http://www.ixwebhosting.com
URL of phpinfo.php: sorry I don't know
URL of session_test.php: sorry I don't know
What terms did you try when SEARCHING for a solution:
validation, post new comment

Write your message below:
This is a very useful script, thank you, installation is easy and instructions are well commented, I installed this script and use it in a jquery window, permissions are set correct, had a small issue with allowing emails to be sent from within the script and resolved that successfully, but I searched for 2 small things that I need and because I couldn't find I'm posting them here for help:
1). When entering new comment and not filling in all required fields, I can click on the submit button and nothing happens (user still on the same page with no error message to instruct the user which fields need to be filled) - maybe my files are not setup corectly for this?
2). When I do fill in all required fields and press the submit button, the comments are submitted, but the page is not refreshed or the user is not taken to the comments view page (where the new entered comment is already posted) so what ends up happening is that the user thinks his post wasn't accepted and tries to post again by clicking numerous times on the submit button - I noticed that if I post a reply or remove a post, after clicking the submit button the page changes to the Comments view page and a message at the top of the page tells me that the action I did was completed successfully, shouldn't be the same for a new comment post?
To view the script in action on our website please go to:
http://www.wellnessfoods.ca/simplyswitches/index.html and click on the Guest Book button, it will open the Guest Book in an overlay window.

Thanks,

Joseph
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Re: New Comment Validation

Post by Henrie »

I think you have not set it up properly. Because there are no error messages even when i open it directly from http://www.wellnessfoods.ca/simplyswitc ... /gbook.php
I first thought the problem would be the opening of the gbook in the jqeury window. But that does not seem to be the problem.

However I have no clue of what might be causing this.

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.
iosefl
Posts: 10
Joined: Thu Dec 23, 2010 5:53 pm

Re: New Comment Validation

Post by iosefl »

Henrie thank you for your fast reply,
I did set it up based on the readme file, with flag for new comment approval set to "0" and I also tested without the jquerry window with the same result, I didn't know if this was supposed to work this way or I have a problem.
The only things I changed, based on other forum responses, is the addition of the email address as a required field and the color change for admin reply to post text and these are working as expected.
I'm not too concern about the validation messages as there is enough information on the screen to let the user know which fields are mandatory, but I would really like to have the screen changed to the view comments screen when form is submitted successfully (like when the admin posts a reply or removes a comment), if I can't do this than at least maybe you can guide me on how to add a notification text on the comment entry page to tell the user to submit only once and after that to go to the comments view page to see his comments otherwise people keep submitting double and triple posts until they realize.
Thanks,
Joseph
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Re: New Comment Validation

Post by Klemen »

You will need to access your server's error logs to figure this one out as nothing is returned to the browser, but instead it just all stops at the server-side.

The "phpinfo" file might be helpful for any extra clues, you will find it in the "read this before posting a new question" topic :wink:

By the way, if you upload the original gbook.php file is the problem still there?
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

Re: New Comment Validation

Post by Henrie »

Hello iosefl,

I have received your files as I asked you on pm. I have tested them on my windows pc.
I tried to test it on my linux NAS server but it seems the latest firmware upgrade broke some functionality. I will have to look into that.
EDIT:
I checked now and it seems the firmware upgrade has added the new possibility to choose which php extensions are active (and guess what, gd was not active by default). I have corrected that now.
You can see the working guestbook at the following address http://henrie.mine.nu/gbook_iosefl/guestbook/gbook.php
The only thing i changed in the settings.php file are the website address and i deactivated the notification e-mails.
END OF EDIT

So I think you should provide the link to the phpinfo.php file on your server. You can download it from the following topic viewtopic.php?f=7&t=83
Download the file from http://www.phpjunkyard.com/extras/phpinfo.zip unzip it and upload it to your server and provide the link here.

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.
iosefl
Posts: 10
Joined: Thu Dec 23, 2010 5:53 pm

Re: New Comment Validation

Post by iosefl »

Hello Henrie,
Thank you for taking the time to try and help me out here.
I entered a comment on your gbook installation and it works as expected so I contacted the support people at my host (IX Webhosting) and had a hard time with the guy on the other end, he ended up asking me to ask you what needs to be changed on the server so the script will work as expected and than let them know so they'll escalate the issue to the server admins to fix it. I don't know if I told you, but I had already a problem to send email notifications at the beginning and when I contacted the support at that time they changed the .htaccess file so suddenly the email sent from the script started working.
I installed the phpinfo.php file at http://wellnessfoods.ca/phpinfo.php and the session_test.php file as well at http://wellnessfoods.ca/session_test.php
I also downloaded the log files, they're pretty full, I did find reference to the gbook.php script, but I don't really know what to look for in the file, I can post the link to the zipped files here or PM you like last time.
Joseph
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Re: New Comment Validation

Post by Henrie »

Hello Joseph,

To be honest, I can't think of anything what could be causing the problems of:
1. The warning messages of blank fields that have not been filled not showing up.
2. The page with the message "Your messages has been submitted" not showing up.

I hope Klemen has some ideas.

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.
iosefl
Posts: 10
Joined: Thu Dec 23, 2010 5:53 pm

Re: New Comment Validation

Post by iosefl »

Hi Henrie,
I think I'll give up, I tried Klemen's suggestion and uploaded the original gbook folder and files to the root of the server http://www.wellnessfoods.ca/gbook/gbook.php (only changed the path to the file on the settings.php file), but still there is no warning message when trying to enter the first guest book comment.
This website is hosted on Windows, if it does make any difference, I tried with setting permissions as per the readme file and without, same result. On this server I do have a WordPress blog, all php files and all working, I even tried installing the Guest Book inside the WordPress directory, same result. I'll try to add a small describing text under the "Submit My Comments" button to invite the user to visit the View Guest Book page after entering the comment because my biggest problem is that users don't know if the comment went through and they try again so I get double comments.
Thank you for all your help so far,
Joseph
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Re: New Comment Validation

Post by Henrie »

I am not that good at php myself. I know the basics, but for me most is trial and error. I just use Google and www.php.net a lot to fix errors.
I have just been busy 3 days myself on learning how to parse an xml file using php.

I am sorry you had to give up on it. It is probably a setting or missing function of the php installed on your server. I still have hope that Klemen might have some ideas about it.

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.
iosefl
Posts: 10
Joined: Thu Dec 23, 2010 5:53 pm

Re: New Comment Validation

Post by iosefl »

Hi Henrie,
Much appreciate all the help you provided, also Klemen's posting earlier, I'm still using the Guest Book script as it is on this server, it does work with the 2 exceptions (no warnings and no display of view comments page after successfully entering a comment), but other than that it does work and we just started an ad campaign which should bring lots of visitors to enter comments in this book. I also received 3 complaints so far of some sort of error when entering the comment, don't know exactly what's the error number, but the comments did go through so I didn't further investigate the type of browser used or error number.
Myself I'm a programmer/analyst using some older/newer languages, but not PHP in particular, so trying my way around just to make it work on this server.
Thanks again for your post,
Joseph
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Re: New Comment Validation

Post by Klemen »

The real problem here is that the actually error is hidden by the server rather than displayed for debugging. I'm afraid that unless I know what the error is I can't be of much help.

Check if there was an error file created in the guestbook folder (usually called "error_log"). Also check the Apache error log again for any signs of php-related errors.
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
iosefl
Posts: 10
Joined: Thu Dec 23, 2010 5:53 pm

Re: New Comment Validation

Post by iosefl »

Hi Klemen,
I think finally I got the error, I had to make changes to .htaccess to display php errors, than I used Safari browser because Firefox didn't show me any error so the error I got is:
PHP Notice: Undefined index: add in
D:\hshome\c292743\wellnessfoods.ca\simplyswitches\guestbook\gbook.php on line 748
This error is displayed on Safari after filling in the comments in the guest book on the host server at:
http://www.wellnessfoods.ca/simplyswitc ... php?a=sign
The comment does go through and there is no validation or message that the comment was successfully entered, I did check line 748 which says:
if ($settings['one_per_session'] && $_SESSION['add'])
This part of code belongs to:
/* This part will help prevent multiple submissions */
if ($settings['one_per_session'] && $_SESSION['add'])
{
problem($lang['e17'],0);
}
I don't understand what is the problem and the same result I get with the original gbook.php file.
I did search on Google and one of the results pointed me back to this forum at this link:
viewtopic.php?f=7&t=3172
In this post the error was at the same line 748, but the poster original complete error message was:
Notice: Undefined index: add in /srv/www/htdocs/jcp/guestbook/gbook.php on line 748 Fatal error: Call to undefined function gzinflate() in /srv/www/htdocs/jcp/guestbook/gbook.php on line 1222
He posted as solved shortly after and he resolved it by installing zlib and all dependencys on the server.
Could this be my problem too and if yes how do you think I can approach the server people to install or check if it's installed (believe me they're not very cooperative when it comes to scripts, they keep saying this is not their issue).
Thank you for any help/pointers.
Joseph
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Re: New Comment Validation

Post by Klemen »

Zlib is installed on your server, so that shouldn't be the problem. The script is working (message gets posted), but your server isn't outputting the generated HTML code.

Let's try this:
1. backup your gbook.php file
2. upload this file to your server:
http://www.phpjunkyard.com/extras/gbook_debug.zip
3. try posting a message - if you get any errors or "Debug" messages let me know exactly what they say.
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
iosefl
Posts: 10
Joined: Thu Dec 23, 2010 5:53 pm

Re: New Comment Validation

Post by iosefl »

I tested with the debug file, this time I used IE (latest version on XP Pro), when i try to submit the comment without entering anything I get an error HTTP 500 and after I fill in all fields and submit the comment I get the same error, but the comment does go through.
I took a screen shot of the actual error and comment and uploaded them:
- error http://www.wellnessfoods.ca/server-error.png
- comment http://www.wellnessfoods.ca/server-comment.png
Please let me know if you need more information and thank you for your help.
Joseph
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Re: New Comment Validation

Post by Klemen »

If you would consider giving me ftp access to your server (just to the guestbook folder) so I can run a couple of test you may send me a private message with the login details.

Other than that I really have no ideas why your server is returning an error, but since comment posting works it must be some server-side setting causing problems.
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
Post Reply