You can look at the source for the javascript on the JQuery or the main part here:
// validate signup form on keyup and submit
var validator = $("#Register").validate({
rules: {
UserID: {
required: true,
minlength: 2,
remote: {
url: "form_check_user.php",
type: "post",
}
},
....
So it POSTs to form_check_user.php UserID=ValueFromForm
Here is the form_check_user.php code:
<?
if ($_POST['UserID']) {
$User = strtolower($_POST['UserID']);
$htpasswd_array = file("/etc/passwd");
$pattern = "/^$User:/";
foreach ($htpasswd_array as $key => $value) {
if (preg_match($pattern, $value)) {
echo "false";
exit;
}
}
echo "true";
exit;
}
echo "false";
exit;
?>
The function works as it should, I try to use a UserID as root or any valid linux user and it detects that its invalid…
The problem comes if you enter “root” in…It says it’s invalid…and you still tab to the next form it then shows [object Object] is already in use
Edit: Should probably include this, as the message seems to be part of the problem:
messages: {
UserID: {
required: "Enter a username",
minlength: jQuery.format("Enter at least {0} characters"),
remote: jQuery.format("{0} is already in use")
},
Update: 8/20
I have confirmed this is a bug in the validation plugin after debugging. (Althought I get lost where the error occurs, I know it has nothing to do with my response.)
I think I found the bug;
Validation has:
message = message.call(this, rule.parameters, element);
This should be:
message = message.call(this, message.parameters, element);
after that fix, everything seems to be OK. I am new to JQuery and debugging javascript, so it may need to be tested more throughly but I think that was the problem.
I have emailed the developer of the plugin this fix (I noticed multiple issues with his bug in his tracker and on the JQuery forums)