已解决问题 - 浏览25次
下一个已解决问题求网页高手帮帮我
我网页主页经过数据库加了密,要求帐户密码登陆才能打开我链连的网页,可是只要知道我那链连的网页名就可以不用帐户密码都能直接打开我那个链连的网页,求高手们帮帮我,怎样才能保护我那个链连的网页,怎样才能令我那数据库加密达到真正的效果,最好是无论怎样打开我那链连的网页都要经过我那数据库,也就是无论怎样打开我那链连的网页都要帐号密码才能打开,求帮帮忙,最好给个样板让我看看,因为我是菜鸟,谢谢
其他回答(3)
-
我建议你去g168.net的论坛里面去看看,或是问下那里的高手,比较好,我经常去那里问,一定有个满意的答案的
请您登陆后发表意见。 -
楼主只是对地址进行了保护,就好像把宝藏秘密的埋在地下,任何一个知道地址的人都能把它挖出来。
你现在要做的是要把页面加密,不仅仅是不告诉别人地址,说道加密不要觉得很复杂,其实你只要知道一些SEESSION变量的用法就可以了。到网上搜索“SEESSION的用法”,相信很快就学会“注册技术”了。
这样解释但愿能对你有所帮助!请您登陆后发表意见。 -
<%if session("admin")="" then
response.redirect"index.asp"
response.end
end if
%>
在链接的那个页面前加代码如上,admin为登陆时的session值。在登陆框提交表单传送到如下样式的验证页面:
checkadmin.asp
<!--#include file="conn.asp"-->
<!--#include file="md5.asp"-->
<%dim username,userpwd
username=trim(request.form("username"))
userpwd=trim(request.form("userpwd"))
userpwd1=md5(trim(request.form("userpwd")))
if username="" then
response.write"<script>alert(""用户名不能为空!"");location.href=""javascript:history.go(-1)"";</script>"
end if
if username<>"" and instr(username,chr(39))>0 or instr(username,chr(34))>0 then
response.write"<script>alert(""用户名非法!"");location.href=""javascript:history.go(-1)"";</script>"
response.end
<br> end if
if userpwd="" or instr(userpwd,chr(39))>0 then
response.write"<script>alert(""密码不能为空!"");location.href=""javascript:history.go(-1)"";</script>"
response.end
end if
set rs=server.createobject("adodb.recordset")
sql="select username,userid,userpwd,usertype from [user] where username='"&username&"' and userpwd='"&userpwd1&"'"
<br> rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write"<script>alert(""用户名或者密码错误"");location.href=""javascript:history.go(-1)"";</script>"
else
if session("admin")=rs("username")
response.redirect"admin_index.asp"
else
response.write"<script>alert(""非法登陆!"");location.href=""index.asp"";</script>"
end if
end if
rs.close
conn.close
%>请您登陆后发表意见。

小点










