📄 request.asp
字号:
<!--#include file="i_login.asp"-->
<%
Response.Expires = 0
keyword=trim(request("keyword"))
page=clng(request("page"))
select case mode
case "del"
call del_sub(trim(request("id")))
case "Batch"
call Batch_sub()
case "save"
call save_sub()
end select
sub Batch_sub()
dim Submit
Submit=trim(request.Form("Submit"))
select case Submit
case "删 除"
call Batch_delete()
end select
end sub
sub save_sub()
dim email
email=trim(request.Form("email"))
conn.execute("update [data_request_config] set email='"&email&"' where id=1 ")
end sub
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>request</title>
<LINK href="images/style.css" type=text/css rel=stylesheet>
<script language="javascript" src="../inc/functions.js"></script>
<script language="javascript">
function chk_select(id){
if (id.length>1)
{ for (j=0;j<id.length;j++) if (id[j].checked==true) break;
if (j==id.length) { alert("未选择!"); return false; }
} else
if (id.checked==false) { alert("未选择!"); return false; }
return true;
}
function chk_delete(id){
if(chk_select(id))
{
if(confirm('确定删除吗?')){return true;}else{return false;}
}
else
{
return false;
}
}
</script>
<script language="javascript" src="../inc/prototype.js"></script>
<script language="JavaScript" type="text/JavaScript">
<!--
function read_fun(id)
{
var request_url = "request_read_save.asp";
var request_pars = 'id='+id;
var myAjax = new Ajax.Updater('result', request_url,{
method : 'post',
parameters : request_pars,
onFailure : reportError,
onLoading : loading,
onComplete : done
});
function loading(){}
function done(Request)
{
if(Request.responseTEXT=="true"){
$("t_"+id).style.color='#C2BDBD';
}else
{
$("t_"+id).style.color='#ff0000';}}
function reportError(request){}
}
function save_fun(id,str)
{
var request_url = "request_save.asp";
var request_pars = 'id='+id+'&str='+str;
var myAjax = new Ajax.Updater('result', request_url,{
method : 'post',
parameters : request_pars,
onFailure : reportError,
onLoading : loading,
onComplete : done
});
function loading(){}
function done(Request){if(Request.responseTEXT=="true"){$("b_"+id).innerHTML=str.substr(0, 10);}}
function reportError(request){}
}
-->
</script>
</head>
<body >
<table width="98%" border="0" align="center" cellpadding="5" cellspacing="0">
<tr>
<td width="43%" align="left"> <span class="gray"> CMS >> 留言管理</span></td>
<td width="57%" align="right"><table border="0">
<form name="form" method="get" action="?">
<tr>
<td nowrap><input name="keyword" type="text" id="keyword"
<%
response.write "value="""&keyword&""""
%>
size="25">
</td>
<td nowrap><input type="submit" name="Submit2" value=" 搜 索 "></td>
<td nowrap><span class="gray">(关键字之间用空格分开!)</span></td>
</tr>
</form>
</table></td>
</tr>
</table>
<form name="form1" method="post" action="?keyword=<%=keyword%>&page=<%=page%>">
<input name="mode" type="hidden" value="Batch">
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#C2BDBD">
<tr>
<td width="5%" height="25" align="center" nowrap bgcolor="#CCCCCC">ID</td>
<td width="22%" align="center" nowrap bgcolor="#CCCCCC">内容</td>
<td width="15%" align="center" nowrap bgcolor="#CCCCCC">公司</td>
<td width="10%" align="center" nowrap bgcolor="#CCCCCC">姓名</td>
<td width="11%" align="center" nowrap bgcolor="#CCCCCC">电话</td>
<td width="11%" align="center" nowrap bgcolor="#CCCCCC">时间</td>
<td width="16%" align="center" nowrap bgcolor="#CCCCCC">备注</td>
<td width="10%" align="center" nowrap bgcolor="#CCCCCC">操作</td>
</tr>
<%
sql_where=keyword_sousuo("name,company,phone,fax,email,content,bz",keyword)
Set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from data_request where "&sql_where&" order by id desc"
rs.Open sql,conn,1,2
if rs.eof and rs.bof then
response.Write("无留言")
else
rs.PageSize=15
if page=0 then page=1
pages=rs.pagecount
if page > pages then page=pages
rs.AbsolutePage=page
for j=1 to rs.PageSize
%>
<tr bgcolor="#FFFFFF">
<td height="22" align="center" nowrap><input type="checkbox" name="id" value="<%=rs("id")%>"></td>
<td nowrap style="cursor:hand;" >
<%
if rs("read")=0 then
str_color="color:#ff0000;"
str_read_fun="read_fun('"&rs("id")&"');"
else
str_color=""
str_read_fun=""
end if
response.Write(" <span id=""t_"&rs("id")&""" style=""cursor:pointer;"&str_color&""" onClick=""javascript:showList(show_"&rs("id")&");"&str_read_fun&""" >"&keyword_tag(cutStr(rs("content"),16),keyword)&"</span>")
%></td>
<td align="center" nowrap><%=keyword_tag(rs("company"),keyword)%></td>
<td align="center" nowrap><%=keyword_tag(rs("name"),keyword)%></td>
<td align="center" nowrap <%
response.Write("title=""传真:"&rs("fax")&""&vbcrlf)
response.Write("Email:"&rs("email")&""""&vbcrlf)
%> >
<%=keyword_tag(rs("phone"),keyword)%></td>
<td align="center" nowrap>
<%
if rs("addtime")<>"" then
if DateDiff("d",rs("addtime"),now())>0 then
response.Write formatdatetime(rs("addtime"),2)
else
response.Write formatdatetime(rs("addtime"),3)
end if
end if
%></td>
<td align="center" nowrap><%
response.Write(" <span id=""b_"&rs("id")&""" style=""cursor:pointer;"" onClick=""javascript:showList(show_"&rs("id")&");"&str_read_fun&""" >"&keyword_tag(cutStr(rs("bz"),10),keyword)&"</span>")
%></td>
<td align="center" nowrap>
<span style="cursor:pointer;color:#FF0000" onClick="javascript:showList(show_<%=rs("id")%>);<%=str_read_fun%>" >查 看</span>
<a href="?mode=del&id=<%=rs("id")%>&keyword=<%=server.URLEncode(keyword)%>&page=<%=page%>" onClick="javascript:if(confirm('确定删除吗?')){return true;}else{return false;}">删 除</a></td>
</tr> <tr id="show_<%=rs("id")%>" style="display:none;">
<td height="37" colspan="8" bgcolor="#FFFFFF">
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" class="contactForm">
<tbody>
<tr>
<td width="65" align="right" bgcolor="#CEF0FF">公司名称:</td>
<td width="636" bgcolor="#E8F8FF"><%=rs("company")%></td>
</tr>
<tr>
<td align="right" bgcolor="#CEF0FF">姓名:</td>
<td bgcolor="#E8F8FF"><%=rs("name")%></td>
</tr>
<tr>
<td align="right" bgcolor="#CEF0FF">电话:</td>
<td bgcolor="#E8F8FF"><%=rs("phone")%></td>
</tr>
<tr>
<td align="right" bgcolor="#CEF0FF">传真:</td>
<td bgcolor="#E8F8FF"><%=rs("fax")%></td>
</tr>
<tr>
<td align="right" bgcolor="#CEF0FF">Email:</td>
<td bgcolor="#E8F8FF"><%=rs("email")%></td>
</tr>
<tr>
<td height="50" align="right" valign="top" bgcolor="#CEF0FF">内容:</td>
<td valign="top" bgcolor="#E8F8FF"><%=rs("content")%></td>
</tr>
<tr>
<td height="50" align="right" valign="top" bgcolor="#CEF0FF">备注</td>
<td valign="top" bgcolor="#E8F8FF"><textarea name="bz_<%=rs("id")%>" cols="45" rows="5" class="input" id="bz_<%=rs("id")%>"><%=rs("bz")%></textarea><input name="tj_<%=rs("id")%>" type="button" id="tj_<%=rs("id")%>" onClick="javascript:showList(show_<%=rs("id")%>);save_fun(<%=rs("id")%>,bz_<%=rs("id")%>.value);" value=" 保 存 "></td>
</tr>
</tbody>
</table> </td>
</tr>
<%
rs.movenext
if rs.eof then exit for
next
%>
</table>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="37"><input type="button" name="buttonfx" id="buttonfx2" value=" 反 选 " onClick="checkAll(this.form);" />
<input type="submit" name="Submit" value=" 删 除 " onClick="return chk_delete(this.form.id);"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="30" align="center">
<%
response.Write("共"&rs.recordcount&"条留言 ")
call showpage_fun(rs.pagecount,page,4)
%> </td>
</tr>
</table>
</form>
<%
end if
rs.close
set rs=nothing
%>
<%
If IsObjInstalled("JMAIL.Message") Then
response.Write("<br>")
else
response.Write("<p style=""color:#FF0000; text-align:center;"">你的服务器不支持jmail,不能发生邮件。</p>")
end if
%>
<table height="38" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
<form name="formemail" method="post" action="?">
<input name="mode" value="save" type="hidden">
<tr>
<td bgcolor="#ffffe1"><span class="gray">有新留言时将副本转发至</span>EMAIL:
<%
set rs=conn.execute("select email from data_request_config where id=1")
if not rs.eof then
email=rs(0)
end if
rs.close
set rs=nothing
%>
<input type="text" name="email" id="email" onBlur="if(this.value!='' && !/^[a-zA-Z0-9_\-]{1,}@[a-zA-Z0-9_\-]{1,}\.[a-zA-Z0-9_\-.]{1,}$/.test(this.value)){alert('EMAIL格式不正确!');this.value='';this.focus();}" value="<%=email%>">
<span class="gray">(可以为空)</span>
<input type="submit" name="button" id="button" value="保存"></td>
</tr></form>
</table>
</body>
</html>
<%
conn.close
set conn=nothing
%>
<%
sub Batch_delete()
dim ids,rs
ids=trim(request.Form("id"))
if ids<>"" then
set rs=conn.execute("select id from data_request where id in ("&ids&")")
while not rs.eof
del_sub(rs(0))
rs.movenext
wend
rs.close
set rs=nothing
end if
end sub
sub del_sub(byval id)
dim rs
if id="" then
response.Write("<script>alert('ERR!');</script>")
end if
conn.execute("delete from data_request where id="&id&"")
end sub
sub time_sub()
dim id
id=trim(request("id"))
if id="" then
response.Write("<script>alert('ERR!');</script>")
end if
conn.execute("update data_request set updatetime=now() where id="&id&"")
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -