Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2007
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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)

  • #2
    Senior Coder
    Join Date
    Mar 2003
    Location
    Atlanta
    Posts
    1,037
    Thanks
    14
    Thanked 30 Times in 28 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •