📄 consultation.asp
字号:
<!--#include file="connection.asp"-->
<!--#include file="char.asp"-->
<!--#include file="webconfig.asp"-->
<%dim Action
Action=request.QueryString("Action")
if Action="Save" then Call SaveInfo()
%>
<HTML><HEAD><TITLE><%=webname%>--在线咨询</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2722.900" name=GENERATOR>
<link href="images/default.css" rel="stylesheet" type="text/css">
</HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function check()
{
if(checkspace(document.Cform.UserName.value)) {
document.Cform.UserName.focus();
alert("请输入您的姓名或网名!");
return false;
}
if(checkspace(document.Cform.Content.value)) {
document.Cform.Content.focus();
alert("请输入您要咨询的问题!");
return false;
}
if(document.Cform.UserEmail.value.length!=0)
{
if (document.Cform.UserEmail.value.charAt(0)=="." ||
document.Cform.UserEmail.value.charAt(0)=="@"||
document.Cform.UserEmail.value.indexOf('@', 0) == -1 ||
document.Cform.UserEmail.value.indexOf('.', 0) == -1 ||
document.Cform.UserEmail.value.lastIndexOf("@")==document.Cform.UserEmail.value.length-1 ||
document.Cform.UserEmail.value.lastIndexOf(".")==document.Cform.UserEmail.value.length-1)
{
alert("您的Email地址格式不正确!");
document.Cform.UserEmail.focus();
return false;
}
}
else
{
alert("您的Email不能为空!");
document.Cform.UserEmail.focus();
return false;
}
}
function checkspace(checkstr) {
var str = '';
for(i = 0; i < checkstr.length; i++) {
str = str + ' ';
}
return (str == checkstr);
}
//-->
</script>
<BODY bgColor=#ffffff text=#000000 leftmargin="0" topMargin=0 marginwidth="0" marginheight="0" onMouseOver="window.status='【<%=webname%>】<%=weburl%> 如果您喜欢本站,别忘了把本站介绍给您的好友哦!:)';return true">
<!--#include file="webtop.asp"-->
<table width="776" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FF8E19">
<tr>
<td colspan="2"><table width="734" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2"><img src="images/online_r1_c1.gif" width="734" height="93"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="533"><div align="center">
</div></td>
<td width="201"><img src="images/online_r2_c4.gif" width="734" height="34"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="88%" valign="top">
<p align="center"><a href="Consultation.asp?Action=Write"><br>
<img src="images/online_r3_c2.gif" alt="点击发布咨询" width="191" height="38" border="0"></a> </p>
<p>
<%if Action="Write" then
Call WriteInfo()
else%>
<%'开始分页
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")
rs.open "select UserName,AddDate,Content,[Restore],RestoreAff from Consultation order by AddDate desc",conn,1,1
if err.number<>0 then
response.write "数据库中无数据"
end if
if rs.eof And rs.bof then
Response.Write "<p align='center' class='contents'>目前还没有任何用户发布咨询!<br><a href=Consultation.asp?Action=Write><font color=#3333FF>我要发布咨询</font></a></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,"Consultation.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"Consultation.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"Consultation.asp"
end if
end if
end if
sub showContent
dim i
i=0
%>
</p>
<table width="96%" border="0" align="center" cellpadding="3" cellspacing="0" bgcolor="#FFD55A">
<%do while not rs.eof%>
<tr>
<td width="32%" style="padding-left:6px">咨询者:<%=ubbcode(trim(rs("UserName")))%></td>
<td width="48%">发表时间:<%=cdate(rs("AddDate"))%></td>
<td width="20%"><div align="center"><a href=Consultation.asp?Action=Write></a></div></td>
</tr>
<tr>
<td colspan="3" style="padding-left:6px">咨询内容:<br> <%=ubbcode(trim(rs("Content")))%>
</td>
</tr>
<tr bgcolor="#FF8E19">
<td colspan="3" style="padding-left:6px">
<%if int(rs("RestoreAff"))=0 then
response.write "<font color=#ffffff>请等待我们的回复!</font>"
else
response.write "<font color=#FF8E19>回复:</font>"&ubbcode(trim(rs("Restore")))
end if%>
</td>
</tr>
<tr>
<td colspan="3" bgcolor="#FFFFFF"><img src="images/grayline.gif" width="705" height="10"></td>
</tr>
<%i=i+1
if i>=MaxPerPage then Exit Do
rs.movenext
loop
rs.close
set rs=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>首页</a> "
Response.Write "<a href="&filename&"?page="&CurrentPage-1&"> 上一页</a> "
End If
If n-currentpage<1 Then
Response.Write " 下一页 尾页"
Else
Response.Write " <a href="&filename&"?page="&(CurrentPage+1)&">"
Response.Write "下一页</a> <a href="&filename&"?page="&n&">尾页</a>"
End If
Response.Write " 当前页次:"&CurrentPage&"/"&n&"页 </div>"
End Function
end if '这里是判断WriteInfo的end If
%> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<table width="776" height="12" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#FF8E19"> </td>
</tr>
</table>
<!--#include file="service.asp"-->
<!--#include file="copyright.asp"-->
</BODY></HTML>
<%sub WriteInfo()%>
<table width="96%" border="0" align="center" cellpadding="3" cellspacing="0" bgcolor="#FDE6A4">
<form name="Cform" method="post" action="Consultation.asp?Action=Save">
<tr bgcolor="#FFFFFF">
<td height="12" colspan="2"><div align="center">您可以发表您所有的咨询问题:*为必填项</div></td>
</tr>
<tr>
<td width="18%" style="padding-left:6px">姓 名:
<font color=red>*</font></td>
<td width="82%" style="padding-left:6px"><input name="UserName" type="text" id="UserName"></td>
</tr>
<tr>
<td style="padding-left:6px">信 箱: <font color=red>*</font></td>
<td style="padding-left:6px"><input name="UserEmail" type="text" id="UserEmail"></td>
</tr>
<tr>
<td style="padding-left:6px">电 话:</td>
<td style="padding-left:6px"><input name="UserTel" type="text" id="UserTel"></td>
</tr>
<tr>
<td style="padding-left:6px">地 址:</td>
<td style="padding-left:6px"><input name="UserAddr" type="text" id="UserAddr"></td>
</tr>
<tr>
<td style="padding-left:6px">咨询问题: <font color=red>*</font></td>
<td style="padding-left:6px"><textarea name="Content" cols="50" rows="7" id="Content"></textarea></td>
</tr>
<tr>
<td height="36" colspan="2"><div align="center">
<input type="submit" name="Submit2" value="提 交" onClick="return check();">
<input type="reset" name="Submit3" value="返 回" onClick="location.href='Consultation.asp'">
</div></td>
</tr>
</form>
</table><br>
<%end sub
sub SaveInfo()
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from Consultation",conn,1,3
rs.addnew
rs("UserName")=replace(trim(request("UserName")),"'","")
rs("UserTel")=replace(trim(request("UserTel")),",","")
rs("UserEmail")=trim(request("UserEmail"))
rs("UserAddr")=replace(trim(request("UserAddr")),"'","")
rs("Content")=trim(request("Content"))
rs("UserIp")=Request.serverVariables("REMOTE_ADDR")
rs("RestoreAff")=0
rs("AddDate")=now()
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write "<script language=javascript>alert('您的咨询问题已成功提交!');window.location.reload('Consultation.asp')</script>"
response.End()
end sub%>
<%conn.close
set conn=nothing%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -