Gossamer Forum
Home : Products : DBMan : Customization :

Checking for spaces in a value...

Quote Reply
Checking for spaces in a value...
I have some testers hitting my db trying to crash it. One of the users came to a standstill when he went to change his UserID (I created a Mod to let a user change their login ID, to go along with the change password and change e-mail address). He put a space in the login ID (e.g: Cpl Miller instead of CplMiller) then he couldn't log back in. I'm assuming it's because of the space. How do I check the input for spaces? I have the check in place for A-Z,0-9 characters only. While I'm descent in Perl, I've always hated trying to write a value check.

Here are the value checks I have:
$in{'userid'} =~ /^[a-zA-Z0-9]+$/ #Check for A-Z,0-9 characters only
$in{'email'} =~ /.+\@.+\..+/ #Check for valid e-mail format

What would I find a space in a value?
$in{'userid'} =~

Thanks for any help...
AJ

Quote Reply
Re: Checking for spaces in a value... In reply to
$in{'userid'} =~ /^[a-zA-Z0-9]+$/;

I could be wrong, but I thought the above exp. was supposed to allow those characters only and stop spaces and slashes etc in the username.

Do you have something like

unless (($in{'userid'} =~ /^[a-zA-Z0-9]+$/)) {do this }


rog




Quote Reply
Re: Checking for spaces in a value... In reply to
I just figured out what it was. When I checked for A-Z,0-9 in the subroutine, I wasn't checking the correct $in{} name being passed from the form. I had it set to 'userid' when it should have been 'uname'.

Thanks rog for responding so quickly.

AJ

Quote Reply
Re: Checking for spaces in a value... In reply to
AJ,

No problem, glad you sorted it.

rog



Quote Reply
Re: Checking for spaces in a value... In reply to
In Reply To:
I created a Mod to let a user change their login ID, to go along with the change password and change e-mail address.
I think this is a mistake to do, which is why I did not include it in my mod.

JPD
Quote Reply
Re: Checking for spaces in a value... In reply to
I personally don't want it either, but I have written a mod to create over 32,000 accounts with random username/password combos. I have to give them the opportunity to change their info without having all 32,000 e-mailing me to change their username!!

What problem(s) did you have, or why do you think it's a mistake?

AJ