SPECweb2009 Release 1.20 Banking Workload Pseudocode

Version 1.20, Last modified 2010-04-29

The pseudo code specification provided is a description of the actual work that needs to be implemented. This is required so that results will be comparable. Any dynamic implementation must follow the specification exactly. This means that all operations specified, such as loops and searches, should be executed for each request. Unless otherwise specified, results or intermediate results from previous operations or requests should not be cached.

To provide the flexibility needed to implement this code on any platform and in any desired scripting language, the subroutines listed in the pseudo code may be inlined or subdivided into smaller subroutines as long as the algorithms implemented by the subroutines are performed exactly as described.

The dynamic operations must be executed by separate dynamic modules. The dynamic code must be written in a widely-used scripting language. Script implementations in PHP and JSP are supplied with the kit.

1.1.1 Definitions of Terms

BESIM
Backend Simulator, that resides on a separate physical machine than the primary SUT. See User's Guide for more details.
QUERYSTRING
Information following the '?' in the URL.

PADDING
A file generated by wafgen that brings the dynamic script in-line with sizes observed in real-world pages (that use JavaScript, CSS, etc.)
SESSION_ARRAY
A property of the scripting engine that provides some stateful way of maintaining variables across page executions (may not necessarily be an array)

Note: Directories are specified in this document with a forward slash, '/', however, this in no way implies that one has to follow this convention. Use what works on one's operating system.

1.1.2 Specification of Return Formats

All of the dynamic requests return one of the following types of HTML pages to the client. These formats must be followed precisely for the client software to understand the returned pages. This includes the blank line between the headers and the <html> tag.

Square brackets, [], are used to denote either a looping construct (If/Else/End If, Foreach, etc.), or where appropriate text should be substituted. This text should contain only the required information.  The text may NOT be padded in any way to create a fixed length field.

Curly braces, {}, are used to denote an array that can contain multiple variables inside of it.  Arrays are not strictly required for implementing these constructs; they are used to indicate a logical grouping of variables.

Extra headers required by the web server are allowed. The formats simply show the minimum required by the benchmark.

Login Page Template
HTTP 200 OK
Content-type: text/html
Cache-Control: no-cache

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>SPECweb2009: Login</title>
  </head>
  <body bgcolor="white">
  <!-- SPECweb2009 Dynamic Data Area -->
    <table summary="SPECweb2009_LoginMessage">
      <tr><th>Message</th></tr>
      <tr><td>[MESSAGE]</td></tr>
    </table>
  <!-- SPECweb2009 Displayable Page Title -->
  <table>
    <tr>
      <td><b><font color="#9400d3">SPECweb2009: Login</font></b></td>
    </tr>
  </table>
  <!-- SPECweb2009 User Action Area -->
    <form action="login.php" method="POST">
    <table border="0" align="center">
    <tr>
      <td align="right">User ID: <td><input type="text" name="userid">
    <tr>
      <td align="right">Password: <td><input type="password" name="password">
    <tr>
      <td align="center" colspan="2"><input type="submit" value="Login">
    </table>
    </form>
  <!-- SPECweb2009 Image References -->
  <!-- SPECweb2009 Embedded Text -->
  </body>
</html>
Message Page Template
HTTP 200 OK
Content-type: text/html
Cache-Control: no-cache

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>SPECweb2009: Message</title>
  </head>
  <body bgcolor="white">
  <!-- SPECweb2009 Dynamic Data Area -->
  <table  summary="SPECweb2009_User_Id">
    <tr><th>Message</th></tr>
    <tr><td>[MESSAGE]</td></tr> 
  </table>
  <!-- SPECweb2009 Displayable Page Title -->
  <table>
    <tr>
      <td><b><font color="#9400d3">SPECweb2009: Message</font></b></td>
    </tr>
  </table>
  </body>
</html>
Menu Template
	<ul>
	  <li><a href="account_summary.php">Account Summary</a>
	  <li><a href="check_detail_input.php">Check Detail</a>
      <li><a href="profile.php">Change Profile</a>
      <li><a href="transfer.php">Transfer Money</a>
	  <li>Bill Pay
        <ul>
          <li><a href="add_payee.php">Add Payee</a>
          <li><a href="bill_pay.php">Quick Pay</a>
          <li><a href="bill_pay_status_input.php">Check Status</a>
        </ul>
	  <li><a href="order_check.php">Order Check</a>
      <li><a href="logout.php">Logout</a>
	</ul>

1.2.1 Pseudocode for BESIM query subroutine

    [If BESIM_COUNT > 1]   (NOTE: BESIM_COUNT defined from the init page below)
        Seed random number generator (if necessary)
        Select a BESIM_HOST and BESIM_PORT to use below (random or round-robin)
    [End If]
    Open (or reuse a previously opened) socket to BeSim
    [If HTTP request to "http://' + BESIM_HOST + ':' + BESIM_PORT + BESIM_URI + "?1&[REQUEST]" unsuccessful]
        Report Error Message = 'Failed to open BeSim stream', ErrorLevel = 'error'
	Return empty array
    [End If]
    Skip past '<pre>' tag in BESIM response
    Set Errno = [First line in BESIM response after '<pre>' line]
    [If Errno not 0]
         Report Error Message = 'BeSim returned with an error number: ' + Errno, Errorlevel = 'error'
         Return empty array
    [End If]

    [Foreach line in BESIM response until line == '</pre>']
          BESIM_RESULTS_ARRAY += line;
    [End Foreach]

    Return BESIM_RESULTS_ARRAY
1.2.2 Pseudocode for the init page 

GET /bank/init.php?BESIM_HOST=besimhost1+besimhost2&BESIM_PORT=81+82\
&BESIM_URI=/BeSim/specweb2009_besim&BESIM_PERSISTENT=true\
&PADDING_DIR=/data/SPECweb2009/bank/dynamic_padding/\
&SMARTY_DIR=/data/SPECweb2009/assl/Smarty2.6.2/libs/\
&SMARTY_SUPPORT_DIR=/data/SPECweb2009/support/\
&SEND_CONTENT_LENGTH=true

    [Foreach name, value pair in QUERYSTRING]
        Set name = value   (NOTE: these must persist across script executions)
    [End Foreach]
    Set BESIM_COUNT = [# BESIM_HOST/BESIM_PORT pairs]

    Set SERVER_TIME = [# milliseconds since the Unix Epoch]

    Return Page with HTML = 
<html>
        <head>
                <title>SPECweb2009 Ecommerce Workload Init</title>
        </head>
        <body>
<P>SERVER_SOFTWARE = [Substitute web server variable: "SERVER_SOFTWARE"]</P>
<P>REMOTE_ADDR = [Substitute web server variable: "REMOTE_ADDR"]</P>
<P>SCRIPT_NAME = [Substitute web server variable: "SCRIPT_NAME"]</P>
<P>QUERY_STRING = [Substitute web server variable: "QUERY_STRING"]</P>
<P>SERVER_TIME = [SERVER_TIME]</P>
        </body>
</html>

1.2.3 Pseudocode for login page

Sample requests:
GET /bank/login.php HTTP/1.1
or
POST /bank/login.php HTTP/1.1
[rest of HTTP headers]
Content-Type: application/x-www-form-urlencoded
Content-Length: 19

userid=6&password=6
    Set MESSAGE = ''
    [If {POST_DATA['userid']} and {POST_DATA['password']} are not set]
       [No-op]
    [Else If {POST_DATA['userid']} or {POST_DATA['password']} are empty]
       Set MESSAGE = 'No empty user id or password allowed!'
    [Else]
       Set REAL_PASSWORD, ERROR_NUM = [BESIM query with REQUEST = '1&' + {POST_DATA['userid']}]
       [If ERROR_NUM not 0]
          REAL_PASSWORD = ''
       [End If]
       Set FORM_PASSWORD = [MD5 hash of {POST_DATA['password']}]
       [If REAL_PASSWORD equivalent to FORM_PASSWORD]
          Set ACCOUNT_BALANCE_ARRAY, ERROR_NUM = [BESIM query with REQUEST = '2&' + {POST_DATA['userid']}]
          Return Page with HTML =
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>SPECweb2009: Welcome</title>
  </head>
  <body bgcolor="white">
  <!-- SPECweb2009 Dynamic Data Area -->
  <table  summary="SPECweb2009_User_Id">
    <tr><th>User ID</th></tr>
    <tr><td>{POST_DATA['userid']}</td></tr> 
  </table>
  <table summary="SPECweb2009_Acct_Balance" cellpadding=3 border=1>
    <tr>
      <th>Account</th>
      <th>Type</th>
      <th>Balance</th>
    </tr>
    [Foreach account in ACCOUNT_BALANCE_ARRAY]
        <tr><td>{account[accountno]}</td>
            <td>[If {account[type]} == "1"]
                   Checking
                [Else If {account[type]} == "2"]
                   Saving
                [Else]
                   Other
                [End If]</td>
            <td>{account[balance]}</td>
         </tr>
    [End Foreach]
  </table>
  <!-- SPECweb2009 Displayable Page Title -->
  <table>
    <tr>
      <td><b><font color="#9400d3">SPECweb2009: Welcome User</font></b></td>
    </tr>
  </table>
  <!-- SPECweb2009 User Action Area -->
  [Include Menu Template]
  <!-- SPECweb2009 Image References -->
  <!-- SPECweb2009 Embedded Text -->
<pre>
[Include [PADDING_DIRECTORY]/welcome]</pre>
  </body>
</html>
          Set {SESSION_ARRAY['userid']} = {POST_DATA['userid']}
          [EXIT]
       [Else]
          Set MESSAGE = 'Incorrect user id or password!'
       [End If]
    [End If]
    Return Login Page Template

1.2.4 Pseudocode for account_summary page

Sample request:
GET /bank/account_summary.php HTTP/1.1
    [If {SESSION_ARRAY['userid']} not set]
        Set MESSAGE = 'Please login'
        Return Login Page Template
    [End If]

    Set ACCOUNT_SUMMARY_ARRAY, ERROR_NUM = [BESIM query with REQUEST = '3&' + {POST_DATA['userid']}]
    [If ERROR_NUM == 0]
       Return Page with HTML =
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>SPECweb2009: Account Summary</title>
  </head>
  <body bgcolor="white">
  <!-- SPECweb2009 Dynamic Data Area -->
  <table  summary="SPECweb2009_User_Id">
    <tr><th>User ID</th></tr>
    <tr><td>{SESSION_ARRAY['userid']}</td></tr> 
  </table>
  <table summary="SPECweb2009_Acct_Summary" cellpadding=3 border=1>
    <tr>
      <th>Account</th>
      <th>Type</th>
      <th>Current Balance</th>
      <th>Total Deposits</th>
      <th>Average Deposit</th>
      <th>Total Withdraws</th>
      <th>Average Withdraws</th>
    </tr>
    [Foreach account in ACCOUNT_SUMMARY_ARRAY]
      <tr>
      <td>{account[Acct_#]}</td>
      <td>[If {account[Type]} == "1"]
             Checking
          [Else If {account[Type]} == "2"]
             Saving
          [Else]
             Other
          [End If]</td>
      <td>{account[Balance]}</td>
      <td>{account[TotalDeposit]}</td>
      <td>{account[AvgDeposit]}</td>
      <td>{account[TotalWithdrawal]}</td>
      <td>{account[AvgWithdrawal]}</td>
	</tr>
    [End Foreach]
    </table>  
  <!-- SPECweb2009 Displayable Page Title -->
  <table>
    <tr>
      <td><b><font color="#9400d3">SPECweb2009: Account Summary</font></b></td>
    </tr>
  </table>
  <!-- SPECweb2009 User Action Area -->
  [Include Menu Template]
  <!-- SPECweb2009 Image References -->
  <!-- SPECweb2009 Embedded Text -->
<pre>   
[Include [PADDING_DIRECTORY]/account_summary]</pre>
  </body>
</html>

    [Else]
       Return Message Page Template with MESSAGE = 'Error code: [ERROR_NUM]'
    [End If]

1.2.5 Pseudocode for check_detail_input page

Sample requests:
GET /bank/check_detail_input.php HTTP/1.1
    [If {SESSION_ARRAY['userid']} not set]
        Set MESSAGE = 'Please login'
        Return Login Page Template
    [End If]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>SPECweb2009: Check Detail</title>
  </head>
  <body bgcolor="white">
  <table  width="100%">
  <tr valign="middle">
  <td width="200" bgcolor="#f0f0f0">
    Welcome {SESSION_ARRAY['userid']}!
    [Include Menu Template]
  <td>
    <center>
      <form method="get" action="[check_detail_html filename]">
        <table cellpadding=3>
          <tr>
            <td>Check Number:</td>
            <td><input type="text" name="check_no"></td>
        </table>
        <input type="submit" value="Submit">
      </form>
    </center>
  </table>
  </body>
</html>

1.2.6 Pseudocode for check_detail_html page

Sample requests:
GET /bank/check_detail_html.php?check_no=6 HTTP/1.1
    [If {SESSION_ARRAY['userid']} not set]
        Set MESSAGE = 'Please login'
        Return Login Page Template
    [End If]
    [If QUERYSTRING['check_no'] not set]
        Return Message Page Template with MESSAGE = 'Empty check number'
        [EXIT]
    [End If]

    Set CHECK_IMAGE_ARRAY, ERROR_NUM = [BESIM query with REQUEST = '4&' + {SESSION_ARRAY['userid']} + QUERYSTRING['check_no']]
    [If ERROR_NUM == 0]
       Return Page with HTML =
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>SPECweb2009: Check Detail Output</title>
  </head>
  <body bgcolor="white">
  <!-- SPECweb2009 Dynamic Data Area -->
  <table  summary="SPECweb2009_User_Id">
    <tr><th>User ID</th></tr>
    <tr><td>{SESSION_ARRAY['userid']}</td></tr> 
  </table>
  <table summary="SPECweb2009_Check_Details" align="center" cellpadding=3 border=1>
    <tr>
      <th>Account Number:</th>
      <td>CHECK_IMAGE_ARRAY[Acct]</td>
    </tr>
    <tr>
      <th>Check Number:</th>
      <td>{QUERYSTRING['check_no']}</td>
    </tr>
    <tr>
      <th>Front Image:</th>
      <td><img alt="front image" src="[check_detail_image filename]?side=front&check_no={QUERYSTRING['check_no']}"></td>
    </tr>
    <tr>
      <th>Back Image:</th>
      <td><img alt="back image" src="[check_detail_image filename]?side=back&check_no={QUERYSTRING['check_no']}"></td>
    </tr>
  </table>
  <!-- SPECweb2009 Displayable Page Title -->
  <table>
    <tr>
      <td><b><font color="#9400d3">SPECweb2009: Check Details Output</font></b></td>
    </tr>
  </table>
  <!-- SPECweb2009 User Action Area -->
  [Include Menu Template]
  <!-- SPECweb2009 Image References -->
  <!-- SPECweb2009 Embedded Text -->
<pre>   
[Include [PADDING_DIRECTORY]/check_detail_html]</pre>
  </body>
</html>
    [Else]
       Return Message Page Template with MESSAGE = 'Error Code: [ERROR_NUM]'
    [End If]

1.2.7 Pseudocode for check_detail_image page

Sample requests:
GET /bank/check_detail_image.php?side=front&check_no=6 HTTP/1.1
GET /bank/check_detail_image.php?side=back&check_no=6 HTTP/1.1
    [If {SESSION_ARRAY['userid']} not set]
        Set MESSAGE = 'Please login'
        Return Login Page Template
    [End If]
    [If QUERYSTRING['side'] not "front" and QUERYSTRING['side'] not "back"]
        Return Message Page Template with MESSAGE = 'Wrong side'
        [EXIT]
    [End If]
    [If QUERYSTRING['check_no'] not set]
        Return Message Page Template with MESSAGE = 'No empty check number allowed'
        [EXIT]
    [End If]

    Set CHECK_IMAGE_ARRAY, ERROR_NUM = [BESIM query with REQUEST = '4&' + {SESSION_ARRAY['userid']} + QUERYSTRING['check_no']]
    [If ERROR_NUM == 0]
       [If QUERYSTRING['side'] == "front"]
          [Send contents of CHECK_IMAGE_ARRAY[FrontURL]]
       [Else]
          [Send contents of CHECK_IMAGE_ARRAY[BackURL]]
       [End If]
    [Else]
       Return Message Page Template with MESSAGE = 'Error Code: [ERROR_NUM]'
    [End If]

1.2.8 Pseudocode for bill_pay page

Sample requests:
GET /bank/bill_pay.php?userid=39 HTTP/1.1
    [If {SESSION_ARRAY['userid']} not set]
        Set MESSAGE = 'Please login'
        Return Login Page Template
    [End If]

    Set PAYEE_ARRAY, ERROR_NUM = [BESIM query with REQUEST = '5&' + {SESSION_ARRAY['userid']}
    [Foreach payee in PAYEE_ARRAY]
        payee[Date] = [ISO-8601 formatted payee[Date]] (i.e. '20050204' => '2005/02/04')
    [End Foreach]

    Return Page with HTML = 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>SPECweb2009: Bill Pay</title>
  </head>
  <body bgcolor="white">
  <!-- SPECweb2009 Dynamic Data Area -->
  <table  summary="SPECweb2009_User_Id">
    <tr><th>User ID</th></tr>
    <tr><td>{SESSION_ARRAY['userid']}</td></tr> 
  </table>
    <table summary="SPECweb2009_Last_Payment" cellpadding=3 border=1>
      <tr>
        <th>Payee</th>
        <th>Date</th>
        <th>Amount</th>
	</tr>
      [Foreach payee in PAYEE_ARRAY]
        <tr>
        <td>{payee[PayeeId]}</td>
        <td>{payee[Date]}</td>
        <td>{payee[Payment]}</td>
        </tr>
      [End Foreach]
    </table>
  <!-- SPECweb2009 Displayable Page Title -->
  <table>
    <tr>
      <td><b><font color="#9400d3">SPECweb2009: Bill Pay</font></b></td>
    </tr>
  </table>
  <!-- SPECweb2009 User Action Area -->
  [Include Menu Template]
    <form method="post" action="[quick_pay page filename]">
    <b>Schedule for next payment</b>
    <table cellpadding=3 border=1>
      <tr>
        <th>Payee</th>
        <th>Date</th>
        <th>Amount</th>
	</tr>
      <tr>
        <td><input type="text" name="payee[0]"></td>
        <td><input type="text" name="date[0]"></td>
        <td><input type="text" name="amount[0]"></td>
	</tr>
      <tr>
        <td><input type="text" name="payee[1]"></td>
        <td><input type="text" name="date[1]"></td>
        <td><input type="text" name="amount[1]"></td>
	</tr>
      <tr>
        <td><input type="text" name="payee[2]"></td>
        <td><input type="text" name="date[2]"></td>
        <td><input type="text" name="amount[2]"></td>
	</tr>
      <tr>
        <td><input type="text" name="payee[3]"></td>
        <td><input type="text" name="date[3]"></td>
        <td><input type="text" name="amount[3]"></td>
 	</tr>
	<tr>
        <td><input type="text" name="payee[4]"></td>
        <td><input type="text" name="date[4]"></td>
        <td><input type="text" name="amount[4]"></td>
	</tr>
    </table>
      <b>Note:</b> Date in yyyy-mm-dd format (ISO-8601).<br>
    <input type="submit" value="Submit">
    </form>
  
  <!-- SPECweb2009 Image References -->
  <!-- SPECweb2009 Embedded Text -->
<pre>
[Include [PADDING_DIRECTORY]/bill_pay]</pre>
  </body>
</html>

1.2.9 Pseudocode for quick_pay page

Sample requests:
POST /bank/quick_pay.php HTTP/1.1 
[..]
Content-Type: application/x-www-form-urlencoded 
Content-Length: 46

payee[0]=1&date[0]=2005-02-11&amount[0]=100.00
    [If {SESSION_ARRAY['userid']} not set]
        Set MESSAGE = 'Please login'
        Return Login Page Template
    [End If]

    [If {POST_DATA['payee']} is empty OR {POST_DATA['payee']} not an array]
       Return Message Page Template with MESSAGE = 'No payee selected'
       [EXIT]
    [End If]

    [If {POST_DATA['date']} is empty OR {POST_DATA['date']} not an array]
       Return Message Page Template with MESSAGE = 'No date selected'
       [EXIT]
    [End If]

    [If {POST_DATA['amount']} is empty OR {POST_DATA['amount']} not an array]
       Return Message Page Template with MESSAGE = 'No amount selected'
       [EXIT]
    [End If]

    [Foreach {POST_DATA['payee']} as index, ID]
       [If ID is empty]
          Skip to next payee
       [End If]
       [If {POST_DATA['date'][index]} is empty]
          MESSAGE += "Failed: payee=[ID]  Reason: No date"
          Skip to next payee
       [End If]
       [If {POST_DATA['date'][index]} is not in yyyy-mm-dd format]
          MESSAGE += "Failed: payee=[ID]  Reason: Invalid date format"
          Skip to next payee
       [End If]
       [If {POST_DATA['date'][index]} is earlier than today's date]
          MESSAGE += "Failed: payee=[ID]  Reason: Tried to schedule payment earlier than today"
          Skip to next payee
       [End If]
       [If {POST_DATA['amount'][index]} is empty]
          MESSAGE += "Failed: payee=[ID]  Reason: No amount"
          Skip to next payee
       [End If]
       [If {POST_DATA['amount'][index]} <= 0.0]
          MESSAGE += "Failed: payee=[ID]  Reason: Illegal amount"
          Skip to next payee
       [End If]

       Set QUICKPAY_CONFIRMATION, ERROR_NUM = [BESIM query with REQUEST = '7&' + {SESSION_ARRAY['userid']} + '&' + ID + '&' + \
                                                                   {POST_DATA['date'][index]} + '&' + {POST_DATA['amount'][index]}]
       [If ERROR_NUM > 0]
          MESSAGE += "Failed: payee=[ID] Error code: [ERROR_NUM]"
          Skip to next payee
       [End If]
       MESSAGE += "Scheduled: payee=[ID], date={POST_DATA['date'][index]}, amount={POST_DATA['amount'][index]}"
    [End Foreach]

    Return Page with HTML = 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>SPECweb2009: Quick Pay Result</title>
  </head>
  <body bgcolor="white">
  <!-- SPECweb2009 Dynamic Data Area -->
  <table  summary="SPECweb2009_User_Id">
    <tr><th>User ID</th></tr>
    <tr><td>{SESSION_ARRAY['userid']}</td></tr> 
  </table>
  <table summary="SPECweb2009_Quick_Pay_Result">
    <tr><th>Payment Schedule Result</th></tr>
    [Foreach line in MESSAGE]
      <tr><td>[line]</td></tr>
    [End Foreach]
    <tr><td>Confirmation Code</td></tr>
    <tr><td>{QUICKPAY_CONFIRMATION['ConfirmationNum']}</td></tr>
  </table>
  <!-- SPECweb2009 Displayable Page Title -->
  <table>
    <tr>
      <td><b><font color="#9400d3">SPECweb2009: Quick Pay Result</font></b></td>
    </tr>
  </table>
  <!-- SPECweb2009 User Action Area -->
  [Include Menu Template]
  <!-- SPECweb2009 Image References -->
  <!-- SPECweb2009 Embedded Text -->
<pre>
[Include [PADDING_DIRECTORY]/quick_pay]</pre>
  </body>
</html>

1.2.10 Pseudocode for add_payee page

Sample requests:
GET /bank/add_payee.php?userid=0000000079 HTTP/1.1 

    [If {SESSION_ARRAY['userid']} not set]
        Set MESSAGE = 'Please login'
        Return Login Page Template
    [End If]

    Return Page with HTML = 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>SPECweb2009: Add Payee</title>
  </head>
  <body bgcolor="white">
  <!-- SPECweb2009 Dynamic Data Area -->
  <table  summary="SPECweb2009_User_Id">
    <tr><th>User ID</th></tr>
    <tr><td>{SESSION_ARRAY['userid']}</td></tr> 
  </table>
  <!-- SPECweb2009 Displayable Page Title -->
  <table>
    <tr>
      <td><b><font color="#9400d3">SPECweb2009: Add Payee</font></b></td>
    </tr>
  </table>
  <!-- SPECweb2009 User Action Area -->
  [Include Menu Template]
    <b>Please fill out ALL fields:</b>
    <form method="post" action="[post_payee page]">
      <table cellpadding=3 border=1>
      <tr>
        <td><b>Nickname<br>
         (serve as id, no duplication):</b></td>
        <td><input type="text" name="payee_id"></td>
      <tr>
        <td><b>Name:</b></td>
        <td><input type="text" name="name"></td>
      <tr>
        <td><b>Street Address:</b></td>
        <td><textarea name="street" rows=3 cols=20></textarea></td>
      <tr>
        <td><b>City:</b></td>
        <td><input type="text" name="city"></td>
      <tr>
        <td><b>State:</b></td>
        <td><input type="text" name="state" size=2 maxlength=2></td>
      <tr>
        <td><b>Zip:</b></td>
        <td><input type="text" name="zip" size=5 maxlength=5></td>
      <tr>
        <td><b>Phone:</b></td>
        <td><input type="text" name="phone"></td>
      </table>
      <input type="submit" value="Submit">
    </form>
  <!-- SPECweb2009 Image References -->
  <!-- SPECweb2009 Embedded Text -->
<pre>
[Include [PADDING_DIRECTORY]/add_payee]</pre>
  </body>
</html>

1.2.11 Pseudocode for post_payee page

Sample request:
POST /bank/post_payee.php HTTP/1.1
[..]
Content-type: application/x-www-form-urlencoded
Content-Length: 91

payee_id=1&name=IRS&street=7065+Aspen Rd&city=Wayland&state=DE&zip=62299&phone=123-555-1212
    [If {SESSION_ARRAY['userid']} not set]
        Set MESSAGE = 'Please login'
        Return Login Page Template
    [End If]

    [If any of these POST_DATA fields are empty: payee_id, name, street, city, zip, state, phone]
       Return Message Page Template with MESSAGE = 'No fields should be left blank'
       [EXIT]
    [End If]

    Set ADDPAYEE_CONFIRMATION, ERROR_NUM = [BESIM query with REQUEST = '6&' + {SESSION_ARRAY['userid']} + '&' + 
                                                        {POST_DATA['payee_id']} + '&' + {POST_DATA['name']} + '&' + 
                                                        {POST_DATA['street']} + '&' + {POST_DATA['city']} + '&' + 
                                                        {POST_DATA['state']} + '&' + {POST_DATA['zip']} + '&' + {POST_DATA['phone']}
    [If ERROR_NUM not 0]
       Return Message Page Template with MESSAGE = 'Error code: [ERROR_NUM]'
       [EXIT]
    [End If]

    Set MESSAGE = "Payee " + POST_DATA['payee_id'] + " succesfully added"

    Return Page with HTML = 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>SPECweb2009: Post Payee</title>
  </head>
  <body bgcolor="white">
  <!-- SPECweb2009 Dynamic Data Area -->
  <table  summary="SPECweb2009_User_Id">
    <tr><th>User ID</th></tr>
    <tr><td>{SESSION_ARRAY['userid']}</td></tr> 
  </table>
  <table summary="SPECweb2009_Payee_Added">
    <tr><th>Message</th></tr>
    <tr><td>[MESSAGE]</td></tr>
    <tr><td>Confirmation Code</td></tr>
    <tr><td>[ADDPAYEE_CONFIRMATION]</td></tr>
  </table>
  <!-- SPECweb2009 Displayable Page Title -->
  <table>
    <tr>
      <td><b><font color="#9400d3">SPECweb2009: Post Payee</font></b></td>
    </tr>
  </table>
  <!-- SPECweb2009 User Action Area -->
  [Include Menu Template]
  <!-- SPECweb2009 Image References -->
  <!-- SPECweb2009 Embedded Text -->
<pre>
[Include [PADDING_DIRECTORY]/post_payee]</pre>
  </body>
</html>

1.2.12 Pseudocode for bill_pay_status_input page

Sample request:
GET /bank/bill_pay_status_input.php HTTP/1.1

    [If {SESSION_ARRAY['userid']} not set]
        Set MESSAGE = 'Please login'
        Return Login Page Template
    [End If]

    Return Page with HTML = 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>SPECweb2009: Bill Pay Status</title>
  </head>
  <body bgcolor="white">
  <table  width="100%">
  <tr valign="middle">
  <td width="200" bgcolor="#f0f0f0">
    Welcome {SESSION_ARRAY['userid']}!
    [Include Menu Template]
  <td>
    <center>
    <form method="get" action="[bill_pay_status_output page]">
      <table cellpadding=3 border=0>
      <tr>
        <td align="right">Start Date (yyyy-mm-dd):</td>
        <td><input type="text" name="start"></td>
      <tr>
        <td align="right">End Date (yyyy-mm-dd):</td>
        <td><input type="text" name="end"></td>
      </table>
      <input type="submit" value="Submit">
    </form>
    </center>
  </table>
  </body>
</html>

1.2.13 Pseudocode for bill_pay_status_output page

Sample request:
GET /bank/bill_pay_status_output.php?userid=39&start=2005-01-9&end=2005-02-09 HTTP/1.1

    [If {SESSION_ARRAY['userid']} not set]
        Set MESSAGE = 'Please login'
        Return Login Page Template
    [End If]

    [If QUERYSTRING['start'] not set or QUERYSTRING['start'] not in yyyy-mm-dddd format]
        Return Message Page Template with MESSAGE = 'illegal start date'
        [EXIT]
    [End If]
    Set START_DATE = [Format QUERYSTRING['start'] into yyyymmdddd format (no dashes)]

    [If QUERYSTRING['end'] not set or QUERYSTRING['end'] not in yyyy-mm-dddd format]
        Return Message Page Template with MESSAGE = 'illegal end date'
        [EXIT]
    [End If]
    Set END_DATE = [Format QUERYSTRING['end'] into yyyymmdddd format (no dashes)]

    Set BILL_PAY_STATUS_ARRAY, ERROR_NUM = [BESIM query with REQUEST = '8&' + {SESSION_ARRAY['userid']}] + '&' \
                                           + START_DATE + '&' + END_DATE
    [If ERROR_NUM not 0]
        Return Message Page Template with MESSAGE = 'Error Code: [ERROR_NUM]'
        [EXIT]
    [End If]

    Return Page with HTML = 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>SPECweb2009: Bill Pay Status</title>
  </head>
  <body bgcolor="white">
  <!-- SPECweb2009 Dynamic Data Area -->
  <table  summary="SPECweb2009_User_Id">
    <tr><th>User ID</th></tr>
    <tr><td>{SESSION_ARRAY['userid']}</td></tr> 
  </table>
    <table summary="SPECweb2009_Bill_Pay_Status_Result" cellpadding=3 border=1 >
    <tr>
      <th>Payee</th>
      <th>Date</th>
      <th>Amount</th>
      <th>Status</th>
    [Foreach bill_pay_line in BILL_PAY_STATUS_ARRAY]
      <tr>
      <td>{bill_pay_line['PayeeId']}</td>
      <td>{bill_pay_line['Date']}</td>
      <td align="right">{bill_pay_line['Amount']}</td>
      <td>Pending</td>
      </tr>
    [End Foreach]
    </tr>
    </table>
  <!-- SPECweb2009 Displayable Page Title -->
  <table>
    <tr>
      <td><b><font color="#9400d3">SPECweb2009: Bill Pay Status</font></b></td>
    </tr>
  </table>
  <!-- SPECweb2009 User Action Area -->
  [Include Menu Template]
  <!-- SPECweb2009 Image References -->
  <!-- SPECweb2009 Embedded Text -->
<pre>
[Include [PADDING_DIRECTORY]/bill_pay_status_output]</pre>
  </body>
</html>

1.2.14 Pseudocode for profile page

Sample request:
GET /bank/profile.php?userid=90 HTTP/1.1

    [If {SESSION_ARRAY['userid']} not set]
        Set MESSAGE = 'Please login'
        Return Login Page Template
    [End If]

    Set PROFILE_ARRAY, ERROR_NUM = [BESIM query with REQUEST = '9&' + {SESSION_ARRAY['userid']}]

    [If ERROR_NUM not 0]
        Return Message Page Template with MESSAGE = 'Error Code: [ERROR_NUM]'
        [EXIT]
    [End If]

    Return Page with HTML = 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>SPECweb2009: Profile</title>
  </head>
  <body bgcolor="white">
  <!-- SPECweb2009 Dynamic Data Area -->
  <table  summary="SPECweb2009_User_Id">
    <tr><th>User ID</th></tr>
    <tr><td>{SESSION_ARRAY['userid']}</td></tr> 
  </table>
  <table summary="SPECweb2009_Profile" cellpadding=3>
    <tr>
      <th>Address</th>
      <td>{PROFILE_ARRAY['Address']}</td>
    </tr>
    <tr>
      <th>City </th>
      <td>{PROFILE_ARRAY['City']}</td>
    </tr>
    <tr>
      <th>State </th>
      <td>{PROFILE_ARRAY['State']}</td>
    </tr>
    <tr>
      <th>Zip </th>
      <td>{PROFILE_ARRAY['Zip']}</td>
    </tr>
    <tr>
      <th>Phone </th>
      <td>{PROFILE_ARRAY['Phone']}</td>
    </tr>
    <tr>
      <th>Email </th>
      <td>{PROFILE_ARRAY['Email']}</td>
    </tr>
  </table>
  <!-- SPECweb2009 Displayable Page Title -->
  <table>
    <tr>
      <td><b><font color="#9400d3">SPECweb2009: Profile</font></b></td>
    </tr>
  </table>
  <!-- SPECweb2009 User Action Area -->
  [Include Menu Template]
    <form method="post" action="[change_profile page]">
      <table cellpadding=3>
        <tr>
          <td>Address</td>
          <td><textarea name="address" rows=3 cols=40></textarea></td>
	<tr>
	  <td>City </td>
	  <td><input type="text" name="city">
	</td>
	<tr>
	  <td>State </td>
	  <td><input type="text" name="state">
	</td>
	<tr>
	  <td>Zip </td>
	  <td><input type="text" name="zip">
	</td>
        <tr>
          <td>Phone </td>
          <td><input type="text" name="phone">
	</td>
        <tr>
          <td>Email </td>
          <td><input type="text" name="email">
	</td>
      </table>
      <input type="submit" value="Submit">
    </form>
  <!-- SPECweb2009 Image References -->
  <!-- SPECweb2009 Embedded Text -->
<pre>
[Include [PADDING_DIRECTORY]/profile]</pre>
  </body>
</html>

1.2.15 Pseudocode for change_profile page

Sample request:
POST /bank/change_profile.php HTTP/1.1
[..]
Content-Length: 107

address=1389+Olive Cirle&city=Wayland&state=OH&zip=59187&phone=phone=123-555-1212&email=customer663@isp.net

    [If {SESSION_ARRAY['userid']} not set]
        Set MESSAGE = 'Please login'
        Return Login Page Template
    [End If]

    [If any of these POST_DATA fields are empty: address, city, state, zip, phone, email]
       Set MESSAGE = 'Profile update failed: you submitted empty fields'
    [Else]
       Set CHANGE_PROFILE_CONFIRMATION, ERROR_NUM = [BESIM query with REQUEST = '10&' + {SESSION_ARRAY['userid']} + '&' + \
                                                    {POST_DATA['address']} + '&' + {POST_DATA['city']} + '&' + \
                                                    {POST_DATA['state']} + '&' + {POST_DATA['zip']} + '&' + \
                                                    {POST_DATA['phone']} + '&' + {POST_DATA['email']}]
    [End If]
    
    [If ERROR_NUM not 0]
        Set MESSAGE = 'Update profile failed'
    [Else]
        Set MESSAGE = 'Profile Changed.'
    [End If]

    Return Page with HTML = 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>SPECweb2009: Profile Changed</title>
  </head>
  <body bgcolor="white">
  <!-- SPECweb2009 Dynamic Data Area -->
  <table  summary="SPECweb2009_User_Id">
    <tr><th>User ID</th></tr>
    <tr><td>{SESSION_ARRAY['userid']}</td></tr> 
  </table>
  <table summary="SPECweb2009_Profile_Changed">
    <tr><th>Message</th></tr>
    <tr><td>[MESSAGE]</td></tr>
    <tr><td>Confirmation Code</td></tr>
    <tr><td>[CHANGE_PROFILE_CONFIRMATION]</td></tr>
  </table>
  <!-- SPECweb2009 Displayable Page Title -->
  <table>
    <tr>
      <td><b><font color="#9400d3">SPECweb2009: Profile Changed</font></b></td>
    </tr>
  </table>
  <!-- SPECweb2009 User Action Area -->
  [Include Menu Template]
  <!-- SPECweb2009 Image References -->
  <!-- SPECweb2009 Embedded Text -->
<pre>
[Include [PADDING_DIRECTORY]/change_profile]</pre>
  </body>
</html>

1.2.16 Pseudocode for order_check page

Sample request:
GET /bank/order_check.php?userid=76 HTTP/1.1

    [If {SESSION_ARRAY['userid']} not set]
        Set MESSAGE = 'Please login'
        Return Login Page Template
    [End If]

    Set ACCOUNT_BALANCE_ARRAY, ERROR_NUM = [BESIM query with REQUEST = '2&' + {SESSION_ARRAY['userid']}]
    
    Return Page with HTML = 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>SPECweb2009: Order Checks</title>
  </head>
  <body bgcolor="white">
  <!-- SPECweb2009 Dynamic Data Area -->
  <table  summary="SPECweb2009_User_Id">
    <tr><th>User ID</th></tr>
    <tr><td>{SESSION_ARRAY['userid']}</td></tr> 
  </table>
  <table summary="SPECweb2009_Acct_Balance" cellpadding=3 border=1>
    <tr>
      <th>Account</th>
      <th>Type</th>
      <th>Balance</th>
    </tr>
    [Foreach account in ACCOUNT_BALANCE_ARRAY]
        <tr><td>{account[accountno]}</td>
            <td>[If {account[type]} == "1"]
                   Checking
                [Else If {account[type]} == "2"]
                   Saving
                [Else]
                   Other
                [End If]</td>
            <td>{account[balance]}</td>
         </tr>
    [End Foreach]
  </table>
  <!-- SPECweb2009 Displayable Page Title -->
  <table>
    <tr>
      <td><b><font color="#9400d3">SPECweb2009: Order Checks</font></b></td>
    </tr>
  </table>
  <!-- SPECweb2009 User Action Area -->
  [Include Menu Template]
    <form method="post" action="[place_check_order page]">
      <b>Please choose the check design below:</b><br>
      <table cellpadding="5" border=1>
      <tr>
        <td><input type="radio" name="check_design" value="1">
            <img src="images/check_01.jpg" align="middle" alt="check design #1"></td>
        <td><input type="radio" name="check_design" value="2">
            <img src="images/check_02.jpg" align="middle" alt="check design #2"></td>
      <tr>
        <td><input type="radio" name="check_design" value="3">
            <img src="images/check_03.jpg" align="middle" alt="check design #1"></td>
        <td><input type="radio" name="check_design" value="4">
            <img src="images/check_04.jpg" align="middle" alt="check design #4"></td>
      <tr>
        <td><input type="radio" name="check_design" value="5">
            <img src="images/check_05.jpg" align="middle" alt="check design #5"></td>
        <td><input type="radio" name="check_design" value="6">
            <img src="images/check_06.jpg" align="middle" alt="check design #6"></td>
      <tr>
        <td><input type="radio" name="check_design" value="7">
            <img src="images/check_07.jpg" align="middle" alt="check design #7"></td>
        <td><input type="radio" name="check_design" value="8">
            <img src="images/check_08.jpg" align="middle" alt="check design #8"></td>
      <tr>
        <td><input type="radio" name="check_design" value="9">
            <img src="images/check_09.jpg" align="middle" alt="check design #9"></td>
        <td><input type="radio" name="check_design" value="10">
            <img src="images/check_10.jpg" align="middle" alt="check design #10"></td>
      </table>
      <b>Number of checks: </b><input type="text" name="number"><br>
      <b>Charge account: </b><input type="text" name="account_no"><br>
      <input type="submit" value="Submit">
    </form>
  <!-- SPECweb2009 Image References -->
  <!-- SPECweb2009 Embedded Text -->
<pre>
[Include [PADDING_DIRECTORY]/order_check]</pre>
  </body>
</html>

1.2.17 Pseudocode for place_check_order page

Sample request:
POST /bank/place_check_order.php HTTP/1.1
[..]
Content-Length: 57

userid=76&check_design=5&number=300&account_no=0477284100
    [If {SESSION_ARRAY['userid']} not set]
        Set MESSAGE = 'Please login'
        Return Login Page Template
    [End If]

    [If {POST_DATA['number']} is empty]
       Return Message Page Template with MESSAGE = 'Empty number'
       [EXIT]
    [End If]
    [If {POST_DATA['check_design']} is empty]
       Return Message Page Template with MESSAGE = 'You did not select check design'
       [EXIT]
    [End If]
    [If {POST_DATA['account_no']} is empty]
       Return Message Page Template with MESSAGE = 'You did not specify account'
       [EXIT]
    [End If]

    [If {POST_DATA['number']} <= 0]
       Return Message Page Template with MESSAGE = 'Invalid number'
       [EXIT]
    [End If]
    [If {POST_DATA['check_design']} <= 0 or {POST_DATA['check_design']} > 10]
       Return Message Page Template with MESSAGE = 'Invalid design'
       [EXIT]
    [End If]
    Set TOTAL_PRICE = {POST_DATA['number']} * 1.0 (to convert to dollar value)

    Set PLACE_CHECK_ORDER_CONFIRMATION, ERROR_NUM = [BESIM query with REQUEST = '11&' + {SESSION_ARRAY['userid']} + '&' + \
                                              {POST_DATA['account_no']} + '&' + TOTAL_PRICE]

    [If ERROR_NUM not 0]
       Return Message Page Template with MESSAGE = 'Error code: [ERROR_NUM]'
       [EXIT]
    [End If]
    
    Return Page with HTML = 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>SPECweb2009: Place Check Order Result</title>
  </head>
  <body bgcolor="white">
  <!-- SPECweb2009 Dynamic Data Area -->
  <table  summary="SPECweb2009_User_Id">
    <tr><th>User ID</th></tr>
    <tr><td>{SESSION_ARRAY['userid']}</td></tr> 
  </table>
  <table summary="SPECweb2009_Place_Check_Order">
    <tr><th>Message</th></tr>
    <tr><td>Check order placed successfully</td></tr>
    <tr><td>Confirmation Code</td></tr>
    <tr><td>[PLACE_CHECK_ORDER_CONFIRMATION]</td></tr>
  </table>
  <!-- SPECweb2009 Displayable Page Title -->
  <table>
    <tr>
      <td><b><font color="#9400d3">SPECweb2009: Place Check Order Result</font></b></td>
    </tr>
  </table>
  <!-- SPECweb2009 User Action Area -->
  [Include Menu Template]
  <!-- SPECweb2009 Image References -->
  <!-- SPECweb2009 Embedded Text -->
<pre>
[Include [PADDING_DIRECTORY]/place_check_order]</pre>
  </body>
</html>

1.2.18 Pseudocode for transfer page

Sample request:
GET /bank/transfer.php HTTP/1.1
    [If {SESSION_ARRAY['userid']} not set]
        Set MESSAGE = 'Please login'
        Return Login Page Template
    [End If]

    Set ACCOUNT_BALANCE_ARRAY, ERROR_NUM = [BESIM query with REQUEST = '2&' + {SESSION_ARRAY['userid']}]
    
    Return Page with HTML = 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>SPECweb2009: Transfer Money</title>
  </head>
  <body bgcolor="white">
  <!-- SPECweb2009 Dynamic Data Area -->
  <table  summary="SPECweb2009_User_Id">
    <tr><th>User ID</th></tr>
    <tr><td>{SESSION_ARRAY['userid']}</td></tr> 
  </table>
  <table summary="SPECweb2009_Acct_Balance" cellpadding=3 border=1>
    <tr>
      <th>Account</th>
      <th>Type</th>
      <th>Balance</th>
    </tr>
    [Foreach account in ACCOUNT_BALANCE_ARRAY]
        <tr><td>{account[accountno]}</td>
            <td>[If {account[type]} == "1"]
                   Checking
                [Else If {account[type]} == "2"]
                   Saving
                [Else]
                   Other
                [End If]</td>
            <td>{account[balance]}</td>
         </tr>
    [End Foreach]
  </table>
  <!-- SPECweb2009 Displayable Page Title -->
  <table>
    <tr>
      <td><b><font color="#9400d3">SPECweb2009: Transfer Money</font></b></td>
    </tr>
  </table>
  <!-- SPECweb2009 User Action Area -->
  [Include Menu Template]
  <form method="post" action="[post_transfer page]">
    <table cellpadding=3>
      <tr>
        <th>From account</th>
        <td><input type="text" name="from"></td>
      <tr>
        <th>To account</th>
        <td><input type="text" name="to"></td>
      <tr>
        <th>Amount</th>
        <td><input type="text" name="amount"></td>
    </table>
      <input type="submit" value="Submit">
  </form>
  <!-- SPECweb2009 Image References -->
  <!-- SPECweb2009 Embedded Text -->
<pre>
[Include [PADDING_DIRECTORY]/transfer]</pre>
  </body>
</html>

1.2.19 Pseudocode for post_transfer page

Sample request:
POST /bank/post_transfer.php HTTP/1.1
[..]
Content-type: application/x-www-form-urlencoded
Content-Length: 42

from=0374113716&to=0489888599&amount=50.00
    [If {SESSION_ARRAY['userid']} not set]
        Set MESSAGE = 'Please login'
        Return Login Page Template
    [End If]

    [If {POST_DATA['amount']} is empty or {POST_DATA['amount']} is not numeric]
       Return Message Page Template with MESSAGE = 'Invalid Amount'
       [EXIT]
    [End If]

    AMOUNT = [{POST_DATA['amount']} converted to floating point value]
    [If AMOUNT <= 0.0]
       Return Message Page Template with MESSAGE = 'Amount must be greater than 0'
       [EXIT]
    [End If]

    [If {POST_DATA['to']} == {POST_DATA['from']}]
       Return Message Page Template with MESSAGE = 'Transfer from and to the same account not allowed'
       [EXIT]
    [End If]

    Set DATE = [Local date formatted in "YYYYmmdd", i.e. 20050228]
    Set POST_TRANSFER_ARRAY, ERROR_NUM = [BESIM query with REQUEST = '12&' + {SESSION_ARRAY['userid']} + '&' + \
                                              {POST_DATA['from']} + '&' + AMOUNT + '&' {POST_DATA['to']} + '&' + DATE]

    [If ERROR_NUM not 0]
       Return Message Page Template with MESSAGE = 'Error Code: [ERROR_NUM]'
       [EXIT]
    [End If]
    
    Return Page with HTML = 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>SPECweb2009: Transfer Result</title>
  </head>
  <body bgcolor="white">
  <!-- SPECweb2009 Dynamic Data Area -->
  <table  summary="SPECweb2009_User_Id">
    <tr><th>User ID</th></tr>
    <tr><td>{SESSION_ARRAY['userid']}</td></tr> 
  </table>
  <table summary="SPECweb2009_Transfer_Summary" cellpadding=3 border=1>
    <tr>
      <th>From</th>
      <th>To</th>
      <th>Amount</th>
    </tr>
    <tr>
      <td>{POST_DATA['from']}</td>
      <td>{POST_DATA['to']}</td>
      <td>[AMOUNT]</td>
    </tr>
  </table>
  <table summary="SPECweb2009_Acct_Balance" cellpadding=3 border=1>
    <tr>
      <th>Account</th>
      <th>New Balance</th>
    </tr>
      [Foreach account in POST_TRANSFER_ARRAY]
        <tr>
          <td>{account[Acct_#]}</td>
          <td>{account[Balance]}</td>
        </tr>
      [End Foreach]
  </table>
  <!-- SPECweb2009 Displayable Page Title -->
  <table>
    <tr>
      <td><b><font color="#9400d3">SPECweb2009: Transfer Result</font></b></td>
    </tr>
  </table>
  <!-- SPECweb2009 User Action Area -->
  [Include Menu Template]
  <!-- SPECweb2009 Image References -->
  <!-- SPECweb2009 Embedded Text -->
<pre>
[Include [PADDING_DIRECTORY]/post_transfer]</pre>
  </body>
</html>

1.2.20 Pseudocode for logout page

Sample request:
GET /bank/logout.php?userid=6 HTTP/1.1
    Return Page with HTML = 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>SPECweb2009: Logout</title>
  </head>
  <body bgcolor="white">
  <!-- SPECweb2009 Dynamic Data Area -->
  <table  summary="SPECweb2009_User_Id">
    <tr><th>User ID</th></tr>
    <tr><td>{SESSION_ARRAY['userid']}</td></tr> 
  </table>
  <!-- SPECweb2009 Displayable Page Title -->
  <table>
    <tr>
      <td><b><font color="#9400d3">SPECweb2009: Logout</font></b></td>
    </tr>
  </table>
  <!-- SPECweb2009 User Action Area -->
  <center>You may <a href="[login page]">login</a> again.
  </center>
  <!-- SPECweb2009 Image References -->
  <!-- SPECweb2009 Embedded Text -->
<pre>
[Include [PADDING_DIRECTORY]/logout]</pre>
  </body>
</html>
    Destroy all session state information

Copyright © 2005-2010 Standard Performance Evaluation Corporation.  All rights reserved.