<!--#include file="connguest.asp"-->
<%
dim cname
dim	company
dim adress
dim	mail
dim tel
dim fax
dim liuyan
dim sql

cname=request("cname")
company=request("company")
adress=request("adress")
mail=request("mail")
tel=request("tel")
fax=request("fax")
liuyan=request("liuyan")

if len(cname)<2 or len(cname)>30 then
	 response.write "<script language=JavaScript>" & chr(13) & "alert('请填写您的正确信息！');" & "history.back()" & "</script>"
	 response.end
	 end if

if len(company)<3 or len(company)>60 then 
	 response.write "<script language=JavaScript>" & chr(13) & "alert('请正确填写公司的名称');" & "history.back()" & "</script>"
response.end
end if

if len(adress)<6 or len(adress)>60 then 
	 response.write "<script language=JavaScript>" & chr(13) & "alert('请正确填写公司地址');" & "history.back()" & "</script>"
response.end
end if

If Instr(mail, "@") = 0 Or Right(mail, 1) = "@" Or Left(mail, 1) = "@" Then
response.write "<script language=JavaScript>" & chr(13) & "alert('请输入正确的E-MAIL地址，便于我们与您联系！');" & "history.back()" & "</script>"
response.end
end if

if len(tel)=0 or len(tel)>20 then 
	 response.write "<script language=JavaScript>" & chr(13) & "alert(' 请正确输入您的联系电话，便于我们与您联系！');" & "history.back()" & "</script>"
response.end
end if
    
if len(fax)=0 or len(fax)>30 then 
	 response.write "<script language=JavaScript>" & chr(13) & "alert(' 请正确输入您的传真，便于我们与您联系！');" & "history.back()" & "</script>"
response.end
end if

if len(liuyan)=0 then 
	 response.write "<script language=JavaScript>" & chr(13) & "alert(' 请输入您的留言内容！');" & "history.back()" & "</script>"
response.end
end if

sql="select * from ly"
rs.open sql,conn,adOpenDynamic, 3 
rs.addnew
rs("cname")=cname
rs("company")=company
rs("adress")=adress
rs("mail")=mail
rs("tel")=tel
rs("fax")=fax
rs("liuyan")=liuyan
rs("ctime")=NOW()
rs.Update

rs.close
set rs=nothing
conn.close
Set conn=Nothing

%>


<%
function IsValidEmail(mail)

dim names, name, i, c

'Check for valid syntax in an email address.

IsValidEmail = true
names = Split(mail, "@")
if UBound(names) <> 1 then
   IsValidEmail = false
   exit function
end if
for each name in names
   if Len(name) <= 0 then
     IsValidEmail = false
     exit function
   end if
   for i = 1 to Len(name)
     c = Lcase(Mid(name, i, 1))
     if InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 and not IsNumeric(c) then
       IsValidEmail = false
       exit function
     end if
   next
   if Left(name, 1) = "." or Right(name, 1) = "." then
      IsValidEmail = false
      exit function
   end if
next
if InStr(names(1), ".") <= 0 then
   IsValidEmail = false
   exit function
end if
i = Len(names(1)) - InStrRev(names(1), ".")
if i <> 2 and i <> 3 then
   IsValidEmail = false
   exit function
end if
if InStr(mail, "..") > 0 then
   IsValidEmail = false
end if

end function
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>企业在线留言板v1.01</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body{font-family:"宋体";font-size:9pt;line-height: 12pt}
td{font-family:"宋体";font-size:9pt;line-height: 12pt}
A{text-decoration:none ;color:black;line-height: 12pt}
A:hover{text-decoration:none;color:#ff0000;line-height: 12pt}
.fontshadow {
	FILTER: dropshadow(color=#333333,offx=1,offy=1); WIDTH: 100%
}
.unnamed5 {  font-size: 9pt; font-style: normal; line-height: normal; font-weight: normal; font-variant: normal; height: 20px; clip:  rect(   ); color: #000000; border-color: black #000000 #000000 black; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; background-color: #FFFFFF}
.unnamed6 {  font-size: 10pt; line-height: 18pt; color: #000000}
.unnamed1 {  font-size: 9pt; line-height: 18pt; color: #000000}
.tdd {
	BORDER-RIGHT: 0px solid; PADDING-RIGHT: 5px; BORDER-TOP: 0px solid; PADDING-LEFT: 5px; FONT-SIZE: 9pt; PADDING-BOTTOM: 4px; BORDER-LEFT: 0px solid; WIDTH: 100%; CURSOR: hand; COLOR: buttontext; PADDING-TOP: 4px; BORDER-BOTTOM: 0px solid; HEIGHT: 20px; TEXT-DECORATION: none
}
.tdd:hover {
	BORDER-RIGHT: buttonshadow 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: buttonhighlight 1px solid; PADDING-LEFT: 4px; PADDING-BOTTOM: 3px; BORDER-LEFT: buttonhighlight 1px solid; PADDING-TOP: 3px; BORDER-BOTTOM: buttonshadow 1px solid; TEXT-DECORATION: none
}
-->
</style>
</head>

<body topmargin="0">
<table width="709" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td bgcolor="0053A5">&nbsp;</td>
  </tr>
</table>
<table width="709" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="165" height="336" rowspan="2" align="center" bgcolor="#CCCCCC"> 
      <p>&nbsp;</p>
      <p>&nbsp;</p>
    </td>
    <td width="524" rowspan="2"> 
 
      您好,来样提交成功，我们马上会和您取得联系。<a href="guestbook.htm"><font color="#FF0000">[返回］</font></a> 
    </td>
  </tr>
  <tr> </tr>
</table>
<table width="709" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" bgcolor="0053A5"><font color="#FFFFFF" face="Arial, Helvetica, sans-serif"></font></td>
  </tr>
</table>
</body>
</html>
