⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 contact.asp

📁 ASP网页
💻 ASP
字号:

<%@ Language=VBScript%>
<%
Response.Buffer=true
Response.Expires=0
%>
<!-- #include file="../dsn.asp" -->
<%
set cn = Server.CreateObject("ADODB.Connection")
cn.Open(mycnstr)
set rs = Server.CreateObject("ADODB.Recordset")
set rs2 = Server.CreateObject("ADODB.Recordset")
	
sqltext="select * from syswork where code='101'"
rs.Open sqltext,cn,1,1
if not rs.EOF then
	co_address=trim(rs("address"))
	co_phone=trim(rs("phone"))
	co_email=trim(rs("email"))
	co_fax=trim(rs("fax"))
	co_linkman=trim(rs("linkman"))
	co_zip=trim(rs("zip"))
end if
rs.close

mymenu="contact"
flag=Request.QueryString("flag")

if Request.ServerVariables("REQUEST_METHOD")="POST" then
	topic=Request.Form("topic")
	email=Request.Form("email")
	myname=Request.Form("myname")
	corpname=Request.Form("corpname")
	address=Request.Form("address")
	phone=Request.Form("phone")
	fax=Request.Form("fax")
	content=Request.Form("content")

	mailstr="姓名:" + myname + chr(10) + chr(13)
	mailstr=mailstr + "单位:" + corpname + chr(10) + chr(13)
	mailstr=mailstr + "电话:" + phone + chr(10) + chr(13)
	mailstr=mailstr + "地址:" + address + chr(10) + chr(13)
	mailstr=mailstr + "传真:" + fax + chr(10) + chr(13)
	mailstr=mailstr + "内容:" + content + chr(10) + chr(13)
	
	Set msg = Server.CreateObject("JMail.Message")
	msg.silent = true
	msg.Logging = true
	msg.Charset = "gb2312"
	msg.MailServerUserName = "online-email@163.com"   '输入smtp服务器验证登陆名 
	msg.MailServerPassword = "email123"           '输入smtp服务器验证密码   (用户Email帐号对应的密码)
	msg.From = "online-email@163.com"
	msg.FromName = myname				          '发件人姓名
	msg.AddRecipient co_email			          '收件人Email
	msg.AddRecipientBCC  "napoleon@ibw.com.cn"	  '密件传送'
	msg.Subject = "氯碱化工网站留言"			  '信件主题
	msg.Body = "主题:"+topic++chr(10)+chr(13)+mailstr  '正文
	msg.Send ("smtp.163.com")               'smtp服务器地址(企业邮局地址)
	set msg = nothing
	
	rs.Open "contact",cn,3,3
	rs.AddNew
	rs("title")=topic
	rs("email")=email
	rs("myname")=myname
	rs("corpname")=corpname
	rs("phone")=phone
	rs("fax")=fax
	rs("content")=content
	rs("address")=address
	rs("creadate")=now()
	rs("sysemail")=co_email
	rs.Update
	rs.Close
	Response.Redirect("contact.asp?flag=1")
end if
%>
<!-- #include file="begin.asp" -->

<TABLE WIDTH="778" BORDER="0" CELLSPACING="0" CELLPADDING="0">
  <TR VALIGN="TOP"> 
    <TD WIDTH="180">
      <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
        <TR> 
          <TD><IMG SRC="../images/title_inside.gif" WIDTH="180" HEIGHT="32"></TD>
        </TR>
        <TR> 
          <TD>&nbsp;</TD>
        </TR>
        <TR> 
          <TD BGCOLOR="#cccccc"><IMG SRC="../images/spacer.gif" WIDTH="1" HEIGHT="1"></TD>
        </TR>
        <TR> 
          <TD bgcolor="efefef" CLASS="bodytext" ALIGN="RIGHT">
				地址:<%=co_address%><BR>
				电子信箱:<a href="mailto:<%=co_email%>"><%=co_email%></a><BR>
				电话:<%=co_phone%><BR>
				传真:<%=co_fax%><BR>
				邮编:<%=co_zip%><BR>
		  </TD>
        </TR>
        <TR> 
          <TD BGCOLOR="#cccccc"><IMG SRC="../images/spacer.gif" WIDTH="1" HEIGHT="1"></TD>
        </TR>
        <TR> 
          <TD>&nbsp;</TD>
        </TR>
      </TABLE>
    </TD>
    <TD WIDTH="1" BGCOLOR="#9C9A9C"><IMG SRC="../images/spacer.gif" WIDTH="1" HEIGHT="1"></TD>
    <TD>
      <P><IMG SRC="../images/title_contact.jpg" WIDTH="597" HEIGHT="57"></P>
       <%if flag="1" then%>
			<table width="70%" border="0" cellspacing="0" cellpadding="0" align="center" valign=middle>
				<tr>
					<td style="font-size:12px;color:ff0000;" height=40><b>您的留言已发送成功!<br></b></td>
				</tr>
			</table>
		<%else%>
			<br>			
		<%end if%>
      <TABLE WIDTH="90%" BORDER="0" CELLSPACING="0" CELLPADDING="0" VALIGN=top>
		  <tr><td width=30>&nbsp;</td><td class="fontcb">	
				<b>请填写下面的内容并提交</b>
          </TD></TR>
      </TABLE>
      <TABLE WIDTH="90%" BORDER="0" CELLSPACING="0" CELLPADDING="0" VALIGN=top STYLE="line-height:200%">
		<form name=contactform method="post" action="contact.asp" onsubmit="return checkcontact(contactform)" autocomplete = "off">
          <TR> 
            <TD CLASS="font1" width=120 align=right>留言主题:</TD><td width=10>&nbsp;</td>
            <TD> 
              <INPUT TYPE="text" NAME="topic" MAXLENGTH=50 SIZE=40 class=input>
            </TD>
          </TR>
          <TR> 
            <TD CLASS="font1" width=120 align=right>Email:</TD><td width=10>&nbsp;</td>
            <TD> 
              <INPUT TYPE="text" NAME="email" MAXLENGTH=50 SIZE=40 class=input>
            </TD>
          </TR>
          <TR> 
            <TD CLASS="font1" width=120 align=right>姓名:</TD><td width=10>&nbsp;</td>
            <TD> 
              <INPUT TYPE="text" NAME="myname" MAXLENGTH=20 SIZE=20 class=input>
            </TD>
          </TR>
          <TR> 
            <TD CLASS="font1" width=120 align=right>单位名称:</TD><td width=10>&nbsp;</td>
            <TD> 
              <INPUT TYPE="text" NAME="corpname" MAXLENGTH=50 SIZE=40 class=input>
            </TD>
          </TR>
          <TR> 
            <TD CLASS="font1" width=120 align=right>地址:</TD><td width=10>&nbsp;</td>
            <TD> 
              <INPUT TYPE="text" NAME="address" MAXLENGTH=50 SIZE=40 class=input>
            </TD>
          </TR>
          <TR> 
            <TD CLASS="font1" width=120 align=right>联系电话:</TD><td width=10>&nbsp;</td>
            <TD> 
              <INPUT TYPE="text" NAME="phone" MAXLENGTH=30 SIZE=40 class=input>
            </TD>
          </TR>
          <TR> 
            <TD CLASS="font1" width=120 align=right>传真:</TD><td width=10>&nbsp;</td>
            <TD> 
              <INPUT TYPE="text" NAME="fax" MAXLENGTH=30 SIZE=30 class=input>
            </TD>
          </TR>
          <TR> 
            <TD CLASS="font1" width=120 align=right>内容:</TD><td width=10>&nbsp;</td>
            <TD> 
              <TEXTAREA ROWS=10 COLS=50 NAME=content CLASS="input"></TEXTAREA>
            </TD>
          </TR>
          <TR> 
            <TD ALIGN=center HEIGHT=50 VALIGN=middle>&nbsp;&nbsp;&nbsp;&nbsp; </TD><td width=10>&nbsp;</td>
            <TD HEIGHT=30 VALIGN=middle>&nbsp;&nbsp;&nbsp;&nbsp;
            <input type=image src="../images/btn_submit.gif" WIDTH="73" HEIGHT="17" BORDER="0">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <A HREF="JavaScript:document.contactform.reset();"><IMG SRC="../images/btn_reset.gif" WIDTH="73" HEIGHT="17" BORDER="0"></A></TD>
          </TR>
          </form>
      </TABLE>
      <P>&nbsp;</P>
    </TD>
  </TR>
</TABLE>

<!-- #include file="end.asp" -->
<!-- #include file="func.asp" -->
<script language=Javascript>

	function checkcontact(form)
	{
		var flag=true;

		if(form("topic").value==""){alert("请输入留言主题!");form("topic").focus();return false;}
		if(form("myname").value==""){alert("请输入您的姓名!");form("myname").focus();return false;}
		
		if (flag==true) {flag=checkchar(form("topic").value)} 
		if (flag==true) {flag=checkchar(form("email").value)} 
		if (flag==true) {flag=checkchar(form("myname").value)} 
		if (flag==true) {flag=checkchar(form("address").value)} 
		if (flag==true) {flag=checkchar(form("corpname").value)} 
		if (flag==true) {flag=checkchar(form("phone").value)} 
		if (flag==true) {flag=checkchar(form("fax").value)} 
		if (flag==true) {flag=checkchar(form("content").value)} 
		
		return flag;
	}

	function checkchar(str)
	{
		str=str.toLowerCase()
		oldstr=str
		str="2"+str
		if (str.search("<"+"%")>0)  
		{
			window.alert("("+oldstr+")中有非法字符,请检查!");
			return false;
		}
		if (str.search("<scrip"+"t")>0)
		{
			window.alert("("+oldstr+")中有非法字符,请检查!");
			return false;
		}
		return true;
	}
	
</script>	

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -