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

📄 contact.asp

📁 一个不错的企业网站源代码!
💻 ASP
字号:
<%@ Language=VBScript%>
<%
Response.Buffer=false
Response.Expires=0
%>
<!-- #include file="dsnroot.asp" -->
<!-- #include file="links.asp" -->
<%
set cn=Server.CreateObject("ADODB.Connection")
cn.Open mycnstr
set rs=server.CreateObject("ADODB.Recordset")
menu="11111112"
sendok=0
sendok=cint(Request.QueryString("sendok"))
id=Request.QueryString("id")
if id="" then
		id=0
	else
		id=cint(id)
end if
if id=0 then		
		sqltext="select top 1 * from ecount where enable=1 order by pl"
		rs.Open sqltext,cn,1,1
		if not rs.EOF then
				id=rs("id")
		end if
		rs.Close 	
end if
if id<>0 then
		sqltext="select top 1 * from ecount where enable=1 and id="&id
		rs.Open sqltext,cn,1,1
		if not rs.EOF then
				toname=rs("name")
				email=rs("email")
				totel=rs("tel")
				tofax=rs("fax")
				toadd=rs("add")
				topostyb=rs("postyb")
		end if
		rs.Close 	
end if		
if sendok=0 then
if Request.ServerVariables("REQUEST_METHOD") = "POST" and email<>"" then
		sender = Request.Form("from")
		subject = Request.Form("subject")
		content=Request.Form("body")
		name = Request.Form("name")
		company = Request.Form("company")
		address = Request.Form("address")
		telphone = Request.Form("telphone")
		fax = Request.Form("fax")
		content=Request.Form("body")
				sqltext="select * from contact"
				rs.Open sqltext,cn,1,2
				rs.AddNew 
				rs("title")=subject
				rs("email")=sender
				rs("name")=name
				rs("toname")=toname
				rs("compa")=company
				rs("add")=address
				rs("tel")=telphone
				rs("fax")=fax
				rs("body")=content
				rs("toid")=checkrad
				rs("creatdate")=now()
				rs("flag")=1
				rs.Update 
				rs.Close
				s_string="姓名:" & name & chr(13) & chr(10) & "时间:" & now() & chr(13) & chr(10) & "公司:" & company & chr(13) & chr(10) & "地址:" & address & chr(13) & chr(10) & "电话:" & telphone & chr(13) & chr(10) & "传真:" & fax

				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" '发件人Email
				msg.FromName = name				  '发件人姓名
				msg.AddRecipientBCC "xhaiy@163.net"		 '密件传送'
				msg.Subject = "安徽天宏集团网站英文版留言:"&subject			 '信件主题
				msg.Body = "主题:"&subject&chr(13)&chr(10)&s_string&chr(13)&chr(10)&content  '正文
				msg.AddRecipient email			 '收件人Email
				msg.Send ("smtp.163.com")               'smtp服务器地址(企业邮局地址)
				set msg = nothing
				'set myobj=Server.CreateObject("cdonts.newmail")
				'myobj.From=sender
				'myobj.To="   "
				'myobj.BodyFormat=0
				'myobj.Subject="公众留言:"+subject
				'myobj.Body= "----------------来自"+sender+"的邮件--------------"+chr(10)+chr(13)+s_string+chr(10)+chr(13)+content
				'myobj.Send()
				Response.Redirect(linkcontact&"?sendok=1&id="&id)	

end if
end if
%>
<!-- #include file="design.asp" -->
<table width="778" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF">
  <tr> 
    <td bgcolor="#66cc00" width="1"></td>
    <td width="190" valign="top" background="images/group/left_p_group.jpg" style="background-repeat: no-repeat; background-position: bottom"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><img src="images/group/left_top_p.jpg" width="190" height="45"></td>
        </tr>
      </table>
      <table width="180" border="0" cellspacing="0" cellpadding="0" align="center">
        <tr> 
          <td><img src="images/contact/tp_contact.jpg" width="180" height="39"></td>
        </tr>
        <tr> 
          <td background="images/group/left_nav_bg.jpg"> 
            <table width="80%" border="0" cellspacing="0" cellpadding="0" align="center">
              <%sqltext="select id,name from ecount where enable=1 order by pl"
                rs.Open sqltext,cn,1,1
                do while not rs.EOF
              	 if id=rs("id") then
					fontcolor="#ff9900"
				 else
					fontcolor="#000000"	
			    end if
              %>
              <tr> 
                <td height="6"></td>
              </tr>
              <tr> 
                <td class="font3" width=10>&nbsp;&nbsp;※</td>
                <td class="font3"><a href="<%=linkcontact%>?id=<%=rs("id")%>" class="anews2"><font color="<%=fontcolor%>"><%=trim(rs("name"))%></font></a></td>
				</td>
              </tr>
              <%rs.MoveNext 
               loop
               rs.Close %>
            </table>
            
          </td>
        </tr>
        <tr> 
          <td><img src="images/group/left_nav_bot.jpg" width="180" height="89"></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0" height="50">
        <tr>
          <td>&nbsp;</td>
        </tr>
      </table>
    </td>
    <td background="images/line_v.gif" width="1"></td>
    <td valign="top" background="images/bot_bg.jpg" style="background-repeat: repeat-x; background-position: bottom">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><img src="images/contact/contact_p.jpg" width="585" height="130"></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td background="images/group/line3.gif"  style="background-repeat: no-repeat; background-position: bottom" height="36" align="center">Send E_mail To <%=TONAME%></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td>&nbsp;</td>
        </tr>
      </table>
      <table width="560" border="0" cellspacing="0" cellpadding="0" align="center">
        <tr> 
          <td class="font1"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width=15>&nbsp;</td>
          <td align=left class=font3>
                  <%if toadd<>"" then%>
						<b>Add:</b>&nbsp;<%=toadd%>&nbsp;&nbsp;&nbsp;&nbsp;
				  <%end if%>
				  <%if topostyb<>"" then%>
						<b>Post:</b>&nbsp;<%=topostyb%>&nbsp;&nbsp;
				  <%end if%>
				  <br>
				  <%if totel<>"" then%>
					    <b>Tel:</b>&nbsp;<%=totel%>&nbsp;&nbsp;&nbsp;&nbsp;
				  <%end if%>
				  <%if tofax<>"" then%>
						<b>Fax:</b>&nbsp;<%=tofax%>&nbsp&nbsp;&nbsp;&nbsp;
                  <%end if%>
				  <b>E_mail:</b>&nbsp;<a href="mailto:<%=email%>" class=anews><%=email%></a>

          </td>
        </tr>
        </table>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr><td height=10></td></tr>
        <tr> 
          <td background="images/line_h.gif" height="1"></td>
        </tr>
        <tr><td height=10></td></tr>
      </table>
      <%if sendok=0 then%>  
      <table width="80%" border="0" cellspacing="0" cellpadding="0" align="CENTER" valign=top style="line-height:200%">
        <form name="form" method="post" action="<%=linkcontact%>" onsubmit="return checkinput(form)" autocomplete = "off">
          <tr> 
            <td width="100" align=right style="font-size:12px">Title:</td>
            <td width="420"> 
              <input type="text" name="subject" maxlength=60 size=40 class="input" value=<%=subject%>><font color=red>*</font>
            </td>
          </tr>
          <tr> 
            <td align=right style="font-size:12px">Your Email:</td>
            <td width="420"> 
              <input type="text" name="from" maxlength=60 size=40 class="input" value=<%=from%>><font color=red>*</font>
            </td>
          </tr>
          <tr> 
            <td align=right style="font-size:12px">Your Name:</td>
            <td width="420"> 
              <input type="text" name="name" maxlength=60 size=20 class="input" value=<%=name%>><font color=red>*</font>
            </td>
          </tr>
          <tr> 
            <td align=right style="font-size:12px">Your Corp:</td>
            <td width="420"> 
              <input type="text" name="company" maxlength=60 size=40 class="input" value=<%=company%>>
            </td>
          </tr>
          <tr> 
            <td align=right style="font-size:12px">Your Add:</td>
            <td width="420"> 
              <input type="text" name="address" maxlength=60 size=40 class="input" value=<%=address%>>
            </td>
          </tr>
          <tr> 
            <td align=right style="font-size:12px">Your Tel:</td>
            <td width="420"> 
              <input type="text" name="telphone" maxlength=60 size=40 class="input" value=<%=telphone%>>
            </td>
          </tr>
          <tr> 
            <td align=right style="font-size:12px">Your Fax:</td>
            <td width="420"> 
              <input type="text" name="fax" maxlength=60 size=30 class="input" value=<%=fax%>>
            </td>
          </tr>
          <tr> 
            <td align=right style="font-size:12px">Content:</td>
            <td> 
              <textarea rows=10 cols=50 name="body" style="font-family:宋体" class="input"><%=body%></textarea>
            </td>
          </tr>
          <tr> 
            <td align=center height=30 valign=middle> <br>
                 &nbsp;&nbsp;&nbsp;&nbsp; </td>
             <td height=30 valign=middle> 
                 <input type="image" border="0" name="imageField2" src="images/contact/bt_send.gif" width="50" height="18" style="cursor:hand;">
                 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                 <a href="#"><img border="0" name="imageField1" src="images/contact/bt_reset.gif" width="50" height="18" onclick="javascript:document.form.reset();document.form.subject.focus()" style="cursor:hand;"></a>
                 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
          </tr>
           </form>
            </table>
         </table>
		<%elseif sendok=1 then%>
			<table width="95%" border="0" cellspacing="0" cellpadding="0" align="CENTER" valign=top style="line-height:200%">       
				<tr height=300>
					<td VALIGN="TOP" class="font1" align=left><br>
					 	<font color=red><b>Your messages have already reached us.</b></font><br>We will contact you as soon as possible.
					</td>
				</tr>
			</table>
         </table>
		<%end if%> 
      <table width="96%" border="0" cellspacing="0" cellpadding="0" align="center">
        <tr> 
          <td height="50">&nbsp;</td>
        </tr>
      </table>
      <table width="96%" border="0" cellspacing="0" cellpadding="0" align="center">
        <tr> 
          <td height="1" colspan="2" background="images/line_h.gif"></td>
        </tr>
        <tr> 
          <td height="30">&nbsp;</td>
          <td height="30" align="right" width="50"><a href="#top"><img src="images/group/bt_top.gif" width="50" height="18" border="0"></a></td>
        </tr>
        <tr> 
          <td colspan="2">&nbsp;</td>
        </tr>
      </table>
    </td>
    <td bgcolor="#66cc00" width="1"></td>
  </tr>
</table>
<!-- #include file="end.asp" -->
 <script language=Javascript>
	var flag=true;
	function checkinput(form)
	{

		if(form("subject").value=="")
			{alert("please input title!");form("subject").focus();flag=false;return flag;}else{flag=true;}	
		if(form("from").value=="")
			{alert("please input your email!");form("from").focus();flag=false;return flag;}else{flag=true;}
		if(form("from").value.search("@")==-1)
			{alert("You might have provided an incorrect Email address. Please check back and input again!");form("from").focus();flag=false;return flag;}else{flag=true;}
		if(form("name").value=="")
			{alert("Please input your name");form("name").focus();flag=false;return flag;}else{flag=true;}	

		if (flag==true) {flag=checkchar(form("subject").value)} 
		if (flag==true) {flag=checkchar(form("from").value)} 
		if (flag==true) {flag=checkchar(form("name").value)} 
		if (flag==true) {flag=checkchar(form("address").value)} 
		if (flag==true) {flag=checkchar(form("company").value)} 
		if (flag==true) {flag=checkchar(form("telphone").value)} 
		if (flag==true) {flag=checkchar(form("fax").value)} 
		if (flag==true) {flag=checkcharbody(form("body").value)} 
		
		return flag;
	}

	function checkchar(str)
	{
		str=str.toLowerCase()
		oldstr=str
		str="2"+str
		if (str.search("<"+"%")>0)  
		{
			window.alert("Nonlicet character on the ("+oldstr+") ,Please check back and input again!");
			return false;
		}
		if (str.search("<scrip"+"t")>0)
		{
			window.alert("Nonlicet character on the ("+oldstr+") ,Please check back and input again!");
			return false;
		}
		if (str.search("'")>0)
		{
			window.alert("Nonlicet character on the ("+oldstr+") ,Please check back and input again!");
			return false;
		}
		if (str.search('"')>0)
		{
			window.alert("Nonlicet character on the ("+oldstr+") ,Please check back and input again!");
			return false;
		}
		return true;
	}
	
</script>
 <script language=Javascript>
	function checkcharbody(str)
	{
		str=str.toLowerCase()
		oldstr=str
		str="2"+str
		if (str.search("<"+"%")>0)  
		{
			window.alert("Nonlicet character on the ("+oldstr+") ,Please check back and input again!");
			return false;
		}
		if (str.search("<scrip"+"t")>0)
		{
			window.alert("Nonlicet character on the ("+oldstr+") ,Please check back and input again!");
			return false;
		}

		return true;
	}
	
</script>

⌨️ 快捷键说明

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