前往顾页
以后地位: 主页 > 收集编程 > Jsp实例教程 >

操纵JavaScript给网站页面加密 法度代码

时候:2010-06-04 23:43来源:知行网www.zhixing123.cn 编辑:麦田守望者

核心提示:网页加密的体例很多,JAVASCRIPT便可以实现,但这类体例不宁静,年夜家可以学习一下,对真正失密性强的网页还是利用其他技术加密为妙....我们常常会碰到一些必须输入用户名和暗码才气进入的网站。其实我们也能够对本身的网站页面进行简朴的加密,详细操纵请看下文:
 

  第一步:建立暗码登录页
 

  将以下代码插手HTML的<BODY>区:
 

  
<!--
flag=0
flag2=0
-->
</script>
<script LANGUAGE="JavaScript" SRC="password.txt"> //暗码表文件
</script>
<script LANGUAGE="JavaScript" SRC="password1.txt"> //暗码考证文件
</script>
<h1 align="center">Login</h1>
<script LANGUAGE="JavaScript">
<!--
function main()
{
member = document.all.username.value
pass = document.all.password.value
encryption()
password()
}
-->
</script>
<p>输入用户名: <input TYPE="TEXT" ID="username" size="20"> <br>
请输入暗码: <input TYPE="PASSWORD" ID="password" size="20">
<input TYPE="BUTTON" ID="button" onclick="main()" value="Enter!" align="center"> </p>

  第二步:别离编辑文件1(password.txt)和文件2(password1.txt),适合你本身的页面环境,主如果暗码设定和用户名设定。
 

  文件1:password.txt
 

  一张暗码表,一看就懂,没有甚么难度。可以自由设想,重视年夜小写的辨别。
 

  
{
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 = "code:quot;
llll = "%"
nnnn = "("
}

  文件2:password1.txt

  
{
if(member==i+p+d+m+y) //第一个用户名;对比暗码表翻译为:guest
{
if(pass==hhh+iii+fff+ggg) //第一个暗码;对比暗码表翻译为:1234
{
alert("还在内里傻站着干吗 " + member + "...") //输入精确后的提示语
window.location.href = x+q+e+d+lll+t+y+abcd //暗码精确掉队入的页面code.htm(对暗码表)
flag2=1
}
}
if(member==k+v+j) //设定第二个用户名,以下类推...
{
if(pass==f+i+p+d)
{
alert("还在内里傻站着干吗 " + member + "...")
window.location.href = s+b+v+x+x+lll+t+y+abcd
flag2=1
}
}
if(member==qqq+llll+ttt+llll+rrr) //设定第三个用户名,以下类推...
{
if(pass==ooo+sss+oooo)
{
alert("还在内里傻站着干吗 " + member + "...")
window.location.href = s+b+v+x+x+lll+t+y+abcd
flag2=1
}
}
if(member=="")
{
}
else
{
if(flag==3) //设定许可持续输错暗码的次数
{
window.location.href = "http://cn.geocities.com/enetvhome" //持续3次输错后导向该页面
flag2=1
}
if(flag2==1)
else
{
alert ("对不起,明天我表情不好,在内里待会儿吧!") //输错暗码后的警示语
flag=flag+1
}
}
}
顶一下
(1)
100%
踩一下
(0)
0%
------分开线----------------------------
标签(Tag):Javascript
------分开线----------------------------
颁发评论
请自发遵循互联网相关的政策法规,严禁公布色情、暴力、革命的谈吐。
评价:
神色:
考证码:点击我更换图片
猜你感兴趣