制作识别身份网页的简易方法
上海宝钢集团公司研究院
王建会
---- 想通过INTERNET私下里和朋友们交流,当然不希望别人轻易知道。所以,想给自己的网页加上身份识别机制,无授权ID者无法进入,甚至连源码也看不见。但是,CGI、ASP、作数据库等太麻烦,故决定选用JAVASCRIPT。在网上查了一些JAVASCRIPT内容,一些朋友用Form来确认身份,可是别人可以通过查看源代码来获得用户名和口令。本人经过探索,用简易的方法制作了用于识别身份的网页。
---- 一、特点
- 有授权ID者方可进入;
- 根据进入者的ID号,在页面上显示不同的内容;
- 无授权ID者无法进入,甚至连源码也看不见(但是对网坛高手而言另当别论);
- 输入ID时,主页面变灰色,无法查看源代码;
- 输入非法ID时,将离开本网页;
- 无需CGI、ASP、作数据库等。
---- 二、关键
---- 关键在Location语句,此语句要么为空,要么为一个有效的、而且及易进入的网页,否则仍会进入本页,别人就可以通过查看源代码,而获得有效的ID。
---- 三、源代码
---- 下面是源代码,JAVASCRIPT部分加入HEAD
部分和BODY部分均可。加入BODY部分时,需放在紧接<
BODY >语句处。
< html >
< head >
< meta http-equiv="Content-Type"
content="text/html; charset=gb_2312-80" >
< meta name="GENERATOR" content=
"Microsoft FrontPage Express 2.0" >
< title >Wang Jianhui's Home Page< /title >
< bgsound src="palmoon.mid" loop="infinite" >
< /head >
< body bgcolor="#000000" text="#FFFF00"
link="#0000FF" vlink="#C0C0C0" >
< p align="center" >< img src="anixmasl.gif"
width="528" height="29" > < /p >
< p align="center" >< font color="#0161CA"
size="6" >< em >< strong >< u >
< script language="JavaScript" >
var guestID=prompt("Please input your
ID in the following:","");
if (guestID=="12ok") document.write
("Ph.D.Jiao,How are you? And happy new year!
Sorry to use u gif without u permission.");
else if (guestID=="1qq45") document.write
("亲爱的建萍,新年即将来临,祝你新年愉快.");
else if (guestID=="5a4qq21")
document.write("Wen sir,my friend,You are
welcome.And happy new year!");
else if (guestID=="guest") document.write
("Guest,You are welcome and happy new year.");
< !-在此处每加入一条IF ELSE语句,
即可识别一个ID -- >
else {
location=""; < !-- 或者 location=
"http://www.sohoo.com.cn"; -- >
window.open("http://wjhwjh.yeah.net");
window.alert(guestID+",You are not welcome.");}
< /script >
I'm Jianhui Wang. < /u >< /strong >
< /em >< /font >< /p >
< p align="center" >< img src="ny1.gif"
width="447" height="44" >< /p >
< p align="center" >< img src="web.JPG"
align="left" hspace="0"
width="600" height="424" >
< a href="mailto:[email protected]" >
< imgsrc="anixmasc.gif" border="0"
width="199" height="121" >< /a >< /p >
< p align="right" >< font color="#00FFFF"
size="2" face="Arial Black" >Please
open your speaker, and click these
candles to send email to me!!!< /font >< /p >
< p align="center" >< img src="y2kf.gif"
width="177" height="179" >< /p >
< /body >
< /html >
|