限制密码字符

i have a simple question..

in registration script.. how can i set the limit character of a password. sample: minimum character is 6.. so what will be the code. please help me. :-(

Javascript code:

var el = document.getElementById('field_id');

if (el.value.length >= 6)
{
  alert('OOps');
}

PHP Code:

if (strlen($_POST['field_name']) >= 6)
{
  // more than six chars entered !!
}

Use the strlen() function...

function check_pass($pass, $min = 6)
{
    return (strlen($pass) >= $min);
}

Are you looking for this?

if (strlen($pw) >= 6)

Note that you have to do this, before encrypting with md5

<?php
$str = 'abcdef';
echo strlen($str); // 6

$str = ' ab cd ';
echo strlen($str); // 7


if (strlen($str) > 5 AND strlen($str) < 10) {
   echo "OK"
}
?>