<% // ============================================ // the content of this page // ============================================ function Content ( ) { Out ( '<td width="20%"> </td>' ); Out ( '<td width="60%">' );
// if the form has a password, validate it first // so that if it fails we can show the form again var bSubmitted = (Request.Form.Count > 0);
// has the form been submitted? if ( bSubmitted ) { // get the password from the form... sPassword = "" + Request.Form ( "password" );
// validate the password and moan if it fails if ( sPassword != sDBPath ) { Out ( '<h3><font color="red">Invalid password!</font></h3>' ); // pretend the form hasn'\t been sent yet bSubmitted = false; } }
// show the form if not submitted yet if ( !bSubmitted ) { Out ( 'In <a href="Subscribe.asp">Part 1</a> I showed you how I allowed you to subscribe to my mailing list. Here\'s where I can post an email to members of that mailing list.' ); Out ( '<p>Strangely, I\'m not going to let you do it, but you <i>can</i> get the source code from the bottom of the page, and learn how I did it.' ); // here's the form tag. the action attribute is the name of // the file that will be called with the answer - in this case // it's the same page. the method can be "post" to send the // form data 'behind the scenes' or "get" to appending the // data to the URL in the style page.asp?data1=a&data2=b // // use post most of the time - it's neater and "get" is limited // in the amount of data that can be sent. Out ( '<form action="MailToList.asp" method="post">' );
// another table to line up the titles and inputs Out ( '<table border="0" cellpadding="0">' ); Out ( '<tr><td align="right" valign="top">' ); Out ( 'Password:' ); Out ( '</td><td align="left" valign="top">' ); // a simple text box. we'll reference it with the name "password" // and show 37 characters on the form. use the maxlength // attribute to set the maximum characters they can enter. // use value="some text" to pre-fill the input with data. Out ( '<input type="password" name="password" size="30"></input>' ); Out ( '</td></tr>' );
Out ( '<tr><td align="right" valign="top">' ); Out ( 'Message:' ); Out ( '</td><td align="left" valign="top">' ); // textarea is a multiline text box. specify the size with the // cols and rows attributes. wrap can be "off" (the default) // "physical" or "virtual". as an example, consider the user // typing in the following text in a 40 character wide input: // // "I wonder how this text will appear to the server when I send it?" // // wrap="off" will send it as typed, but the user has to scroll off // to the right to see the text. (Horrid) // // wrap="physical" will physically split the line after the word // 'server' and send two lines to the server // // wrap="virtual" will send one line, as typed, but