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

📄 message_sav.asp

📁 oracle9i程序事例集
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
  dim conn
  dim connstr
  Set conn=Server.CreateObject("ADODB.Recordset")
  connstr="Driver={Microsoft ODBC for Oracle};server=mylink;uid=system;pwd=system;"
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>意见反馈留言表</title>
</head>
<%
function IsValidEmail(user_mail)

dim names, name, i, c

'Check for valid syntax in an email address.

IsValidEmail = true
names = Split(user_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(email, "..") > 0 then
   IsValidEmail = false
end if

end function

%>

<body>
<%
  set rs=server.createobject("adodb.recordset")

  uname=trim(request("name"))

  EMAIL=trim(request("email"))

  if email<>"" then
    if isvalidemail(email)=false then
      errmsg=errmsg+"<br>"+"<li>你的E-mail有错误"
      founderr=true
    end if
  end if

  if trim(request("MESSAGE"))="" then
    errmsg=errmsg+"<br>"+"<li>意见及建议不能为空"
    founderr=true
  else
    MESSAGE=trim(request("MESSAGE"))
  end if
%>

<div align="center">
<center>
<table border="0" width="750" cellspacing="0" cellpadding="0">
<%  
  if founderr=false then
    sql="select * from GSCOTT.message_table order by message_id"
    rs.open sql,connstr,3,3
    if rs.eof then
      id=1
    else 
      rs.movelast
      id=cint(rs("message_id"))+1
    end if
    rs.addnew
    rs("message_id")=id
    rs("message_name")=uname
    rs("message_email")=email
	rs("message_date")=now
	rs("message_ip")=request.ServerVariables("REMOTE_ADDR")
	rs("message_content")=message
	rs.update
	rs.close
	set rs=nothing
%>
<table width="615"  border="0" cellPadding="0" cellSpacing="0">
  <tr class="ChnChar">
    <td height="30" colspan="3" align="left" class="ChnChar">您现在的位置:<a href="Index.asp">电子商务网</a>--&gt;意见反馈留言板</td>
  </tr>
  <tr class="ChnChar">
    <td height=1 colspan="3" bgcolor="#0099FF"></td>
  </tr>
    <tr>
  <td colspan="3">&nbsp;</td>
  </tr>
  <tr align="center" class="ChnChar">
    <td height="30" colspan="3">电子商务网意见反馈留言板</td>
    </tr>
  <tr align="center" class="ChnChar">
    <td height="60" colspan="3">非常感谢您对本网站提出的意见和建议。<BR>
     常见疑难问题请浏览<A href="faq.asp" target=_blank>常见问题解答</A></td>
  </tr>
  <tr class="ChnChar">
    <td width="142" height="25">&nbsp;</td>
    <td width="161" height="25">您的姓名:</td>
    <td width="312" height="25"><%=uname%></td>
  </tr>
  <tr class="ChnChar">
    <td height="25">&nbsp;</td>
    <td height="25">联系EAMIL:</td>
    <td height="25"><%=email%></td>
  </tr>
  <tr class="ChnChar">
    <td height="25">&nbsp;</td>
    <td height="25">    意见及建议:</td>
    <td><%=message%></td>
  </tr>
<% if email<>"" then%>
  <tr align="center" class="ChnChar">
    <td height="25" colspan="3">&nbsp;</td>
  </tr>
  <tr align="center" class="ChnChar">
    <td height="25" colspan="3">如填写真实姓名与联系E-mail,您将有机会获得本网的小礼品。</td>
  </tr>
  <tr><td colspan="3" align="right"><a href="javascript:window.close()">关闭窗口</a></td></tr>
<% 
  end if
  else
%>
<meta http-equiv="refresh" content="3;url=javascript:history.go(-1)">
<tr> 
  <td width="600" height="20" align="center">您输入的信息有问题</td> 
</tr>
<tr> 
  <td><%=errmsg%></td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr><td align="center"><a href="javascript:history.go(-1)"><font size="-1">三秒钟后自动返回到上一页,如果您的浏览器没有返回,请单击此处</font></a></td></tr>
</table>
<% end if %>
</body>
</html>

⌨️ 快捷键说明

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