当前位置: 首页 > 图文教程 > 网络编程 > ASP > 一个免费的邮件列表源程序(三)

ASP
ASP视频教程:后台页面加入限制访问和禁用缓存功能
ASP视频教程:制作网站前台首页
ASP视频教程:备份和还原SQL Server 2000数据库
ASP实例教程:asp无限级显示分类代码
IIS无法启动错误的几种情况汇总
asp Http_Referer,Server_Name和Http_Host
ASP 调用带参数输出的COM接口
隐藏修改文件时间和文件属性的ASP脚本
ASP Crazy 模版操作类(最简单的模板类、仅提供交流)
asp 动态数组 提供Add、Insert、Remove、RemoveAt、Search等方法。
asp 取一个数的整数 但不是四舍五入,只要有小数,就取大于这个数的整数
asp 判断上传文件中是否存在危险代码
asp 获取url函数小结
ASP 调用dll及封装dll实例
asp 实现的冒泡排序程序
asp 自定义分段函数/求第N名成绩
ASP 高级模板引擎实现类
ASP 常见的连接字符串写法(access2007)
ASP向Excel导数据(图片)终结版 ASP操作Excel
ASP实现防止网站被采集代码

ASP 中的 一个免费的邮件列表源程序(三)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 34 ::
收藏到网摘: n/a

  Subscribe.asp
<%@ Language=JavaScript %>

<!--#include file = "include/SetGlobals.asp"-->
<!--#include file = "include/DBPath.asp"-->

<%
// output relevant meta tags
Init( "Subscription" );

// output common top of page
Header( '<a href="work.asp">Work</a> --> Subscription', 3 );

// output page content
Content ( );

// output common bottom of page
Footer( );
%>

<% /* standard page elements */ %>
<!--#include file = "utils/Init.asp"-->
<!--#include file = "utils/Database.asp"-->
<!--#include file = "utils/Header.asp"-->
<!--#include file = "utils/Footer.asp"-->

<%
// ============================================
// the content of this page
// ============================================
function Content ( )
{
   Out ( '<td width="20%">&nbsp;</td>' );
   Out ( '<td width="60%">' );
    
      // if the form has an email address, validate it first
      // so that if it fails we can show the form to fix
      var sEmail = "";
      var bSubmitted = (Request.Form.Count > 0);

      // has the form been submitted?
      if ( bSubmitted )
      {
         // get the email address from the form...
          sEmail = "" + Request.Form ( "email" );

         // validate the email address and moan if it fails
         if ( !IsValidEmail ( sEmail ) )
         {
            Out ( '<h5><font color="red">"' + sEmail + '" <i>appears</i> to be an invalid email address - please try again!</font></h5>' );
            Out ( '<p><font color="red">If you disagree, please <a href="Contact.asp">contact me</a> directly.</font><p>' );
            // pretend the form hasn'\t been sent yet
            bSubmitted = false;
         }
      }

      // show the form if not submitted yet
      if ( !bSubmitted )
      {
         Out ( 'If you\'re interested in hearing whenever a new article is posted, or an existing one is updated, type in your email address below and hit <b>Subscribe!</b>' );
         Out ( '<p>Whenever you want to stop receiving my emails, guess what? That\'s right, enter your email address and hit <b>Unsubscribe</b>...' );
         Out ( '<p><i>Your email address will never sold to or otherwise used by any third party, just me.</i>' );

         // here's the form tag. the action attribute is the name of
         // the file that will be called with the answer - in this case
    &n