-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhi.js
166 lines (154 loc) · 6.11 KB
/
hi.js
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
function openNav() {
document.getElementById("sideNavigation").style.width = "250px";
document.getElementById("main").style.marginLeft = "250px";
}
function closeNav() {
document.getElementById("sideNavigation").style.width = "0";
document.getElementById("main").style.marginLeft = "0";
}
function b64(){
var x=document.getElementById("b64").value;
document.getElementById("b64").value=btoa(x);
getLength()
}
function d64(){
var x=document.getElementById("b64").value;
document.getElementById("b64").value=atob(x);
getLength()
}
function urlencode(b){
var x=document.getElementById("b64").value;
if(b==0){
document.getElementById("b64").value=encodeURI(x);
}else{
document.getElementById("b64").value=encodeURIComponent(x);
}
getLength()
}
function urldecode(b){
var x=document.getElementById("b64").value;
if(b==0){
document.getElementById("b64").value=decodeURI(x);
}else{
document.getElementById("b64").value=decodeURIComponent(x);
}
getLength()
}
function upperAndLower(b){
var x=document.getElementById("b64").value;
if(b==0){
document.getElementById("b64").value=x.toLocaleUpperCase();
}else{
document.getElementById("b64").value=x.toLocaleLowerCase();
}
getLength()
}
function reverseString() {
var x=document.getElementById("b64").value;
document.getElementById("b64").value=x.split("").reverse().join("");
}
function getLength(){
var x=document.getElementById("b64").value;
document.getElementById("id_length").value=x.length;
}
function xacdinh(){
document.getElementById("ngay").innerHTML=Date();
var d=new Date();
if(d.getDay()==0){
document.getElementById("cn").className="hii"}
else if(d.getDay()==1){document.getElementById("t2").className="hii";}
else if(d.getDay()==2){document.getElementById("t3").className="hii";}
else if(d.getDay()==3){document.getElementById("t4").className="hii";}
else if(d.getDay()==4){document.getElementById("t5").className="hii";}
else if(d.getDay()==5){document.getElementById("t6").className="hii";}
else if(d.getDay()==6){document.getElementById("t7").className="hii";}
}
function conV(x,y){
z=0;
v=x.length-1;
for(i=0;i<=v;i++){
a=x[i];
if(x[i]=="a"){a="10";}
if(x[i]=="b"){a="11";}
if(x[i]=="c"){a="12";}
if(x[i]=="d"){a="13";}
if(x[i]=="e"){a="14";}
if(x[i]=="f"){a="15";}
z+=Number(a)*Math.pow(y,v-i);
}
document.getElementById("deci").value=z;
document.getElementById("bina").value=(z).toString(2);
document.getElementById("hexa").value=(z).toString(16);
document.getElementById("octa").value=(z).toString(8);
}
function hexa(){
x=document.getElementById("hexa").value;
conV(x,16);
}
function octa(){
x=document.getElementById("octa").value;
conV(x,8);
}
function bina(){
x=document.getElementById("bina").value;
conV(x,2);
}
function deci(){
x=document.getElementById("deci").value;
conV(x,10);
}
function dkdn(x){
if(x==0){
$("#fieldset").html('<p class="dangnhap" style="color:white">Họ Tên</p><input class="dangnhap" type="text" id="ten" required ><p class="dangnhap" style="color:white">Tài Khoản</p><input class="dangnhap" type="text" id="taiKhoanDk" ><p class="dangnhap" style="color:white">Mật Khẩu</p><input class="dangnhap" type="password" id="passDk" required ><p class="dangnhap" style="color:white">Nhập Lại Mật Khẩu</p><input class="dangnhap" type="password" id="repassDk" required><p class="dangnhap" style="color:white">Email</p><input type="email" id="email" class="dangnhap" required><input align="center" type="submit" value="Đăng Ký" class="xacnhan" style="margin-left:32px" onclick="dk()"><a style="font-size:15px" href="#" onclick="dkdn(1)">Đăng Nhập !</a>');
}else if(x==1){
$("#fieldset").html('<form action="../test/dndk/dangnhap.php" method="POST"><p class="dangnhap" style="color:white">Tài Khoản</p><input class="dangnhap" type="text" name="taiKhoanDn" ><p class="dangnhap" style="color:white">Mật Khẩu</p><input class="dangnhap" type="password" name="passDn" ><input name="sub2" align="center" type="submit" value="Đăng Nhập" class="xacnhan" style="margin-left:32px"></form><a href="#" style="font-size:15px" onclick="dkdn(0)" id="dangky">Đăng ký !</a>');
}
}
function toHex(s) {
// String to hex
var s = unescape(encodeURIComponent(s))
var h = ''
for (var i = 0; i < s.length; i++) {
h += s.charCodeAt(i).toString(16)
}
return h
}
function dk(){
//var data=new FormData($('#'))
$('#taiKhoanDk').css( "border", "1px solid white" );
$('#passDk').css( "border", "1px solid white" );
$('#repassDk').css( "border", "1px solid white" );
$('#ten').css( "border", "1px solid white" );
$('#email').css( "border", "1px solid white" );
$.ajax({
url : "../test/dangky.php",
type : "post",
dataType:"json",
data : {
sub1:"Đăng ký",
taiKhoanDk:$('#taiKhoanDk').val(),
passDk:$('#passDk').val(),
repassDk:$('#repassDk').val(),
ten:$('#ten').val(),
email:$('#email').val(),
},
success : function (result){
//$('#result').html(result);
// var t="";
//t+="'"+result+"'";
//var obj=JSON.parse(t);
//$('#result').html(t);
//if(obj.tk=='1'){$('#result').html("chưa nhập tên tài khoản");}
//$.each(result,function(key,item){
//;
//});
if(result.success=='1'){
$("#fieldset").html('<p style="padding-left:32px;color:white;">Đăng ký thành công!!^-^</p><a style="font-size:15px" href="#" onclick="dkdn(1)">Đăng Nhập !</a>') ;
}else{
if(result.tk=='1'){$('#taiKhoanDk').css( "border", "1px solid red" );}
if(result.mk=='1'){$('#passDk').css( "border", "1px solid red" );$('#repassDk').css( "border", "1px solid red" );}
if(result.ten=='1'){$('#ten').css( "border", "1px solid red" );}
if(result.email=='1'){$('#email').css( "border", "1px solid red" );}
}
}
});}