You are on page 1of 5

INT213 Assignment 3 The third assignment builds upon the second.

. This assignment checks a database table using the input email address to determine if the user has been to your page before. If the user is new to the system, your page will verify that the user has also input their name and will add a new record to the database recording their email address, their name, and the date/time when the record was added. If the user is returning to the system, your page will validate and update their name only if the user input a changed name and also record the date/time when the record was changed. In either case, the page will always output the user name and the date/time the database record was last added or changed. Database The "INT213A4.mdb" file must reside in the same folder as your ASP script. This is the same DB we will use for the next assignment as well as this one. Connect using this command: conn.Open server.mappath("INT213A4.mdb") Do not modify the DB. Use a DSN-less connection to a Microsoft Access DB provider (i.e. NOT ODBC) to open the DB. The UTE folder and ute.asp script should reside in wwwroot. http://localhost/ute.asp will allow you to inspect and modify the DB. To show fields and data returned from the form, you may find the debug.asp debugging script useful. Near the top of your script, insert this command:
Server.Execute "\debug.asp"

Specific Assignment 3 enhancements:


Copy your Assignment 2 ASP file to A3_012345.asp That is, "A3_" & the first 6 digits of your student number & .ASP extension. Add a new text input field to the page below the email input... User Name: [______________________] * required for new users, optional for returning users. Add the following logic to your page: Only if the form was submitted by the user pressing a button... 31 October 2011 1 of 5

INT213 Assignment 3 Retrieve the input on the form: email address all blanks removed, converted to lower case. user name trimmed of leading/trailing spaces, text converted to upper case. It is very important that only this converted input is used for the following tasks. The user's converted input should be output back to the form's fields. Create a RecordSet with an SQL query that searches for the email address in the DB "IN213A4.mdb", in table "USERS". If the email address was NOT FOUND, display a message that the email address is new to the system. If the email is invalid as per Assignment 2 rules or the length is greater than the size of the column in the database display a specific message about the problem. If the user name is not in the format FAMILYNAME, GIVENNAME as per Lab 5 rules (contains one comma, Family name must be at least 2 characters in length, Given name at least 1 char.) or the length of either name is greater than the size of the respective column in the database then display a specific message about the problem. If both the input email and user name are valid, add a record to the USERS table with the email address, names, and the current date and time use the VBScript function, Now(). Other table columns for password and phone number will not be used until Assignment 4. Display a message showing the data which was added to the database. If the email address was FOUND, from the RecordSet, display the User Name and last update date/time. If the input user name is not empty and is invalid (see above), then display a specific message about the problem. If the input user name is not empty and is valid (see above), update the USERS table with the new names and update the last time the record was changed to Now(), i.e. the VBScript function that returns current date and time. Display a message showing the data which was changed in the database. Calculate and display the conversion output and/or validation messages as per 31 October 2011 2 of 5

INT213 Assignment 3 your previous assignment. This assignment includes all the requirements of previous assignments. Marks will be deducted if omissions/errors in the earlier assignments are not corrected in this one. Remove all debugging code before submitting, especially Server.Execute "\debug.asp" else there will be a 10% deduction. Spelling counts on the screen. An appropriate title bar is expected. A comment documenting author(s), student number(s), course & section, date, and assignment number is required. Commented code is expected of all programmers; comments explain what the code means, your intent and the application's purpose. (Don't explain what it does. The code itself is explanation enough.) Marking Scheme .5 user input on form converted (standardize spacing and case) and output back to the form's fields .5 email address validated .5 user name validated for existing email address: only when input .5 user name always validated for new email address .5 for existing email: data on USERS table displayed .5 new user message displayed if email address not found in USERS table .5 new record added to USERS table .5 existing record changed on USERS table .5 data added/changed in USERS table displayed .5 RecordSet and DB connection objects properly closed 5 total. 5% of final mark Validation messages must identify the specific problem else only half marks will be awarded. "Invalid, incorrect, wrong" and other non-specific synonyms are unacceptable words in a message. Describe how the user can correct the problem in a way that is meaningful to what they are trying to accomplish. Possible marking deductions -.5 if IN213A4.mdb cannot be opened in same folder as script -.5 for each IIS error found during evaluation. -.5 for debugging output left active in program. -.5 for each previous assignment error not corrected in this assignment. -.5 for misleading or no title bar in browser window -.5 for insufficient commenting or missing author comments Spelling: -.25 for one mistake, -.5 for two+. 31 October 2011 3 of 5

INT213 Assignment 3 Submission Submit by email as per due date on INT213 web page. Submission date is as per Seneca's email server. If you worked on this with a partner, submit only one assignment. Your email contains: - subject line of "INT213 Assignment 3" - your registered name - first 6 digits of your student number - if working in a pair, include same information for your partner and CC them in the email. - statement of academic honesty in in-line text format (NOT as a .doc or .txt attachment) as per http://cs.senecac.on.ca/bullets/honesty.txt (see notes at http://cs.senecac.on.ca/bullets/cheating.html) Attachment when working alone is named A2_012345.asp That is, "A2_" & the first 6 digits of your student number & .ASP extension Attachment from a pair is named A2_012345_054321.asp That is, "A2_" & the first 6 digits of the student number the assignment is based on & the first 6 digits of the second student number & .ASP extension with underscore separators. The ASP file contains a comment at the top which documents: - your registered name, first 6 digits of your student number, your learn email address. - course & section, date, and assignment number - if working in a pair, include same information for your partner I will deduct 10% of the assignment value for each of the submission requirements not done as specified.

DEBUGGING : Removing the needles from the haystack. I can help with debugging. Send an email with your script attached and a description of the problem.

31 October 2011

4 of 5

INT213 Assignment 3 Prototype of a conversion calculator... Validation messages should appear beside the input box. Apples / Oranges Conversion Calculator Email: [ ] email validation message

User Name: [ ] user name validation message * required for new users, optional for returning users. Quantity: [ a ]

numeric validation message conversion validation message

Convert: [ XY ] AO Apples to Oranges OA Oranges to Apples [ Submit ]

Apples / Oranges Conversion Calculator Email: [Account@DOMAIN.Ca ]

User Name: [MacDonald, John A. ] user name validation message * required for new users, optional for returning users. Quantity: [ 2345 ]

Convert: [ ao ] AO Apples to Oranges OA Oranges to Apples 12345 Apples is 54321 Oranges. Email user is [account] Email domain is [domain.ca] Email address not found in database. Email: account@domain.ca New User Name: MACDONALD, JOHN A. Added at 3/21/2007 2:29:38 PM

or Email address account@domain.ca found in database with User Name: MACDONALD, JOHN A. Last updated 3/21/2007 2:29:38 PM New User Name: HARPER, STEPHEN Changed at 3/22/2007 3:08:27 PM
[ Submit ] 31 October 2011 5 of 5

You might also like