Commit d582f0ca authored by O'Reilly Media, Inc.'s avatar O'Reilly Media, Inc.
Browse files

Initial commit

parents
Loading
Loading
Loading
Loading

AppA_ExA_1.html

0 → 100644
+40 −0
Changes for AppA_ExA_1.html: 40 added lines, 0 removed lines.
Original line number Diff line number Diff line
<HTML>
<HEAD>
<TITLE>Sample Form</TITLE>
</HEAD>
<BODY bgcolor = #cccccc>
<form action="XXXXXXXX SEE BELOW XXXXXXXXXX" method="POST">
<center>
<h2>Welcome to the Programming Language Survey.</h2>
<h3>Please enter your name and your programming language preference below.</h3>
<TABLE WIDTH = 40%>
   <TR VALIGN = TOP>
      <TD WIDTH = 40%>
         <font face="Arial" size="+2">Name:</font>
      </td>
      <TD WIDTH = 60%>
         <input type="Text" name="UsrName" size="20" 
            maxlength="80"><BR><BR>
      </TD>
   </tr>
   <TR VALIGN = TOP>
      <TD WIDTH = 40%>
         <font face="Arial" size="+2">Language:</font>
      </td>
      <TD WIDTH = 60%>
         <select name="ProgLang">
            <option value="Perl">Perl
            <option value="Python">Python
            <option value="Visual Basic">Visual Basic
         </select>
      </TD>
   </tr>
</TABLE>
<BR><BR>
<input type="Submit" name="Submit" value="Submit Form" align="MIDDLE">
</form>
</center>

</BODY>
</HTML>

AppA_ExA_2.pl

0 → 100644
+25 −0
Changes for AppA_ExA_2.pl: 25 added lines, 0 removed lines.
Original line number Diff line number Diff line
# Use the CGI and OLE perl modules.
use CGI qw(:standard);
use OLE;

# Instantiate an ADO Connection object and open the database.
$conn = CreateObject OLE "ADODB.Connection" || die "CreateObject: $!";
$conn->Open('LangPref');

# Retrieve the Name and Language Preference of the user.
$Name = param("UsrName");
$LangPref = param("ProgLang");

# Construct the SQL INSERT statement.
$sql = "INSERT INTO LangPrefStorage (Name, LangPref) VALUES (\'$Name\', \'$LangPref\')";

# Execute the SQL INSERT statement and close the ADO connection.
$conn->Execute($sql);
$conn->Close();

# Print out the "Thank You" message in an HTML
# form to the user.
print header,start_html("Language Preference Storage"),h1("Thank you, $Name.");
print p("Click <A HREF = '/~wsdocs/langform/formsample.htm'>here</a> to reset the form.<BR>");
print end_html;

AppA_ExA_3.vbs

0 → 100644
+71 −0
Changes for AppA_ExA_3.vbs: 71 added lines, 0 removed lines.
Original line number Diff line number Diff line
' +-------------------------------------+
' | Force variable declarations.        |
' +-------------------------------------+
Option Explicit
Sub Inter_Main()
    
    ' +-------------------------------------+
    ' | If a user of the web server machine |
    ' | inadvertently attempts to run       |
    ' | this program as a standalone        |
    ' | application, let them know it is a  |
    ' | CGI app.                            |
    ' +-------------------------------------+
    MsgBox "This is a Windows CGI program."
    
End Sub

