?? review.asp
字號(hào):
<%@LANGUAGE="VBSCRIPT" codepage=936 %>
<!--#include file="Connections/news.asp" -->
<!--#include file="head_kong.asp" -->
<%
' *** Edit Operations: declare variables
MM_editAction = CStr(Request("URL"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables
If (CStr(Request("MM_insert")) <> "") Then
MM_editConnection = MM_news_STRING
MM_editTable = "review"
MM_editRedirectUrl = "detail.asp"
MM_fieldsStr = "r_name|value|r_email|value|r_content|value|n_id|value"
MM_columnsStr = "r_name|',none,''|r_email|',none,''|r_content|',none,''|n_id|',none,''"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
' set the form values
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(i+1) = CStr(Request.Form(MM_fields(i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it
If (CStr(Request("MM_insert")) <> "") Then
' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
FormVal = MM_fields(i+1)
MM_typeArray = Split(MM_columns(i+1),",")
Delim = MM_typeArray(0)
If (Delim = "none") Then Delim = ""
AltVal = MM_typeArray(1)
If (AltVal = "none") Then AltVal = ""
EmptyVal = MM_typeArray(2)
If (EmptyVal = "none") Then EmptyVal = ""
If (FormVal = "") Then
FormVal = EmptyVal
Else
If (AltVal <> "") Then
FormVal = AltVal
ElseIf (Delim = "'") Then ' escape quotes
FormVal = "'" & Replace(FormVal,"'","''") & "'"
Else
FormVal = Delim + FormVal + Delim
End If
End If
If (i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End if
MM_tableValues = MM_tableValues & MM_columns(i)
MM_dbValues = MM_dbValues & FormVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"
If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
<%
Dim rsr__MMColParam
rsr__MMColParam = "1"
if (Request.QueryString("n_id") <> "") then rsr__MMColParam = Request.QueryString("n_id")
%>
<%
set rsr = Server.CreateObject("ADODB.Recordset")
rsr.ActiveConnection = MM_news_STRING
rsr.Source = "SELECT * FROM review WHERE n_id = '" + Replace(rsr__MMColParam, "'", "''") + "' ORDER BY r_data DESC"
rsr.CursorType = 0
rsr.CursorLocation = 2
rsr.LockType = 3
rsr.Open()
rsr_numRows = 0
%>
<%
Dim Repeat2__numRows
Repeat2__numRows = 10
Dim Repeat2__index
Repeat2__index = 0
rsr_numRows = rsr_numRows + Repeat2__numRows
%>
<link rel="stylesheet" href="intohz.css" type="text/css">
<script language="JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
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 && d.getElementById) x=d.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>
</head>
<body bgcolor="#ffffff" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="778" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td background="images/bg2.gif" bgcolor="#FFFFFF"><br>
<% If rsr.EOF And rsr.BOF Then %>
<p align="center">還沒有評(píng)論</p>
<% End If ' end rsr.EOF And rsr.BOF %>
<br>
<%
While ((Repeat2__numRows <> 0) AND (NOT rsr.EOF))
%>
<% If Not rsr.EOF Or Not rsr.BOF Then %>
<table width="500" border="0" cellspacing="1" cellpadding="0" align="center" bgcolor="426DB4">
<tr background="images/biao_t.gif">
<td height="20" colspan="2">■<font color="#FFFFFF">[<%=(rsr.Fields.Item("r_data").Value)%>]網(wǎng)友的評(píng)論</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="25" width="50%"> 網(wǎng)友名稱:<font color="#663366"><%= Server.HTMLEncode((rsr.Fields.Item("r_name").Value)) %></font></td>
<td height="25"> Email:<font color="#663366"><%= Server.HTMLEncode((rsr.Fields.Item("r_email").Value)) %></font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td style="word-break:break-all" colspan="2" height="30">
<blockquote><font color="#663366"><br>
<%= Server.HTMLEncode((rsr.Fields.Item("r_content").Value)) %></font></blockquote>
</td>
</tr>
</table>
<br>
<% End If ' end Not rsr.EOF Or NOT rsr.BOF %>
<%
Repeat2__index=Repeat2__index+1
Repeat2__numRows=Repeat2__numRows-1
rsr.MoveNext()
Wend
%>
<table width="500" border="0" cellspacing="1" cellpadding="0" height="200" align="center" bgcolor="426DB4">
<tr>
<form method="POST" action="<%=MM_editAction%>" name="form1" onSubmit="MM_validateForm('r_name','','R','r_email','','RisEmail','r_content','','R');return document.MM_returnValue">
<td bgcolor="426DB4">
<table align="center" width="300" border="0" cellpadding="0" cellspacing="1">
<tr>
<td nowrap align="right" width="30%" height="30" valign="baseline">
<div align="center"><font color="#FFFFFF">你的大名:</font></div>
</td>
<td height="30" valign="baseline">
<input type="text" name="r_name" value="" size="20">
</td>
</tr>
<tr>
<td nowrap align="right" width="30%" height="30" valign="baseline">
<div align="center"><font color="#FFFFFF">你的mail:</font></div>
</td>
<td height="30" valign="baseline">
<input type="text" name="r_email" value="" size="20">
</td>
</tr>
<tr>
<td nowrap align="right" colspan="2" height="50" valign="baseline">
<div align="center">
<textarea name="r_content" cols="40" rows="4"></textarea>
</div>
</td>
</tr>
<tr>
<td nowrap align="right" width="30%" height="50" valign="baseline"> </td>
<td height="50">
<input type="submit" value="發(fā)表評(píng)論" name="submit">
</td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="true">
<input type="hidden" name="n_id" value="<%=request.querystring("n_id")%>">
</td>
</form>
</tr>
</table>
</td>
</tr>
<tr>
<td height="15" background="images/bg2.gif" bgcolor="#FFFFFF"> </td>
</tr>
</table>
<!--#include file="end.asp" -->
<%
rsr.Close()
%>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -