📄 复件 (2) login.asp
字号:
<!--#include file="../Include/AdoConn.asp"-->
<%
dim UserCode,Password
UserCode=trim(Request("Usercode"))
Password=trim(Request("Password"))
dim objres,strsql
set objres=server.CreateObject ("ADODB.recordset")
strsql="select 用户编码,密码,有效标志,用户姓名,部门编码 from XT_VC_User where 用户编码='"+Usercode+"'"
objres.Open strsql,strconn
if objres.EOF then
Response.Redirect "../index.asp?info=无此用户,请注册!"
else
if not trim(objres("密码"))=trim(password) then
Response.Redirect "../index.asp?info=您的密码错误,请重新登录!"
else
if not trim(objres("有效标志"))="1" then
Response.Redirect "../index.asp?info=请等待主管部门批准!"
else
session("usercode")=objres("用户编码")
session("username")=objres("用户姓名")
session("departcode")=objres("部门编码")
'''''''''''''''''''''''''''''''判断用户IP是否有权限
IP=Request.ServerVariables("remote_addr")
dim objres1,strsql1,begin1,end1'判断IP是否有效
set objres1=server.CreateObject("ADODB.recordset")
strsql1="select * from XT_TC_UserIP"
objres1.Open strsql1,conn
begin1=objres1("IP首地址")
end1=objres1("IP末地址")
str1=IP
str2=begin1
str3=end1
chr1="."
redim BIP(3),EIP(3),UIP(3)'将IP各位存入数组
dim a,b,c,i
a=instr(str1,chr1)
b=instr(str2,chr1)
c=instr(str3,chr1)
i=0
do while not a=0 and not b=0 and not c=0
a=instr(str1,chr1)
b=instr(str2,chr1)
c=instr(str3,chr1)
if a<>0 then UIP(i)=left(str1,a-1)
if b<>0 then BIP(i)=left(str2,b-1)
if c<>0 then EIP(i)=left(str3,c-1)
str1=right(str1,len(str1)-a)
str2=right(str2,len(str2)-b)
str3=right(str3,len(str3)-c)
i=i+1
UIP(3)=str1
BIP(3)=str2
EIP(3)=str3
loop
'判断第四位是否相同
if not (cint(UIP(3))>cint(BIP(3))and cint(UIP(3))<(EIP(3))) then'判断第四位是否在首地址及末地址中
session("IPno")="no"
else
for i=0 to 2'判断用户IP前三位与数据库首IP前三位是否相同,如果不相同,显示无权限
if UIP(i)<>BIP(i) then
session("IPno")="no"
end if
next
end if
'''''''''''''''''''''''''''''''''''''''''''''''IP判断结束
'end if
Response.Redirect "../system.asp"
end if
end if
end if
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -