Week Three CIT 354 Internet II. 2 Objectives Displaying Dynamic Content Sending E-Mail Using Your...

20
Week Three Week Three CIT 354 Internet II CIT 354 Internet II

Transcript of Week Three CIT 354 Internet II. 2 Objectives Displaying Dynamic Content Sending E-Mail Using Your...

Page 1: Week Three CIT 354 Internet II. 2 Objectives Displaying Dynamic Content Sending E-Mail Using Your File System Common Programming Errors Summary Quiz,

Week ThreeWeek Three

CIT 354 Internet IICIT 354 Internet II

Page 2: Week Three CIT 354 Internet II. 2 Objectives Displaying Dynamic Content Sending E-Mail Using Your File System Common Programming Errors Summary Quiz,

22

ObjectivesObjectives

Displaying Dynamic ContentDisplaying Dynamic Content

Sending E-MailSending E-Mail

Using Your File SystemUsing Your File System

Common Programming ErrorsCommon Programming Errors

SummarySummary

Quiz, Homework, and ProjectQuiz, Homework, and Project

Page 3: Week Three CIT 354 Internet II. 2 Objectives Displaying Dynamic Content Sending E-Mail Using Your File System Common Programming Errors Summary Quiz,

33

Displaying Dynamic ContentDisplaying Dynamic Content

Displaying Browser-specific HTML Displaying Browser-specific HTML

Displaying Platform-specific HTMLDisplaying Platform-specific HTML

Working with String FunctionsWorking with String Functions

Redirection to a New LocationRedirection to a New Location

Page 4: Week Three CIT 354 Internet II. 2 Objectives Displaying Dynamic Content Sending E-Mail Using Your File System Common Programming Errors Summary Quiz,

44

Displaying Browser-specific HTMLDisplaying Browser-specific HTML

DifferencesDifferences– Microsoft Internet ExplorerMicrosoft Internet Explorer– Netscape NavigatorNetscape Navigator

ImplementationImplementation– HTTP_USER_AGENTHTTP_USER_AGENT– preg_matchpreg_match

Example: browsermatch.php (P101)Example: browsermatch.php (P101)

Page 5: Week Three CIT 354 Internet II. 2 Objectives Displaying Dynamic Content Sending E-Mail Using Your File System Common Programming Errors Summary Quiz,

55

Displaying Platform-specific HTMLDisplaying Platform-specific HTML

DifferencesDifferences– Fonts (Times New Roman) and font size Fonts (Times New Roman) and font size

(10, 11, 12 points)(10, 11, 12 points)– Microsoft WindowsMicrosoft Windows– MacintoshMacintosh– Linux/UNIXLinux/UNIX

Example: platformmatch.php (P 103)Example: platformmatch.php (P 103)

Page 6: Week Three CIT 354 Internet II. 2 Objectives Displaying Dynamic Content Sending E-Mail Using Your File System Common Programming Errors Summary Quiz,

66

Working with String FunctionsWorking with String Functions

Creating an Input FormCreating an Input Form– ExerciseExercise

generic_form.html (P107)generic_form.html (P107)

Creating a Script to Display Form valuesCreating a Script to Display Form values– ExerciseExercise

display_input.php (P109)display_input.php (P109)

Submitting your Form and Getting Submitting your Form and Getting ResultsResults

Page 7: Week Three CIT 354 Internet II. 2 Objectives Displaying Dynamic Content Sending E-Mail Using Your File System Common Programming Errors Summary Quiz,

77

Redirection to a New LocationRedirection to a New LocationCreating a Redirection FormCreating a Redirection Form– Example: redirect_form.html (P 114)Example: redirect_form.html (P 114)

Creating the Redirection Script and testing Creating the Redirection Script and testing ItIt– Example: do_redirect.php (P 115)Example: do_redirect.php (P 115)

Submitting your Form and Getting ResultsSubmitting your Form and Getting Results

