Use JavaScript to encrypt your site

Source: Internet
Author: User
Tags window
Javascript| encryption We often encounter websites that have to enter a username and password to enter. In fact, we can also do a simple encryption of their website page, the specific operation please see below:

First step: Create a password login page
Add the following code to the 〈body〉 area of HTML:
<script language= "JavaScript" >
<!--
Flag=0
Flag2=0
-->
</script>
<script language= "JavaScript" src= "password.txt" >//Password table files
</script>
<script language= "JavaScript" src= "password1.txt" >//Password Authentication file
</script>
&LT;H1 align= "center" >Login<script language= "JavaScript" >
<!--
function Main ()
{
member = Document.all.username.value
pass = Document.all.password.value
Encryption ()
Password ()
}
-->
</script>
<p> Enter user name: <input type= "TEXT" id= "username" size= "><br>"
Please enter the password: <input type= "PASSWORD" id= "PASSWORD" size= ">"
<input type= "button" id= "button" value= "enter!" align= "center" ></p>

Step two: Edit the file 1 (password.txt) and file 2 (password1.txt), respectively, for your own page situation, mainly: password settings and user name settings.
file 1:password.txt
A password table, a look at the understanding, there is no difficulty. Be free to design, pay attention to the difference between the case.
function encryption ()
{
MM = "Z"
K = "J"
b = "P"
Mmmm = "&"
CCC = "6"
L = "I"
c = "Q"
m = "s"
ABCD = "M"
o = "n"
u = "Z"
E = "D"
GG = "U"
p = "U"
JJ = "O"
v = "a"
j = "Y"
x = "C"
r = "N"
bb = "D"
CC = "K"
z = "W"
A = "X"
EE = "G"
n = "F"
FF = "T"
i = "g"
W = "R"
II = "V"
KK = "I"
Q = "O"
oooo = ")"
D = "E"
nn = "E"
oo = "P"
pp = "X"
t = "H"
s = "V"
rr = "S"
SS = "L"
tt = "R"
UU = "A"
h = "K"
VV = "C"
WW = "M"
AA = "Y"
xx = "Q"
HH = "B"
yy = "H"
ZZ = "W"
y = "T"
QQ = "J"
AAA = "8"
BBB = "0"
f = "B"
DDD = "9"
eee = ""
FFF = "3"
DD = "N"
GGG = "4"
HHH = "1"
III = "2"
JJJ = "7"
KKK = "5"
LLL = "."
mmm = ","
nnn = ";"
ooo = ":"
PPP = "'"
QQQ = "<"
RRR = ">"
SSS = "-"
TTT = "_"
UUU = "="
VVV = "/"
www = "?"
xxx = "'"
YYY = "~"
ZZZ = "*"
AAAA = "+"
BBBB = "["
CCCC = "]"
g = "L"
dddd = "{"
eeee = "}"
FFFF = ""
GGGG = "|"
HHHH = "!"
IIII = "@"
JJJJ = "#"
KKKK = "$"
llll = "%"
nnnn = "("
}

File 2:password1.txt

function password ()
{
if (member==i+p+d+m+y)//first user name; control cipher List translated as: Guest
{
if (PASS==HHH+III+FFF+GGG)//first password; control cipher list translation: 1234
{
Alert ("Still standing Outside" "+ member +" ... ")//Enter the correct prompt
Window.location.href = X+Q+E+D+LLL+T+Y+ABCD//password after the correct entry of the page code.htm (to the password table)
Flag2=1
}
}
if (MEMBER==K+V+J)//Set the second username, the following analogy ...
{
if (pass==f+i+p+d)
{
Alert ("Still out there standing there" + member + "...")
Window.location.href = S+B+V+X+X+LLL+T+Y+ABCD
Flag2=1
}
}
if (MEMBER==QQQ+LLLL+TTT+LLLL+RRR)//Set a third username, the following analogy ...
{
if (pass==ooo+sss+oooo)
{
Alert ("Still out there standing there" + member + "...")
Window.location.href = S+B+V+X+X+LLL+T+Y+ABCD
Flag2=1
}
}
if (member== "")
{
}
Else
{
if (flag==3)//sets the number of times the password is allowed to be lost continuously
{
Window.location.href = "Http://cn.geocities.com/enetvhome"//////3 consecutive Error-oriented page
Flag2=1
}
if (flag2==1) {}
Else
{
Alert ("Sorry, I'm in a bad mood today, stay outside for a while!") ")//Wrong password after the warning language
Flag=flag+1
}
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.