Ответов: 60 Просмотров: 0
|
/!\ Последнюю версию мода (доработанную, на русском языке) Вы можете найти здесь!
Hi,
to check registration form in real time (with AJAX), make this change:
in the front of agreed.tpl add this code:
CODE:<script type="text/javascript" language="JavaScript">
<!--
function checkUsername(username,area) {
JsHttpRequest.query('jsloader.php?loader=verify', {action: area, value: username}, function(data,text) {
document.getElementById('checkusername').innerHTML=text;
}, false);
}
function checkPassword(password,area) {
JsHttpRequest.query('jsloader.php?loader=verify', {action: area, value: password}, function(data,text) {
document.getElementById('checkpassword').innerHTML=text;
}, false);
}
function checkMail(email,area) {
JsHttpRequest.query('jsloader.php?loader=verify', {action: area, value: email}, function(data,text) {
document.getElementById('checkmail').innerHTML=text;
}, false);
}
//-->
</script>
and change the input line of username, password and e-mail, so:
CODE:<td class="profilright"><input onblur="checkUsername(this.value,'username');" type="text" style="width: 200px" size="35" maxlength="20" name="inmembername"> <span id="checkusername"></span></td>
CODE:<td class="profilright"><input onblur="checkPassword(this.value,'password');" type="text" size="20" name="password" maxlength="16"> <span id="checkpassword"></span></td>
CODE:<td class="profilright"><input onblur="checkMail(this.value,'email');" type="text" name="emailaddress" style="width: 200px" size="20" maxlength="255"> <span id="checkmail"></span></td>
In the jsloader.php, found
CODE:if ($fm->input['loader'] === 'karma'){
and replace with
CODE:if ($fm->input['loader'] === 'verify'){
if ($fm->input['action'] === 'username') {
if ($fm->input['value'] == '') {
echo "<img src='./images/wrong.png' border='0'> <span class='warning'>".$fm->LANG['ErrUsernameEmpty']."</span>";
die();
}
$allusers = $fm->_Read('./data/users.php',FALSE);
$user_id = 0;
foreach ($allusers as $u_id=>$info) {
if ($fm->input['value'] == $info['n']) {
$user_id = $u_id;
break;
}
}
$_RESULT["error"] = 0;
if ($user_id != 0) echo "<img src='./images/wrong.png' border='0'> <span class='warning'>".$fm->LANG['ErrUsernameUsed']."</span>";
else echo "<img src='./images/ok.png' border='0'> <span class='ok'>".$fm->LANG['ErrUsernameOk']."</span>";
} elseif ($fm->input['action'] === 'email') {
if ($fm->_Chek_Mail('value') === FALSE) echo "<img src='./images/wrong.png' border='0'> <span class='warning'>".$fm->LANG['ErrEmailWrong']."</span>";
else echo "<img src='./images/ok.png' border='0'> <span class='ok'>".$fm->LANG['ErrEmailOk']."</span>";
} elseif ($fm->input['action'] === 'password') {
if (strlen($fm->input['value']) < 6 ) echo "<img src='./images/wrong.png' border='0'> <span class='warning'>".$fm->LANG['ErrPasswordWrong']."</span>";
else echo "<img src='./images/ok.png' border='0'> <span class='ok'>".$fm->LANG['ErrPasswordOk']."</span>";
}
} elseif ($fm->input['loader'] === 'karma'){
add this to style.css
CODE:.warning {color: red;}
.ok {color: green;}
add this line to lang_front_all.php
CODE:$this->LANG['ErrUsernameOk'] = 'Username available';
$this->LANG['ErrUsernameUsed'] = 'Username already used by other user';
$this->LANG['ErrUsernameEmpty'] = 'Username MUST be filled!';
$this->LANG['ErrEmailOk'] = 'E-mail OK';
$this->LANG['ErrEmailWrong'] = 'E-mail not valid !';
$this->LANG['ErrPasswordOk'] = 'valid password';
$this->LANG['ErrPasswordWrong'] = 'password not valid';
Here a demo:
http://www.bitlibero.com/flatbb/...x.php?s=register
This is a screenshot: |