Page 8: Week Three CIT 354 Internet II. 2 Objectives Displaying Dynamic Content Sending E-Mail Using Your File System Common Programming Errors Summary Quiz,

88

Sending E-MailSending E-Mail

Using an SMTP ServerUsing an SMTP Server

A Simple Feedback FormA Simple Feedback Form

A Feedback Form with Custom Error A Feedback Form with Custom Error MessagesMessages

Page 9: Week Three CIT 354 Internet II. 2 Objectives Displaying Dynamic Content Sending E-Mail Using Your File System Common Programming Errors Summary Quiz,

99

Using an SMTP ServerUsing an SMTP Server

Find an outgoing mail serverFind an outgoing mail server– Example: smtp.com or ISPExample: smtp.com or ISP

SMTP-Related Changes in php.iniSMTP-Related Changes in php.ini– SMTP and sendmail_fromSMTP and sendmail_from

Page 10: Week Three CIT 354 Internet II. 2 Objectives Displaying Dynamic Content Sending E-Mail Using Your File System Common Programming Errors Summary Quiz,

1010

A Simple Feedback FormA Simple Feedback Form

Creating the feedback FormCreating the feedback Form– Example: simple_form.html (P 120)Example: simple_form.html (P 120)

Creating a Script to Mail Your FormCreating a Script to Mail Your Form– Example: send_simpleform.php (P 122)Example: send_simpleform.php (P 122)

Submitting Your Form and Getting Submitting Your Form and Getting ResultsResults

Page 11: Week Three CIT 354 Internet II. 2 Objectives Displaying Dynamic Content Sending E-Mail Using Your File System Common Programming Errors Summary Quiz,

1111

A Feedback Form with Custom Error A Feedback Form with Custom Error MessageMessage

Creating the Initial ScriptCreating the Initial Script– Example: allinone_form.php (P 128)Example: allinone_form.php (P 128)

Adding Error Checking to the ScriptAdding Error Checking to the Script– Example: allinone_form.php (P 131)Example: allinone_form.php (P 131)

Submitting Your Form and Getting ResultsSubmitting Your Form and Getting Results

Saving the Values if You make an errorSaving the Values if You make an error– Example: allinone_form.php (P 138)Example: allinone_form.php (P 138)

Note: This exercise is similar to your Note: This exercise is similar to your project.project.

Page 12: Week Three CIT 354 Internet II. 2 Objectives Displaying Dynamic Content Sending E-Mail Using Your File System Common Programming Errors Summary Quiz,

1212

Using Your File SystemUsing Your File System

File Paths and PermissionsFile Paths and Permissions

Displaying Directory ContentsDisplaying Directory Contents

Working with fopen() and fclose()Working with fopen() and fclose()

File System HousekeepingFile System Housekeeping

Page 13: Week Three CIT 354 Internet II. 2 Objectives Displaying Dynamic Content Sending E-Mail Using Your File System Common Programming Errors Summary Quiz,

1313

File Paths and PermissionsFile Paths and PermissionsFor Windows, the forward slash(/) and the For Windows, the forward slash(/) and the backslash(\) are both acceptable.backslash(\) are both acceptable.

For Linux/UNIX, the only forward slash is For Linux/UNIX, the only forward slash is acceptable.acceptable.

Path Name and default drive(c:/)Path Name and default drive(c:/)

Page 14: Week Three CIT 354 Internet II. 2 Objectives Displaying Dynamic Content Sending E-Mail Using Your File System Common Programming Errors Summary Quiz,

1414

Displaying Directory ContentsDisplaying Directory Contents

Example: The goal is to open a directory, Example: The goal is to open a directory, find the names of all the files in the find the names of all the files in the directory, and print the results in a bullet directory, and print the results in a bullet listlist

Creating the Initial ScriptCreating the Initial Script– listfiles.php (P 143)listfiles.php (P 143)

Submitting Your Form and Getting ResultsSubmitting Your Form and Getting Results

Page 15: Week Three CIT 354 Internet II. 2 Objectives Displaying Dynamic Content Sending E-Mail Using Your File System Common Programming Errors Summary Quiz,

1515

Working with fopen() and fclose()Working with fopen() and fclose()

Creating a New FileCreating a New File– Example: newfile.php (P 147)Example: newfile.php (P 147)

Checking If a File already ExitsChecking If a File already Exits– Example: newfile_checkfirst.php (P 150)Example: newfile_checkfirst.php (P 150)

Page 16: Week Three CIT 354 Internet II. 2 Objectives Displaying Dynamic Content Sending E-Mail Using Your File System Common Programming Errors Summary Quiz,

1616

Working with fopen() and fclose()Working with fopen() and fclose()

Appending Data to a FileAppending Data to a FileExample: writedata.php (P 152)Example: writedata.php (P 152)

Reading Data from a FileReading Data from a FileExample: readdata.php (P 155)Example: readdata.php (P 155)

Sending File Contents via E-MailSending File Contents via E-Mail

Example: mailcontents.php (P 157)Example: mailcontents.php (P 157)

Submitting Your Form and Getting ResultsSubmitting Your Form and Getting Results

Page 17: Week Three CIT 354 Internet II. 2 Objectives Displaying Dynamic Content Sending E-Mail Using Your File System Common Programming Errors Summary Quiz,

1717

File System HousekeepingFile System Housekeeping

Copying FilesCopying Files

Example: copyfile.php (P 160)Example: copyfile.php (P 160)

Renaming FilesRenaming Files

Example: renamefile.php (P 162)Example: renamefile.php (P 162)

Deleting FilesDeleting Files

Example: deletefile.php (P 164)Example: deletefile.php (P 164)

Submitting Your Form and Getting ResultsSubmitting Your Form and Getting Results

Page 18: Week Three CIT 354 Internet II. 2 Objectives Displaying Dynamic Content Sending E-Mail Using Your File System Common Programming Errors Summary Quiz,

1818

Common Programming ErrorsCommon Programming ErrorsOmitting or incorrectly typing the opening tag <? that Omitting or incorrectly typing the opening tag <? that signifies the start of a PHP statement.signifies the start of a PHP statement.Omitting or incorrectly typing the closing tag ?> that Omitting or incorrectly typing the closing tag ?> that signifies the end of a PHP statement.signifies the end of a PHP statement.Misspelling the name of a variable or function.Misspelling the name of a variable or function.Forgetting to close a string with a double quote symbol.Forgetting to close a string with a double quote symbol.Dividing integer values incorrectly.Dividing integer values incorrectly.Forgot to use the escape (\) character.Forgot to use the escape (\) character.Using a variable in an expression before a value has Using a variable in an expression before a value has been assigned to the variable.been assigned to the variable.Incorrectly typing the letter O for the number zero (0), or Incorrectly typing the letter O for the number zero (0), or vice versa. Incorrectly typing the letter l, for the number vice versa. Incorrectly typing the letter l, for the number 1, or vice versa.1, or vice versa.

Page 19: Week Three CIT 354 Internet II. 2 Objectives Displaying Dynamic Content Sending E-Mail Using Your File System Common Programming Errors Summary Quiz,

1919

Chapter SummaryChapter SummaryDisplaying Dynamic ContentDisplaying Dynamic Content

Sending E-MailSending E-Mail

Using Your File SystemUsing Your File System

Page 20: Week Three CIT 354 Internet II. 2 Objectives Displaying Dynamic Content Sending E-Mail Using Your File System Common Programming Errors Summary Quiz,

2020

Quiz, Homework, and ProjectQuiz, Homework, and ProjectQuiz 1Quiz 1– Date: This WeekDate: This Week– Contents: (Chapters 4 – 6)Contents: (Chapters 4 – 6)

Homework 2Homework 2– Due Date: Next WeekDue Date: Next Week

Project 1Project 1– Due Date: Week 5Due Date: Week 5– Team Approach( 1 – 3 members)Team Approach( 1 – 3 members)