📄 view.asp
字号:
<%@LANGUAGE="VBSCRIPT"%>
<%
' *** Logout the current user.
MM_Logout = CStr(Request.ServerVariables("URL")) & "?MM_Logoutnow=1"
If (CStr(Request("MM_Logoutnow")) = "1") Then
Session.Abandon
MM_logoutRedirectPage = "default.asp"
' redirect with URL parameters (remove the "MM_Logoutnow" query param).
if (MM_logoutRedirectPage = "../../ch12/final/%22)%20Then%20MM_logoutRedirectPage%20=%20CStr(Request.ServerVariables(%22URL"))
If (InStr(1, UC_redirectPage, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_newQS = "?"
For Each Item In Request.QueryString
If (Item <> "MM_Logoutnow") Then
If (Len(MM_newQS) > 1) Then MM_newQS = MM_newQS & "&"
MM_newQS = MM_newQS & Item & "=" & Server.URLencode(Request.QueryString(Item))
End If
Next
if (Len(MM_newQS) > 1) Then MM_logoutRedirectPage = MM_logoutRedirectPage & MM_newQS
End If
Response.Redirect(MM_logoutRedirectPage)
End If
%>
<!--#include file="../../Connections/Myconn.asp" -->
<%
set rsSubject = Server.CreateObject("ADODB.Recordset")
rsSubject.ActiveConnection = MM_Myconn_STRING
rsSubject.Source = "SELECT * FROM tBBSSubject"
rsSubject.CursorType = 0
rsSubject.CursorLocation = 2
rsSubject.LockType = 3
rsSubject.Open()
rsSubject_numRows = 0
%>
<%
Dim rsMaster__MMColParam
rsMaster__MMColParam = "1"
if (Request.QueryString("fSubject") <> "") then rsMaster__MMColParam = Request.QueryString("fSubject")
%>
<%
set rsMaster = Server.CreateObject("ADODB.Recordset")
rsMaster.ActiveConnection = MM_Myconn_STRING
rsMaster.Source = "SELECT fUserID FROM tUsers WHERE fHost = " + Replace(rsMaster__MMColParam, "'", "''") + ""
rsMaster.CursorType = 0
rsMaster.CursorLocation = 2
rsMaster.LockType = 3
rsMaster.Open()
rsMaster_numRows = 0
%>
<%
Dim rsCurSub__MMColParam
rsCurSub__MMColParam = "1"
if (Request.QueryString("fSubject") <> "") then rsCurSub__MMColParam = Request.QueryString("fSubject")
%>
<%
set rsCurSub = Server.CreateObject("ADODB.Recordset")
rsCurSub.ActiveConnection = MM_Myconn_STRING
rsCurSub.Source = "SELECT * FROM tBBSSubject WHERE fSubject = " + Replace(rsCurSub__MMColParam, "'", "''") + ""
rsCurSub.CursorType = 0
rsCurSub.CursorLocation = 2
rsCurSub.LockType = 3
rsCurSub.Open()
rsCurSub_numRows = 0
%>
<%
set rsSubject2 = Server.CreateObject("ADODB.Recordset")
rsSubject2.ActiveConnection = MM_Myconn_STRING
rsSubject2.Source = "SELECT * FROM tBBSSubject"
rsSubject2.CursorType = 0
rsSubject2.CursorLocation = 2
rsSubject2.LockType = 3
rsSubject2.Open()
rsSubject2_numRows = 0
%>
<%
Dim rsMainTopic__MMColParam
rsMainTopic__MMColParam = "1"
if (Request.Querystring("fID") <> "") then rsMainTopic__MMColParam = Request.Querystring("fID")
%>
<%
set rsMainTopic = Server.CreateObject("ADODB.Recordset")
rsMainTopic.ActiveConnection = MM_Myconn_STRING
rsMainTopic.Source = "SELECT fID, fPoster, fPostTime, fTitle, fContent, fSubject, fE_Mail, fPostNum, fRegTime FROM tBBS, tUsers WHERE fID = " + Replace(rsMainTopic__MMColParam, "'", "''") + " AND fUserID = fPoster "
rsMainTopic.CursorType = 0
rsMainTopic.CursorLocation = 2
rsMainTopic.LockType = 3
rsMainTopic.Open()
rsMainTopic_numRows = 0
%>
<%
Dim rsReply__MMColParam
rsReply__MMColParam = "1"
if (Request.Querystring("fID") <> "") then rsReply__MMColParam = Request.Querystring("fID")
%>
<%
set rsReply = Server.CreateObject("ADODB.Recordset")
rsReply.ActiveConnection = MM_Myconn_STRING
rsReply.Source = "SELECT fID, fPoster, fPostTime, fTitle, fPostNum FROM tBBS, tUsers WHERE fRepID = " + Replace(rsReply__MMColParam, "'", "''") + " AND fUserID = fPoster ORDER BY fPostTime DESC"
rsReply.CursorType = 0
rsReply.CursorLocation = 2
rsReply.LockType = 3
rsReply.Open()
rsReply_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = -1
Dim Repeat1__index
Repeat1__index = 0
rsSubject_numRows = rsSubject_numRows + Repeat1__numRows
%>
<%
Dim Repeat2__numRows
Repeat2__numRows = -1
Dim Repeat2__index
Repeat2__index = 0
rsMaster_numRows = rsMaster_numRows + Repeat2__numRows
%>
<%
Dim Repeat3__numRows
Repeat3__numRows = -1
Dim Repeat3__index
Repeat3__index = 0
rsReply_numRows = rsReply_numRows + Repeat3__numRows
%>
<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Request.QueryString
MM_valUsername=CStr(Request.Form("txtLoginName"))
If MM_valUsername <> "" Then
MM_fldUserAuthorization=""
MM_redirectLoginSuccess="../../ch12/final/view.asp?"& Request.QueryString
MM_redirectLoginFailed="../../ch12/final/sorry.htm"
MM_flag="ADODB.Recordset"
set MM_rsUser = Server.CreateObject(MM_flag)
MM_rsUser.ActiveConnection = MM_Myconn_STRING
MM_rsUser.Source = "SELECT fUserID, fPassword"
If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
MM_rsUser.Source = MM_rsUser.Source & " FROM tUsers WHERE fUserID='" & MM_valUsername &"' AND fPassword='" & CStr(Request.Form("txtPassword")) & "'"
MM_rsUser.CursorType = 0
MM_rsUser.CursorLocation = 2
MM_rsUser.LockType = 3
MM_rsUser.Open
If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
' username and password match - this is a valid user
Session("MM_Username") = MM_valUsername
If (MM_fldUserAuthorization <> "") Then
Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
Else
Session("MM_UserAuthorization") = ""
End If
if CStr(Request.QueryString("accessdenied")) <> "" And false Then
MM_redirectLoginSuccess = Request.QueryString("accessdenied")
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginSuccess)
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginFailed)
End If
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then MM_removeList = MM_removeList & "&" & MM_paramName & "="
MM_keepURL="":MM_keepForm="":MM_keepBoth="":MM_keepNone=""
' add the URL parameters to the MM_keepURL string
For Each Item In Request.QueryString
NextItem = "&" & Item & "="
If (InStr(1,MM_removeList,NextItem,1) = 0) Then
MM_keepURL = MM_keepURL & NextItem & Server.URLencode(Request.QueryString(Item))
End If
Next
' add the Form variables to the MM_keepForm string
For Each Item In Request.Form
NextItem = "&" & Item & "="
If (InStr(1,MM_removeList,NextItem,1) = 0) Then
MM_keepForm = MM_keepForm & NextItem & Server.URLencode(Request.Form(Item))
End If
Next
' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
if (MM_keepBoth <> "") Then MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
if (MM_keepURL <> "") Then MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
if (MM_keepForm <> "") Then MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
If (firstItem <> "") Then
MM_joinChar = "&"
Else
MM_joinChar = ""
End If
End Function
%>
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>
function DoWhiteSpace(str)
DoWhiteSpace = Replace((Replace(str, vbCrlf, "<br>")), chr(32)&chr(32), " ")
End Function
</SCRIPT>
<html>
<head>
<title>阅读贴子</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../../ch16/css/common.css" type="text/css">
<script language="JavaScript">
<!--
function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') {
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
<link rel="stylesheet" href="../../css/common.css" type="text/css">
</head>
<body bgcolor="#3399CC" text="#000000">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="211" width="23%" valign="top" rowspan="2">
<% If (Session("MM_Username")) = ("") Then 'script_and_script%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="center" valign="top" bgcolor="#FFFFCC">
<td height="18" bgcolor="#3399CC">
<form name="form1" method="post" action="<%=MM_LoginAction%>" onSubmit="MM_validateForm('txtLoginName','','R','txtPassword','','R');return document.MM_returnValue">
<p>用户名:
<input type="text" name="txtLoginName" size="8" class="fnt9">
<br>
口 令:
<input type="password" name="txtPassword" size="8" class="fnt9">
</p>
<p>
<input type="submit" name="Submit" value="登录" class="txtfld">
<br>
</p>
</form>
</td>
</tr>
<tr align="center" valign="top" bgcolor="#FFFFCC">
<td height="19" bgcolor="#3399CC">
<table class="txtfld" border="0" cellspacing="0" cellpadding="0">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -