Using Remote on validation plugin

Using Remote on validation plugin

Hello,

I am trying to ckeck if the username is already tacken.

  1.   rules: {
           username: {
              required: true,
              maxlength: 20,
              remote: {
            url: "verifusername.php",
            type: "post",
              },






verifusername.php file:
  1. $file = ''.$_SERVER["DOCUMENT_ROOT"].'/dbconnect.php';
    if (file_exists($file)) include($file);

    if(isset($_POST['username']))
    {
    $user = ucfirst(strtolower(trim(htmlspecialchars(mysql_real_escape_string($_POST['username'])))));

    // VERIFICATION
    $result = mysql_query('SELECT user FROM members WHERE user="'.$user.'"');

    if(mysql_num_rows($result)>=1)
            {
            return TRUE;
            }
    else
            {
            return FALSE;
            }

    }
    else
    {
    return FALSE;
    }
    mysql_free_result($result);
    mysql_close($db);
























The problem is that the script always return that username already in use...

Why?

Thx