当前位置:编程学习 > C#/ASP.NET >>

关于登陆

大家好!
我是新手,请帮我看下,下面这些代码是做些什么的呢?
===================
<%
if trim(session("emp_no")) ="" then
response.redirect "sy101.asp?q="  & server.urlencode(request.ServerVariables("URL") & "?" & request.ServerVariables("query_string") )
end if

if session(pgmid) = "" then
Set con = Server.CreateObject("ADODB.Connection")
con.open  "Provider=SQLOLEDB;Password=abc;User ID=appuser;Initial Catalog=wabc;Data Source=192.168.1.22;"
mySQL = "exec wchkusr '"  & trim(session("emp_no")) & "','" & pgmid  & "'"
set trs = con.Execute(mySQL)
if trs.eof then
session(pgmid) = "N"
else
session(pgmid) = "Y"
session(pgmid + "_acl") =trs("aclvl")
end if
if session(pgmid)= "N" then
set con = nothing
response.redirect("unauth.htm")
end if
set con = nothing
else
if session(pgmid) = "N" then
set con = nothing
response.redirect("unauth.htm")
end if
end if
set con=nothing
%>


========================

我做了几个网页,放在一个目录下,里面有登陆页面,我想让只有登陆成功的话,才可以访问其它的一些页面,这个登陆页面现在是主页面.
但现在是在地址里输入其它的面主,就可以进入,这样那个登陆页面就没有用了,而且也不安全,请问这样要怎样做啊? 是不是与上面的代码有关呢? 是要用到session吧?能否贴点代码看看好吗?

就像那个WWW.163.COM邮箱一样,只有登陆成功才可以用,输入地址是没有用的. --------------------编程问答-------------------- 你用的是ASP代码? --------------------编程问答-------------------- 当然了,你起先登陆的时候,就已经把用户名保存在session里头,一般session是得20分钟后过期的..要不就用cookies.
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,