'判断用户是否查找电影
If FindMovie<>"" Then
'如果返回的查找电影名称的字符串非空,则根据用户的输入查找电影名称
'如果返回的是数字,则根据电影ID查找
If IsNumeric(FindMovie) Then
strSQL="SELECT * FROM [VideoInfo] WHERE VI_ID_N="&FindMovie
Else
Select Case Request("FindType")
Case "Title"
strSQL="SELECT * FROM [VideoInfo] WHERE VI_Title_S LIKE”&_
“ '%"&FindMovie&"%'"
Case "Director"
strSQL="SELECT * FROM [VideoInfo] WHERE VI_Director_S LIKE “&_
”'%"&FindMovie&"%'"
Case "Playactor"
strSQL="SELECT * FROM [VideoInfo] WHERE VI_Playactor_S LIKE “&_
”'%"&FindMovie&"%'"
Case "Issuer"
strSQL="SELECT * FROM [VideoInfo] WHERE VI_Issuer_S LIKE “&_
”'%"&FindMovie&"%'"
Case Else
strSQL="SELECT * FROM [VideoInfo] WHERE VI_Title_S LIKE “&_
”'%"&FindMovie&"%'"
End Select
End If
'判断用户是否在特定的区域浏览电影
If IsNumeric(Request("ViewArea")) AND Request("ViewArea")<>0 Then
strSQL=strSQL&" AND VI_VS_ID_FN="&Request("ViewArea")
End If
Else
strSQL="SELECT * FROM [VideoInfo] ORDER BY VI_AddTime_D DESC"
If IsNumeric(Request("ViewArea")) AND Request("ViewArea")<>0 Then
strSQL="SELECT * FROM [VideoInfo] WHERE”&_
” VI_VS_ID_FN="&Request("ViewArea")&" ORDER BY VI_AddTime_D DESC"
End If
End If
Set objRS=Server.CreateObject("ADODB.RecordSet")
objRS.PageSize=3
objRS.Open strSQL,objConn,1,3
'如果从数据库中没有读取到任何电影的信息,则返回信息
If objRS.BOF Or objRS.EOF Then
Response.Write "<table width=97% ><tr><td align=center>没有找到要查找的影片!”&_
”[<a href=java script:history.go(-1)>返回</a>]</td></tr></table>"
Response.Write strSQL&"<br>"
Response.End
End If
<!--#include file="CONN.ASP"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
<link href="style.css" rel="stylesheet" type="text/css">
<title>影片租赁系统</title>
<script language="java script" src="JS\inc.js"></script>
</head>
<body>
<!--插入通用的Html头模板-->
<!--#include file="head.asp"-->
<%
If IsNumeric(Request("id"))=False Then
Response.Write GetErr(11)
Response.End
End If
strSQL="SELECT * FROM [VideoInfo],[Payment] WHERE VI_ID_N="&Request("id")&_
" AND VI_PMT_ID_FN=PMT_ID_N"
Set objRS=Server.CreateObject("ADODB.RecordSet")
objRS.Open strSQL,objConn,1,3
'更新影片点击数
strSQL="UPDATE [VideoInfo] SET VI_Count_N="&objRS("VI_Count_N")+1&_
" WHERE VI_ID_N="&objRS("VI_ID_N")
objConn.Execute(strSQL)
objRS.Close
Response.Write "</table>"
%>
<!--插入通用的Html末尾-->
<!--#include file="bottom.asp"-->
</body>
</html>
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=java script: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=java script: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=”&_
”java script: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=java script: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
If IsEmpty(Session("UserID"))=True Then
Response.Write GetErr(7)
Response.End
End If
‘根据IsModify判断是执行程序还是显示页面
If Request("IsModify")<>"" Then
'判断要更改的用户是否存在
Set objRS=Server.CreateObject("ADODB.RecordSet")
strSQL="SELECT UI_ID_N FROM [UserInfo] WHERE UI_ID_N="&Request("uid")
objRS.Open strSQL,objConn,1,3
If objRS.BOF Or objRS.EOF Then
Response.Write "<br><br><br>"
ResultMsg("要修改的用户没有找到!")
objRS.Close
Set objRS=Nothing
CloseDatabase
Response.End
End If
objRS.Close
'检查输入的合法性
'密码
If Request("ChangePassword")<>"" Then
If Request("Password")="" Then
ResultMsg("如果选择了更改密码,则必须输入密码!")
Response.End
End If
If Len(Request("Password"))>20 Then
ResultMsg("密码请不要超过20个字符!")
Response.End
End If
If InStr(Request("Password"),"'")>0 Then
ResultMsg("字符“'”为非法输入,请去掉此字符!")
Response.End
End If
End If
'Email
If IsValidEmail(Request("Email"))=False Then
ResultMsg("Email输入不符合规范,请返回重新输入!")
Response.End
End If
'QQ
If Request("QQ")<>"" Then
If IsNumeric(Request("QQ"))=False Then
ResultMsg("QQ号码必须为数字,请返回重新输入!")
Response.End
End If
End If
'当管理员修改时判断
If Request("ChangeBy")="admin" Then
'判断用户是否为管理员
strSQL="SELECT UI_IsAdmin_B FROM [UserInfo] WHERE UI_ID_N="&_
Session("UserID")
objRS.Open strSQL,objConn,1,3
If objRS("UI_IsAdmin_B")=False Then
objRS.Close
Response.Write GetErr(8)
CloseDatabase
Response.End
End If
objRS.Close
'供应商
If IsNumeric(Request("Provider"))=False Or Request("Provider")="" Then
Response.Write GetErr(1)
Response.End
End If
'管理员
If Request("IsAdmin")<>"true" AND Request("IsAdmin")<>"false" Then
Response.Write GetErr(1)
Response.End
End If
'锁定
If Request("IsLocked")<>"true" AND Request("IsLocked")<>"false" Then
Response.Write GetErr(1)
Response.End
End If
'信用等级
If IsNumeric(Request("CerRank"))=False Or Request("CerRank")="" Then
ResultMsg("信用等级不能留空!")
Response.End
End If
End If
'取得用户信息
‘如果用户填了新密码,则加密此密码以便更新
If Request("ChangePassword")<>"" Then
UserPassword=(Request("Password")
End If
Email=Request("Email")
QQ=Request("QQ")
ProviderID=Request("Provider")
‘如果ProviderID>0则说明用户是供应商
If ProviderID<>0 Then
IsProvider=True
Else
IsProvider=False
End If
IsAdmin=Request("IsAdmin")
IsLocked=Request("IsLocked")
CerRank=Request("CerRank")
'根据情况建立SQL语句更新数据库
If Request("ChangeBy")="admin" Then
If Request("ChangePassword")<>"" Then
strSQL="UPDATE [UserInfo] SET UI_PI_ID_FN="&ProviderID&_
",UI_Password_S='"&UserPassword&"',UI_IsLocked_B="&IsLocked&_
",UI_CerRank_N="&CerRank&",UI_IsProvider_B="&IsProvider&_
",UI_Email_S='"&Email&"',UI_QQ_S='"&QQ&"',UI_IsAdmin_B="&IsAdmin&_
" WHERE UI_ID_N="&Request("uid")
Else
strSQL="UPDATE [UserInfo] SET UI_PI_ID_FN="&ProviderID&_
",UI_IsLocked_B="&IsLocked&",UI_CerRank_N="&CerRank&_
",UI_IsProvider_B="&IsProvider&",UI_Email_S='"&Email&"',UI_QQ_S='"&_
QQ&"',UI_IsAdmin_B="&IsAdmin&" WHERE UI_ID_N="&Request("uid")
End If
Else
If Request("ChangePassword")<>"" Then
strSQL="UPDATE [UserInfo] SET UI_Password_S='"&UserPassword&_
"',UI_Email_S='"&Email&"',UI_QQ_S='"&QQ&"' WHERE UI_ID_N="&_
Request("uid")
Else
strSQL="UPDATE [UserInfo] SET UI_Email_S='"&Email&"',UI_QQ_S='"&_
QQ&"' WHERE UI_ID_N="&Request("uid")
End If
End If
objConn.Execute(strSQL)
'输出结果
Response.Write "<br><br><br>"
ResultMsg("用户信息更新完毕!")
CloseDatabase
Response.End
Else
'判断输入是否合法
If IsNumeric(Request("uid"))=False Or Request("uid")="" Then
Response.Write GetErr(1)
Response.End
End If
'判断用户是否为管理员
Dim strSQL,objRS
Dim IsAdmin
strSQL="SELECT UI_ID_N,UI_IsAdmin_B FROM [UserInfo] WHERE UI_ID_N="&_
Session("UserID")
Set objRS=Server.CreateObject("ADODB.RecordSet")
objRS.Open strSQL,objConn,1,3
IsAdmin=objRS("UI_IsAdmin_B")
objRS.Close
'若用户不是管理员则判断其修改的是否为自己的信息
If IsAdmin=False Then
If Cint(Request("uid"))<>Cint(Session("UserID")) Then
Response.Write GetErr(8)
CloseDatabase
Response.End
End If
End If
'取得用户信息
Dim UserName,Email,QQ
Dim Provider,IsProvider,ProviderID
Dim IsLocked,IsAdmin2
Dim RentCount,CerRank
&n