Sub CGI_Main()

    ' +-------------------------------------+
    ' | Local variable declarations.        |
    ' +-------------------------------------+
    Dim strUserName As String
    Dim strPrefLang As String
    Dim adoCon As Object
    Dim strSQL As String

    ' +-------------------------------------+
    ' | Create the ADO Connection object.   |
    ' +-------------------------------------+
    Set adoCon = CreateObject("ADODB.Connection")
    adoCon.Open "LangPref"
    
    ' +-------------------------------------+
    ' | Retrieve the name and preference    |
    ' | field values from the posted form.  |
    ' +-------------------------------------+
    strUserName = GetSmallField("UsrName")
    strPrefLang = GetSmallField("ProgLang")
    
    ' +-------------------------------------+
    ' | Create the INSERT statement.        |
    ' +-------------------------------------+
    strSQL = "INSERT INTO LangPrefStorage (Name, "
    strSQL = strSQL & "LangPref) VALUES ('"
    strSQL = strSQL & strUserName & "', '"
    strSQL = strSQL & strPrefLang & "')"
    
    ' +-------------------------------------+
    ' | Execute the SQL statement and close |
    ' | the ADO connection.                 |
    ' +-------------------------------------+
    adoCon.Execute strSQL
    adoCon.Close
    
    ' +-------------------------------------+
    ' | Send the HTTP request header and    |
    ' | HTML page back to the client.       |
    ' +-------------------------------------+
    Send ("Content-type: text/html")
    Send ("")
    Send ("<HTML><HEAD><TITLE>")
    Send ("Language Preference Storage</TITLE>")
    Send ("</HEAD><BODY>")
    Send ("<H1>Thank you, " & strUserName & ".</H1>")
    Send ("Click <A HREF = _
        '/~wsdocs/langform/formsample.htm'>here</a> to reset the form.<BR>")
    Send ("</BODY></HTML>")

End Sub

AppA_ExA_4.asp

0 → 100644
+50 −0
Changes for AppA_ExA_4.asp: 50 added lines, 0 removed lines.
Original line number Diff line number Diff line
<HTML>
<HEAD>
<TITLE>Language Preference Storage</TITLE>
</HEAD>
<BODY>
<%
' +-------------------------------------+
' | Local variable declarations.        |
' +-------------------------------------+
Dim strUserName
Dim strPrefLang
Dim adoCon
Dim strSQL

' +-------------------------------------+
' | Create the ADO Connection object.   |
' +-------------------------------------+
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "LangPref"

' +-------------------------------------+
' | Retrieve the name and preference    |
' | field values from the posted form.  |
' +-------------------------------------+
strUserName = Request.Form("UsrName")
strPrefLang = Request.Form("ProgLang")

' +-------------------------------------+
' | Create the INSERT statement.        |
' +-------------------------------------+
strSQL = "INSERT INTO LangPrefStorage (Name, "
strSQL = strSQL & "LangPref) VALUES ('"
strSQL = strSQL & strUserName & "', '"
strSQL = strSQL & strPrefLang & "')"
    
' +-------------------------------------+
' | Execute the SQL statement and close |
' | the ADO connection.                 |
' +-------------------------------------+
adoCon.Execute strSQL
adoCon.Close
%>
<H1>Thank you, <%=strUserName%>.</h1>
Click
<A HREF = '/~wsdocs/langform/formsample.htm'>
here</a> to reset the form.<BR>

</BODY>
</HTML>

Ch01_Ex1_1.asp

0 → 100644
+33 −0
Changes for Ch01_Ex1_1.asp: 33 added lines, 0 removed lines.
Original line number Diff line number Diff line
<%@ LANGUAGE="VBSCRIPT" %>

<HTML>
<HEAD>
<TITLE>Sample ASP</TITLE>
</HEAD>
<BODY>

Good afternoon.<BR> 
Welcome to the sample. It is now approximately 
<%=Time()%> at the server. Here are a couple of
demonstrations:<BR><BR><BR>

Some simple text formatting done using HTML:<BR>
<FONT SIZE = 1>Hello Size 1</FONT><BR>
<FONT SIZE = 2>Hello Size 2</FONT><BR>
<FONT SIZE = 3>Hello Size 3</FONT><BR>
<FONT SIZE = 4>Hello Size 4</FONT><BR>
<FONT SIZE = 5>Hello Size 5</FONT><BR>
<BR>
The same text formatting using server-side code:<BR>
<%
For intCounter = 1 to 5
%>
<FONT SIZE = <%=intCounter%>>
Hello Size <%=intCounter%></FONT><BR>
<%
Next
%>
<BR>
</BODY>
</HTML>
Loading