📄 userlogin.asp
字号:
<%
'判断用户是否登录
If IsEmpty(Session("UserID"))=True Then
'若没有登录则显示登陆框
Response.Write "<table class=tableborder1 align=center cellspacing=1 cellpadding=3 width=97% >"
Response.Write "<form action=login.asp>"
Response.Write "<tr><th colspan=2 id=tabletitlelink height=25 style=font-weight:normal align=left>用户信息:访客,"&_
"您的IP是"&Request.ServerVariables("REMOTE_ADDR")&" </th></tr>"
Response.Write "</table>"
Response.Write "<table border=0 width=97% align=center><tr><td colspan=2 id=tabletitlelink height=25 style=font-weight:normal align=left>"
Response.Write "用户名:<input type=text class=inputarea name=UserName> "
Response.Write "密码:<input type=password class=inputarea name=UserPassword> "
Response.Write "<input type=submit value=登录 class=inputarea> [<a href=javascript:openWindow('Reg.asp',420,240)><font color=black>没有注册?</font></a>]"
Response.Write "</form>"
Response.Write "</td></tr></table>"
Else
'若登录,则读取用户信息
'通过SQL多表查询读取用户已预订或者已租的影片
strSQL="SELECT * FROM [Tenancy],[VideoInfo] WHERE TAC_UI_ID_FN="&Session("UserID")&" AND VI_ID_N=TAC_VI_ID_FN AND (TAC_Status_N=4 OR TAC_Status_N=3)"
Set objRS=Server.CreateObject("ADODB.RecordSet")
objRS.Open strSQL,objConn,1,3
'读取已预订影片及已租影片的信息
Dim Rent,Prearrange,MsgRent,OvertimeRent
If objRS.BOF Or objRS.EOF Then
Rent="您还没有租影片"
MsgRent="您还没有租影片"
OvertimeRent="您还没有租影片"
Prearrange="您还没有预订影片"
Else
For i=1 To objRS.RecordCount
'通过Select Case语句将已预订与已租影片分类
Select Case objRS("TAC_Status_N")
Case "3"
If DateDiff("h",Now(),DateAdd("h",objRS("TAC_Lease_N")*24,objRS("TAC_StartTime_D")))>24 Then
'如果租出的影片在返还时间24小时以外,则显示为“已租影片”
Rent=Rent&"<a href=javascript:openWindow('disprent.asp?ID="&objRS("TAC_ID_N") & _
"',320,370) title='起租时间:"&objRS("TAC_StartTime_D")&" 租期:"&objRS("TAC_Lease_N")&"天 到期时间:"&DateAdd("d",objRS("TAC_Lease_N"),objRS("TAC_StartTime_D"))&_
" ' >《"&objRS("VI_Title_S")&"》还剩"&DateDiff("h",Now(),DateAdd("h",objRS("TAC_Lease_N")*24,objRS("TAC_StartTime_D")))&"小时</a>"
ElseIf DateDiff("h",Now(),DateAdd("h",objRS("TAC_Lease_N")*24,objRS("TAC_StartTime_D")))>=0 Then
'如果租出的影片离返还时间不到24小时,则显示为“要到期影片”
MsgRent=MsgRent&"<a href=javascript:openWindow('disprent.asp?ID="&objRS("TAC_ID_N") & _
"',320,370) title='起租时间:"&objRS("TAC_StartTime_D")&" 租期:"&objRS("TAC_Lease_N")&"天 到期时间:"&DateAdd("d",objRS("TAC_Lease_N"),objRS("TAC_StartTime_D"))&_
"' >《"&objRS("VI_Title_S")&"》还剩<font color=red>"&DateDiff("h",Now(),DateAdd("h",objRS("TAC_Lease_N")*24,objRS("TAC_StartTime_D")))&"</font>小时</a>"
Else
'如果租出的影片已经超过归还期限,则显示为“超期影片”
OvertimeRent=OvertimeRent&"<a href=javascript:openWindow('disprent.asp?ID="&objRS("TAC_ID_N") & _
"',320,370) title='起租时间:"&objRS("TAC_StartTime_D")&" 租期:"&objRS("TAC_Lease_N")&"天 到期时间:"&DateAdd("d",objRS("TAC_Lease_N"),objRS("TAC_StartTime_D"))&_
"' >《"&objRS("VI_Title_S")&"》已过期"&DateDiff("h",DateAdd("h",objRS("TAC_Lease_N")*24,objRS("TAC_StartTime_D")),Now())&"小时!</a>"
End If
Case "4"
'显示预订时间
If DateDiff("h",objRS("TAC_ReserveTime_D"),Now())<=12 Then
Prearrange=Prearrange&"<a href=javascript:openWindow('disprent.asp?ID="&objRS("TAC_ID_N")&"',320,370)" &_
" title='预订时间:"&objRS("TAC_ReserveTime_D")&" 还可保留预订"& 12-DateDiff("h",objRS("TAC_ReserveTime_D"),Now())&"小时'>《"&objRS("VI_Title_S")&"》</a>"
End If
End Select
objRS.MoveNext
Next
End If
objRS.Close
Response.Write "</form>"
'写html代码
Response.Write "<table class=tableborder1 align=center cellspacing=1 cellpadding=3 width=97% >"
Response.Write "<th colspan=2 id=tabletitlelink height=25 style=font-weight:normal align=left>欢迎您的来访!"&_
"您的IP是"&Request.ServerVariables("REMOTE_ADDR")&" [<a href=logout.asp>注销</a>]</th></tr>"
Response.Write "</table>"
Response.Write "<table class=tableborder1 align=center cellspacing=1 cellpadding=3 width=97% >"
Response.Write "<tr><td class=TableBody2 colspan=4><b>用户基本信息:</b></td></tr>"
Response.Write "<tr><td class=TableBody2 align=right width=10% >已预订影片:</td><td class=tablebody1 style='color:#666666' width=40% >"&Prearrange&"</td>"
Response.Write "<td class=TableBody2 align=right width=10% >用户管理:</td><td class=TableBody1 align=left width=40% > "&_
"[<a href=javascript:openWindow('modifyUser.asp?uid="&Session("UserID")&"',320,340)>用户信息更改</a>]</td></tr>"
Response.Write "<tr><td class=TableBody2 colspan=4><b>已租影片:</b></td></tr>"
Response.Write "<tr><td class=TableBody2 align=right width=10% >已租影片:</td><td class=tablebody1 style='color:#666666'>"&Rent&"</td>"
Response.Write "<td class=TableBody2 align=right width=10% >要到期影片:</td><td class=tablebody1 style='color:#666666'>"&MsgRent&"</td></tr>"
Response.Write "<tr><td class=TableBody2 align=right width=10% >超期影片:</td><td class=tablebody1 style='color:#666666'>"&OvertimeRent&"</td>"
'判断用户是否有管理权限
strSQL="SELECT UI_IsAdmin_B FROM [UserInfo] WHERE UI_ID_N="&Session("UserID")
Set objRS=Server.CreateObject("ADODB.RecordSet")
objRS.Open strSQL,objConn,1,3
If objRS("UI_IsAdmin_B")=True Then
Response.Write "<td class=TableBody2 align=right width=10% >管理选项:</td><td class=tablebody1 style='color:#666666'>"&_
" [<a href=admin_index.asp?type=SysInfo target=blank>系统信息</a>]"&_
" [<a href=admin_index.asp?type=UserInfo target=blank>用户管理</a>]"&_
" [<a href=admin_index.asp?type=MovieInfo target=blank>影片管理</a>]"&_
" [<a href=admin_index.asp?type=RentInfo target=blank>租赁管理</a>]"&_
"</td></tr>"
Else
Response.Write "<td class=TableBody2 align=right width=10% ></td><td class=tablebody1 style='color:#666666'></td></tr>"
End If
Response.Write "</tr>"
objRS.Close
Set objRS=Nothing
End IF
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -