📄 listconsultation.asp
字号:
<!--#include file="connection.asp"-->
<!--#include file="Vchar.asp"-->
<%if session("admin")="" then
response.write "<script language=javascript>alert('网络超时或者您还没有登陆!');window.location.reload('Login.asp')</script>"
response.End()
end if%>
<!--#include file="../Char.asp"-->
<%dim RestoreAff,Action,ConsultationId
RestoreAff=request.QueryString("RestoreAff")
Action=request.QueryString("Action")
ConsultationId=int(request.QueryString("ConsultationId"))
select Case Action
case "Del"
call DelInfo()
case "Save"
call SaveInfo()
end select%>
<html>
<head>
<title>管理在线咨询</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="admin.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
background-color: #f1f1f1;
}
-->
</style></head>
<body>
<%if Action="Edit" then call EditInfo()%>
<table width="96%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#5d5d5d">
<tr>
<td height="18" background="images/admin_bg.gif"><div align="center"><font color="#FFFFFF"><strong>管理在线咨询</strong></font></div></td>
</tr>
<tr>
<td height="63" bgcolor="#dfdfdf"><br>
<table width="92%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
<tr bgcolor="#cecece">
<td width="50%"><div align="center"><a href="ListConsultation.asp?RestoreAff=0"><font color="#ff6600">查看未回复的咨询</font></a></div></td>
<td><div align="center"><a href="ListConsultation.asp?RestoreAff=1"><font color="#ff6600">查看已回复的咨询</font></a></div></td>
</tr>
<tr bgcolor="#cecece">
<td height="25" colspan="2">
<%'开始分页
Const MaxPerPage=8
dim totalPut
dim CurrentPage
dim TotalPages
dim j
dim sql
if Not isempty(request("page")) then
currentPage=Cint(request("page"))
else
currentPage=1
end if
set rs=server.CreateObject("adodb.recordset")
select case RestoreAff
case "0"
rs.open "select * from Consultation where RestoreAff=0 order by AddDate desc",conn,1,1
case "1"
rs.open "select * from Consultation where RestoreAff=1 order by AddDate desc",conn,1,1
case else
rs.open "select * from Consultation order by AddDate desc",conn,1,1
end select
if err.number<>0 then
response.write "数据库中无数据"
end if
if rs.eof And rs.bof then
Response.Write "<p align='center' class='contents'>在数据库中没有找到您想得到的记录!</p>"
else
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
showContent
showpage totalput,MaxPerPage,"ListConsultation.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"ListConsultation.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"ListConsultation.asp"
end if
end if
end if
sub showContent
dim i
i=0
%>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<%do while not rs.eof%>
<tr>
<td width="21%">咨询者:<a href=mailto:<%=trim(rs("UserEmail"))%>><%=ubbcode(trim(rs("UserName")))%></a></td>
<td width="30%">发表时间:<%=cdate(rs("AddDate"))%></td>
<td width="35%"><div align="center"><span onclick="alert('地址:<%=trim(rs("UserAddr"))%>,联系电话:<%=trim(rs("UserTel"))%>,访问IP:<%=trim(rs("UserIp"))%>')">咨询者地址、电话及访问者IP地址</span></div></td>
<td width="14%"><div align="center"><a href=ListConsultation.asp?Action=Edit&ConsultationId=<%=rs("ConsultationId")%>><%if int(rs("RestoreAff"))=0 then response.write "回复" else response.write "修改" end if%></a> <a href=ListConsultation.asp?Action=Del&ConsultationId=<%=rs("ConsultationId")%> onClick="return confirm('您确定要删除吗?')">删除</a></div></td>
</tr>
<tr>
<td colspan="4">咨询内容:<%=ubbcode(trim(rs("Content")))%>
</td>
</tr>
<tr>
<td colspan="4"><%if int(rs("RestoreAff"))=0 then
response.write "未回复!"
else
response.write "<font color=#3333FF>本站管理员回复:</a>"&ubbcode(trim(rs("Restore")))
end if%></td>
</tr>
<tr>
<td colspan="4"><hr width="100%" size="1" color=#ffffff></td>
</tr>
<%i=i+1
if i>=MaxPerPage then Exit Do
rs.movenext
loop
rs.close
set rs=nothing
conn.close
set conn=nothing%>
</table>
<%
End Sub
Function showpage(totalnumber,maxperpage,filename)
Dim n
If totalnumber Mod maxperpage=0 Then
n= totalnumber \ maxperpage
Else
n= totalnumber \ maxperpage+1
End If
Response.Write "<div align='right' > "
Response.Write "共有"&totalnumber&"条信息 "&maxperpage&"条信息/页"
If CurrentPage<2 Then
Response.Write " 首页 上一页"
Else
Response.Write "<a href="&filename&"?page=1&RestoreAff="&RestoreAff&"> 首页</a> "
Response.Write "<a href="&filename&"?page="&CurrentPage-1&"&RestoreAff="&RestoreAff&"> 上一页</a> "
End If
If n-currentpage<1 Then
Response.Write " 下一页 尾页"
Else
Response.Write "<a href="&filename&"?page="&(CurrentPage+1)&"&RestoreAff="&RestoreAff&">"
Response.Write " 下一页</a> <a href="&filename&"?page="&n&"&RestoreAff="&RestoreAff&">尾页</a>"
End If
Response.Write " 当前页次:"&CurrentPage&"/"&n&"页 </div>"
End Function
%> </td>
</tr>
</table>
<br> </td>
</tr>
</table><!--#include file="Copyright.asp"-->
</body>
</html>
<%sub EditInfo()%>
<table width="96%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#6396D6">
<tr>
<td height="18" background="images/admin_bg.gif"><div align="center"><font color=#ffffff><b>回复/修改咨询信息</b></font></div></td>
</tr>
<tr>
<td height="40" bgcolor="#DEE7FF"><br>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="1">
<%set rs=server.CreateObject("adodb.recordset")
rs.open "select Content,[Restore] from Consultation where ConsultationId="&ConsultationId,conn,1,1%><form name="form1" method="post" action="ListConsultation.asp?Action=Save&ConsultationId=<%=ConsultationId%>">
<tr>
<td colspan="2" bgcolor="#DEE7FF" style="Padding-left:6px"><font color=#ff6600>咨询信息:</font><br> <%=ubbcode(trim(rs("Content")))%></td>
</tr><tr><td height=10></td></tr>
<tr>
<td width="12%" bgcolor="#DEE7FF"style="Padding-left:6px">回复信息: </td>
<td width="88%" bgcolor="#DEE7FF"style="Padding-left:6px"><textarea name="Restore" cols="68" rows="8" id="Restore"><%=trim(rs("Restore"))%></textarea></td>
</tr>
<tr>
<td bgcolor="#DEE7FF"style="Padding-left:6px"><input type="hidden" name="Url" value=<%=Request.ServerVariables("HTTP_REFERER")%>></td>
<td bgcolor="#DEE7FF"style="Padding-left:6px"><input type="submit" name="Submit" value="提交回复"></td>
</tr>
</form>
</table>
<br>
</td>
</tr>
</table>
<!--#include file="copyright.asp"-->
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
response.End()
end sub
sub SaveInfo()
set rs=server.CreateObject("adodb.recordset")
rs.open "select [Restore],RestoreAff from Consultation where ConsultationId="&ConsultationId,conn,1,3
rs("Restore")=trim(request("Restore"))
rs("RestoreAff")=1
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write "<script language=javascript>alert('回复信息更新成功!');window.location.reload('"&trim(request("Url"))&"')</script>"
response.End()
end sub
sub DelInfo()
conn.execute "delete from Consultation where ConsultationId="&ConsultationId
response.redirect Request.ServerVariables("HTTP_REFERER")
end sub
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -