28, May 2012

(The user thought that is) Another bug fix - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Access_user Class (Moderator: Olaf)
Topic: (The user thought that is) Another bug fix
« previous next »
Pages: [1] Print

Author Topic: (The user thought that is) Another bug fix  (Read 2101 times)
Atari ST fan
*
Posts: 7
54 credits
Members referred : 0


« on: Oct 22, 2006, 08:15:32 pm »

OK, found another potential bug/undocumented feature.

In the function create_form_field, change

Code:
if (isset($_REQUEST[$formelement])) {
$form_field .= $_REQUEST[$formelement];
}

to

Code:
if (isset($_REQUEST[$formelement])) {
$form_field .= htmlspecialchars($_REQUEST[$formelement], ENT_QUOTES);
}
« Last Edit: Oct 22, 2006, 10:58:14 pm by olaf »
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


Re: Another bug fix
« Reply #1 on: Oct 22, 2006, 10:56:04 pm »

OK, found another potential bug/undocumented feature.

In the function create_form_field, change

Code:
if (isset($_REQUEST[$formelement])) {
$form_field .= $_REQUEST[$formelement];
}

to

Code:
if (isset($_REQUEST[$formelement])) {
$form_field .= htmlspecialchars($_REQUEST[$formelement], ENT_QUOTES);
}

OK, and why do you think that this is a bug? it works fine without "htmlspecialchars"

a bug is about somthing that doesn't work right, you are accepting somthing different, thats called suggesting an approvement Wink

Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #2 on: Oct 22, 2006, 10:57:32 pm »

and at the end the test is not OK, better is

if (!empty($_REQUEST['var'])) {...

hehe

Atari ST fan
*
Posts: 7
54 credits
Members referred : 0


« Reply #3 on: Oct 23, 2006, 09:38:02 pm »

haha, you're the one that used that test in the first place.

having htmlspecialchars just makes sense though. If the person uses a quote or something else, the new page WILL break, and leave a bad impression. Best to make it a little more foolproof.
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #4 on: Oct 23, 2006, 09:44:10 pm »

haha, you're the one that used that test in the first place.

having htmlspecialchars just makes sense though. If the person uses a quote or something else, the new page WILL break, and leave a bad impression. Best to make it a little more foolproof.
Of course your suggestion is not bad but don't tell people that this is a bug while it's based on you personal opinion.
At the end this small details are up to the user, believe me if I use this class for a wide public I use more validation than only some basic html function. Check this class for real validation: http://www.finalwebsites.com/snippets.php?id=15

Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=4515
Tags : html Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Access_user Class (Moderator: Olaf)
Topic: (The user thought that is) Another bug fix
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 05:22:46 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.