password validation questions
<p>I am coding a registration system. I decided to encrypt the passwords and let the users use whatever they want in their passwords, including spaces.</p>

<p>The only restrictions would be:
- no spaces at the start or end of password
- min 5 char and max 30 characters</p>

<pre><code>// CHECK PASSWORD    
    } elseif ((substr($password, 0, 1) == " " || substr($password, -1, 1) == " ")){ 
        $msg = "You cannot have a space in the beginning or end of your password.";

    } elseif (strlen($password) &gt; 30)) {
        $msg = "Your password cannot be longer than 20 characters.";


    } elseif (strlen($password) &lt; 5)) {
        $msg = "Your password cannot be shorter than 5 characters.";
</code></pre>

<p>Is that enough? </p>

<p>I'll also take this chance to ask how should I treat the password before and after encrypting it. Should I just encrypt it and then escape it?</p>
