Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-29-2007, 10:53 AM   PM User | #1
jeffry
New Coder

 
Join Date: Jan 2007
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
jeffry is an unknown quantity at this point
Validation Doubts in Change password code

I posted some queries earlier.Thankx all those who answered and helped me.
Here i have a doubt in my code for changing password.

Anyone please show my how to write 'if' condition for keeping the password to a limited number of characters.According to my code,it only checks whether the password fields(old,new,confirm) are empty and if not it proceeds with database comparison and if exists it get changed with the new password.

The script i am using for checking blank entry is:

if(empty($_POST['username']))
{
echo "Username is empty";
}
else
{
$un=$_POST['username'];
}

I want it to be checked that every password should be minimum 4 characters and maximum 8 character in length and atleast one special character should be present
(like @,!,~,$,%,etc).

Please provide me other such conditional scripts in PHP for checking numeric fields for pincode,phone no etc and characters for name,username etc and I want DOB to be entered as eg:-"27 Mar" etc.

Please provide me those scripts:
(i am not asking for javascripts.plz dont mis-understand)
jeffry is offline   Reply With Quote
Old 01-29-2007, 11:19 AM   PM User | #2
StupidRalph
Senior Coder

 
Join Date: Mar 2003
Location: Atlanta
Posts: 1,037
Thanks: 14
Thanked 30 Times in 28 Posts
StupidRalph is on a distinguished road
Have a look into these functions.

strlen()
stripos()

You could add an additional if statement in there to check the string length then if its an appropiate length. You can then check for the special character. Using something like stripos. Depending on what you deem acceptable as a special character you might have to define an array or something w/ allowable special characters.
__________________
Most of my questions/posts are fairly straightforward and simple. I post long verbose messages in an attempt to be thorough.
StupidRalph is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 11:39 AM.


Advertisement
Log in to turn off these ads.