Hello friends,

I'm in a serious problem....... I have a change password application for registered users......I've applied javascript to check wheather fields are blanks or not but incase if someone press spacebar in new password and retype new password fields then it accept it . Now I want to block if someone try to press spacebar in new password cases.........please help to solve this error.......

<form method='post'>
Username: <input type='text' value='' name='user'><br>
Password: <input type='text' value='' name='password'><br>
</form>

Well there are 2 main easy ways that you can do the activation process. Assuming above is the form you allready have, then if you just want to check there is only a space used or no password at all then the below lines of code will work:

<?
if ($_POST['password']!==' ' && strlen($_POST['password'])>0 && isset($_POST['password']))
    {
    //activate account
    }
?>

Or you could just set a minimum password length of something like 8 letters/numbers/characters which is done like the following:

<?
$minimum_length=8;
if (strlen($_POST['password'])>=$minimum_length && isset($_POST['password']))
    {
    //activate account
    }
?>

Someone plzzzzzzzzz reply.................

Thanks man it works........

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.