Page 1 of 1

Bad characters in name entry field AND problems in Safari

Posted: 19 Apr 2010, 14:01
by jennyjeffreys
Is it possible to get the name entry field to accept hyphens? At the moment it won't accept double-barrelled names.

If this is not possible I would like to edit the en-GB.com_phocaguestbook.ini file so that the error message "The name you have entered contains bad characters" is more specific and says "Sorry, we cannot accept hyphens in your name". Otherwise the guest doesn't know what he has done wrong. However, when I change the permissions of the file, it still will not allow me to edit the file. I have tried downloading and editing in notepad but when you save the file it does keep the right configuration format. Any idea how I can edit this file if I am not able to get the field to accept the hyphens?

ALSO I have a problem running Guestbook in Safari. The main screen drops to allow an error code in the background at the top of the screen, reading:

', 'moduletable-hilite2', 'module-hilite3', 'moduletable-hilite3', 'module-hilite4', 'moduletable-hilite4', 'module-hilite5', 'moduletable-hilite5', 'module-hilite6', 'moduletable-hilite6', 'module-hilite7', 'moduletable-hilite7', 'module-hilite8', 'moduletable-hilite8', 'module-hilite9', 'moduletable-hilite9', 'module-clean', 'moduletable-clean', 'submenu-block', 'moduletable_menu']; var header = "h3"; RokBuildSpans(modules, header); });

---some of the code from a CSS file which I haven't managed to find yet! Any ideas what is causing this? It only happens in Safari.

Re: Bad characters in name entry field AND problems in Safar

Posted: 26 Apr 2010, 18:52
by Jan
Hi, the css you added here, is not from Phoca Guestbook,

try to search extensions which can include this: "... RokBuildSpans ..." as this is displayed in code :idea:

Re: Bad characters in name entry field AND problems in Safar

Posted: 06 Jun 2010, 04:29
by Klementz
jennyjeffreys wrote:Is it possible to get the name entry field to accept hyphens? At the moment it won't accept double-barrelled names.
You can edit com_phocaguestbook/controllers/phocoguestbook.php

Find this line:

Code: Select all

if ($username != 0 && eregi( "[\<|\>|\"|\'|\%|\;|\(|\)|\&|\+|\-]", $post['username']))
and change it to this:

Code: Select all

if ($username != 0 && eregi( "[\<|\>|\"|\'|\%|\;|\(|\)|\&|\+]", $post['username']))
You need to remove the pipe character |, the escape character \, and the symbol you don't want checked for. I also took out the left and right brackets. Note that this line of code appears twice within a dozen lines of each other. I changed them both, and it works fine.

Re: Bad characters in name entry field AND problems in Safar

Posted: 07 Jun 2010, 10:17
by jennyjeffreys
Thanks, that worked great! Not sure where the left and right brackets are that you refer to, but I removed the last three characters including the hyphen and it worked perfectly.

We have a lot of people with double-barrelled names here so they can now fill in the guestbook with no problems.

Re: Bad characters in name and title field

Posted: 24 Feb 2011, 07:30
by snelson
I've had a user complain of getting this error (The name you have entered contains bad characters) when trying to post an entry in the Guestbook. I repeated the problem and narrowed this case down to an undesired apostrophe in the word Can't.

I attempted to implement the fix in this post and couldn't because
com_phocaguestbook/controllers/phocoguestbook.php
no longer contains the lines of code mentioned below.

Any ideas?

Klementz wrote:
jennyjeffreys wrote:Is it possible to get the name entry field to accept hyphens? At the moment it won't accept double-barrelled names.
You can edit com_phocaguestbook/controllers/phocoguestbook.php

Find this line:

Code: Select all

if ($username != 0 && eregi( "[\<|\>|\"|\'|\%|\;|\(|\)|\&|\+|\-]", $post['username']))
and change it to this:

Code: Select all

if ($username != 0 && eregi( "[\<|\>|\"|\'|\%|\;|\(|\)|\&|\+]", $post['username']))
You need to remove the pipe character |, the escape character \, and the symbol you don't want checked for. I also took out the left and right brackets. Note that this line of code appears twice within a dozen lines of each other. I changed them both, and it works fine.

Re: Bad characters in name entry field AND problems in Safar

Posted: 25 Feb 2011, 00:48
by Jan
Hi, this ' is removed because of possible security problems, usernames cannot include this characters: '

Jan

Re: Bad characters in name entry field AND problems in Safar

Posted: 27 Feb 2011, 12:38
by jennyjeffreys
What are the security problems you mention? Does it make you more susceptible to spam entries?

We get a lot of unwanted registrations in the guestbook which we have tried to block using the Captcha options, but these do not seem to work.

We tried making it only possible for registered users to sign the guestbook but this takes longer and deters people from signing up.

So now we get them to use a simple contact form and we post them ourselves.

This is a great component - it's just a shame we can't block all the spam entries.

Re: Bad characters in name entry field AND problems in Safar

Posted: 02 Mar 2011, 12:57
by margae
Just installed version 1.4.4. and received the message "The name you have entered contains bad characters" when entering a title with an apostrophe in it.
After some searching, I found the following code in /controllers/phocaguestbook.php:

Code: Select all

			if ($username != 0 && preg_match("~[\<|\>|\"|\'|\%|\;|\(|\)|\&|\+]~",$post2['title'])) {
After changing it to

Code: Select all

			if ($username != 0 && preg_match("~[\<|\>|\"|\'|\%|\;|\(|\)|\&|\+]~",$post2['username'])) {
the error no longer appeared.
It looks like the title was used as input for checking the username!

Hope this helps.

Marga

Re: Bad characters in name entry field AND problems in Safar

Posted: 02 Mar 2011, 22:47
by Jan
Hi, thank you for the info.

Jan