Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 05-09-2005, 01:36 PM Validating submitted values from a registration form
HitRaj47's Avatar
Extreme Talker

Posts: 177
Location: GA
Trades: 0
I'm currently writing a register script (where users register for an account on my site).

I want to check the username, password and email.

only letters [both upper and lower] and underscores (_) are allowed for the username no spaces are allowed

only letters [both upper and lower] and numbers allowed for the password and again no spaces are allowed.

and i want to check if the email is a proper email address, so the user cant submit something like aslfdjhgk for the email

Last edited by HitRaj47; 05-09-2005 at 02:07 PM..
HitRaj47 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-09-2005, 04:14 PM
desertland's Avatar
Skilled Talker

Posts: 86
Trades: 0
The only real, guaranteed way to verify the email address is to do a 2-step registration. You'd have to send a confirmation email to the email address specified by the user, and then have them click on a link in the email to verify the registration.

You can do "simple" verification on email addresses by making sure they're [some characters][@][more characters][.][more characters], but that would allow asfdjsd@asfdsdf.com, for example.
__________________
I store my recipes online (the way nature intended) at
Please login or register to view this content. Registration is FREE
desertland is offline
Reply With Quote
View Public Profile
 
Old 05-10-2005, 07:06 AM
ibbo's Avatar
Super Spam Talker

Posts: 880
Location: Leeds UK
Trades: 0
The 2 step appraoch is by far the most sucessfull.

You can fiddle with the getmxrr method or the try connecting to the mail server with a socket but even with these two methods it sometimes failes on valid emails.

So I send them a confirmation email with an activation link.

No activation within a month they get an email, still no activation then drop that row.

Ibbo
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Linux user #349545 :
(GNU/Linux)iD8DBQBAzWjX+MZAIjBWXGURAmflAKCntuBbuKCWenpm XoA7LNydllVQOwCf
ibbo is offline
Reply With Quote
View Public Profile Visit ibbo's homepage!
 
Old 05-10-2005, 08:02 AM
HitRaj47's Avatar
Extreme Talker

Posts: 177
Location: GA
Trades: 0
thanks

what about validating the username and password submitted, im a bit of a n00b to php so i dont know what code to use.

regular expressions? dont know how to use them

also how could i automatically get php to remove the user if the email isnt validated after a certain period of time?
HitRaj47 is offline
Reply With Quote
View Public Profile
 
Old 05-10-2005, 08:33 AM
ibbo's Avatar
Super Spam Talker

Posts: 880
Location: Leeds UK
Trades: 0
Well for the username I stick to this rule.

A it must be over 6 chars long, B it must not start with any numbers or non alpha chars.

so if(strlen($user) < 6) || preg_match('/^[0-9][!|"|£|$|%|^|&|*|(|)|_|-/', $user)) { fail }

Same applies to the password though I let them use anything in a pass so long as it is over 6 chars long.

When your user register they get a registration date with there details. As you go through adding users/ polling for results you can add that xtra overhead by checking for out of date accounts. if say its over a month since registering and they have not activated then drop that row.

Of course you need to be a bit smarter and first of all send out a last chance email.

If then they dont respond to that then drop it.

Ibbo
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Linux user #349545 :
(GNU/Linux)iD8DBQBAzWjX+MZAIjBWXGURAmflAKCntuBbuKCWenpm XoA7LNydllVQOwCf
ibbo is offline
Reply With Quote
View Public Profile Visit ibbo's homepage!
 
Reply     « Reply to E-mail validation
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.21507 seconds with 12 queries