Jump to content

Php Trim() On User Input.


WebhostingNZ.com

Recommended Posts

Hey,

 

I think it would be handy if user input was run past php trim() before being processed, at least for the search if not everywhere.  I've been trying to think how this could cause a problem but for the last few days I've come up with nothing, just many more times I've been caught out by having a space at the start of a copy/paste into the search box.

 

The search in the top right corner will not find what you are looking for if you copy/paste and catch a space, or tab at the start or end of your copy

 

trim() would also be handy on domain input for the cPanel module, that one caught me a few times when adding a few services.  In the end I added it to my import script to do it first, but got caught out on a few I had to put in manually.

 

This is again a small thing and it's simple to find/remove the space at the start but still a valid feature request as I would have thought it should have already been in. 

 

No flaming for silly feature requests.... I understand that my feature requests are trivial and there are much better things for devs to spend time on, but the only way to better the product is to point out places that I feel could be improved on.

 

Thanks.

Link to comment
Share on other sites

trim() is a must on every user input, not only in search box.

 

Imagine this scenario (reral life experience):

- user change his password

- he copies and paste it from a password generator, and for mistake gets a space too

 

Result: he locks himself out from the system, because his password is not the one he think, but the one he think plus a space

Link to comment
Share on other sites

I believe some searches already remove extra white-space. Which search type is problematic for you?

Hi Tyson,

 

Mostly the Client and Service search would be good to have a trim() on them.  I've just checked both and both have problems with a whitespace at the start or end.  Normally it's when a customer emails in their domain or mentions the account is under xxxx and you copy paste it into the search.

Link to comment
Share on other sites

Hi Tyson,

 

I do agree with you, while I understand Remitur's example, space is a valid char and should be able to be used in a password.  

 

I don't know how many systems allow space as valid character for a password...  but putting a space at the end of a password may be a bad joke to a collegue, or a way to drive crazy someone we hate... :D

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...