-
Notifications
You must be signed in to change notification settings - Fork 89
/
win_reg.html
111 lines (105 loc) · 3.29 KB
/
win_reg.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<div class=modal_main>
<div class=modal_div>
<h2>%l10n_msg_reg%</h2>
<form id=frm_reg method=post>
<table>
<tr><td>%l10n_str_invite%</td><td><input type=text name=invite></td><td id=checkinv></td></tr>
<tr><td>%l10n_str_login%</td><td><input type=text name=login></td><td id=checklogin></td></tr>
<tr><td>%l10n_str_nick%</td><td><input type=text name=nick></td><td id=checknick></td></tr>
<tr><td>%l10n_str_pass%</td><td><input type=password name=password></td><td id=checkpass></td></tr>
<tr><td align=right>
<input type=checkbox id=accept_rules onclick="$('#frm_reg').find('input[type=button]').prop('disabled', !this.checked)" />
</td><td colspan=2 style="font-size: 12px"><label for=accept_rules>%l10n_str_accept_rules%</label></td></tr>
<tr><td colspan=2 align=center id=regstat style="font-size: 13px; padding-top: 0px; max-width: 250px"></td></tr>
<tr><td>
<input type=button value="%l10n_btn_reg%" onclick="doReg()" disabled /></td>
<td align=right><a href="javascript://" onclick="showFrm('#win_login')">%l10n_str_has_login%</a></td></tr>
</table>
</form>
</div>
</div>
<script type="text/javascript">
$('#frm_reg :input').keydown(function(e) { if (e.keyCode==13) doReg(); });
$('#frm_reg :input[name=invite]').keyup(function(e)
{
$('#checkinv').empty();
$('#checklogin').empty();
$('#checknick').empty();
});
var reglog = $('#frm_reg :input[name=login]');
var regnick = $('#frm_reg :input[name=nick]');
function check_reg()
{
var inv = $('#frm_reg :input[name=invite]').val();
if (inv == '')
{
$('#checkinv').html('<img src="img/no.png">');
$('#checklogin').empty();
$('#checknick').empty();
return;
}
var chk_test = '';
var chk_l = reglog.val();
if (chk_l == '')
$('#checklogin').empty();
else
chk_test += '&login=' + encodeURIComponent(chk_l);
var chk_n = regnick.val();
if (chk_n == '')
$('#checknick').empty();
else
chk_test += '&nick=' + encodeURIComponent(chk_n);
if (chk_l == '' && chk_n == '')
{
$('#checkinv').empty();
return;
}
$.post('user.php?a=testreg', 'invite='+encodeURIComponent(inv)+chk_test, function(json)
{
if (json.error == 'invite')
{
$('#checkinv').html('<img src="img/no.png">');
$('#checklogin').empty();
$('#checknick').empty();
}
else if (json.error == 'login')
{
$('#checkinv').html('<img src="img/ok.png">');
$('#checklogin').html('<img src="img/'+(json.result ? 'ok' : 'no')+'.png">');
$('#checknick').empty();
}
else if (json.error == 'nick')
{
$('#checkinv').html('<img src="img/ok.png">');
if (chk_l != '')
$('#checklogin').html('<img src="img/ok.png">');
$('#checknick').html('<img src="img/'+(json.result ? 'ok' : 'no')+'.png">');
}
else
{
if (json.result)
{
$('#checkinv').html('<img src="img/ok.png">');
if (chk_l != '')
$('#checklogin').html('<img src="img/ok.png">');
if (chk_n != '')
$('#checknick').html('<img src="img/ok.png">');
}
else
{
$('#checkinv').empty();
$('#checklogin').empty();
$('#checknick').empty();
}
}
});
}
reglog.keyup(check_reg);
regnick.keyup(check_reg);
var regpass = $('#frm_reg :input[name=password]');
regpass.keyup(function(e)
{
var chk = regpass.val();
$('#checkpass').html(chk == '' ? '' : '<img src="img/'+(chk.length < 6 || chk.length > 100 ? 'no' : 'ok')+'.png">');
});
</script>