Clients, Servers and PHP

Clients, Servers and PHP

CSE 103 Day 20 Jo is out today; Im Carl Sign up for a makeup if you havent taken one since the last in-class BT Must take one by Wednesday to get all your attempts in! More makeups coming later this week If you are not in the class, please save and log out. /page.php Day 20, Slide 1 Clients, Servers and PHP What are servers? What are clients? What is PHP? How is PHP like HTML?

How do you distinguish PHP code from HTML tags? Which computer executes the PHP code, the client or the server? What can you do using PHP that you can't do using HTML? /page.php Day 20, Slide 2 Serving HTML files requests Server Client receives contents of U://msu/user/s/p/sparty/web/day06.html /page.php Day 20, Slide 3 Serving PHP files requests Client Server processes contents of U://msu/user/ s/p/sparty/web/ day20.php and returns results of processing receives result of PHP processing from server /page.php Day 20, Slide 4 Dreamweaver MX Start Dreamweaver by going to: Start => Program Files => Development Apps => Web => Dreamweaver MX => Dreamweaver MX Seven parts of Dreamweaver window: Menu Bar Insert Panel Document Toolbar

Document Window Properties Panel Files Panel Answers Panel /page.php Day 20, Slide 5 Creating a Web page Use Dreamweaver Create an HTML file with the following paragraph: Welcome to my day 20 page for CSE 103. This page was created at 10:43AM on Thursday, March 24, 2005. If you look at the source, you will see that Dreamweaver has included the and tags for you.

Save the file in your web folder as day20.html /page.php Day 20, Slide 6 Testing your page Browse to your page using Does it look the way it should? Browse to your page using Does the page look the same?

/page.php Day 20, Slide 7 Web Page Development Cycle EDIT and SAVE the file in your AFS space p:\web\day20.html TEST by BROWSING to the page /page.php Day 20, Slide 8 Moving from HTML to PHP Now save the file as day20.php. Again browse

to this file. Any differences? In Dreamweaver, after the introductory paragraph, add a sentence that says: This page created with PHP version: All PHP code must be enclosed between . Enter these tags. Note that you must use Code View! Everything between these two tags is treated as PHP Between these tags, include the command: print phpversion(); /page.php Day 20, Slide 9

PHP Before and After Save again and browse to this page View the source code for this page in the browser Compare that code to the day20.php script as viewed in Dreamweaver What is the same between these two views? What is different between them? /page.php Day 20, Slide 10 Essence of PHP Coming soon from CK Start a "PHP block" with

Each command must end with a semicolon All HTML outside PHP blocks is ignored by PHP All PHP is run first, before the page loads No PHP is sent to browser Can output text inside PHP with print (or echo) Can use HTML tags with print to format, or put an open HTML tag before a PHP block and a close HTML tag after the block (examples next slide) Close PHP block with ?> You may have many PHP blocks on one page /page.php Day 20, Slide 11 PHP and HTML formatting HTML formatting inside PHP blocks:

This page created with PHP "; print phpversion(); print ""; ?>

Displays as This page created with PHP 4.3.3 Notice use of multiple prints, semicolon after each one When printing literal strings (like the tags), put them in quotes, just like in SQL We can open blocks inside other HTML tags with no problem (this example is inside

) No extra space before/after helps keep the formatting right /page.php Day 20, Slide 12 Including Pages Create a file with an HTML fragment to contain your

copyright notice: 2005 by Copyright symbol from Insert/Special Characters Do not include the standard tags (HTML, HEAD, BODY); only tags and text that go in the body of the page such as

or . Save as copyright.php (in web folder). Now use the include() function to add this copyright notice into your day20.php file. For help, read the PHP Manual page on include() linked from todays classwork page Look at examples, find one that's like what you want /page.php Day 20, Slide 13

Reading the Documentation 101 Use the link on the todays Classwork page to see documentation for PHP function date() Look at the description line: string date ( string format [, int timestamp]) string date(): string is the type returned (output) by the function. All functions need () string format: a required parameter. It has to be of string type [, int timestamp]: an optional parameter (indicated by []). If we include this, we must put a comma after the format. It must of type int (integer) Keep reading to find notes and examples of each parameter /page.php

Day 20, Slide 14 Time Stamping a Page Use a PHP function to put a time stamp on your page date() writes date/time in a human-readable format See the Manual page linked to todays class page Change the page so that it always displays the current time and date, i.e., replace: 10:43AM Instead, show the time when the page is being viewed. Thursday, March 25, 2004 Instead, show the date on which the page is being viewed. /page.php Day 20, Slide 15

Ultimate Bridge Task Work alone or in pairs (IF approved) Create database in Access; we convert to MySQL Create website using PHP to interface with db Include pages to add/edit data; use those to get data into db (we don't import data from Access) If you have a large set of pre-existing data, send an e-mail and we'll work something out. Demonstrate mastery of topics taught in class and ability to extend knowledge beyond that (new functions, new types of queries, etc.) /page.php Day 20, Slide 16 More UBT information

General abstract available on classwork page Grading: 34% queries 22% design 24% PHP 12% General 8% HTML Work in pairs (if approved) but you lose 25% off the top and must do extra work to make up for that. Final grade: < 50%: 3.0; 50-74%: 3.5; 75%+ : 4.0 /page.php

Day 20, Slide 17 A good UBT should: Demonstrate good database design Appropriate tables, fields, datatypes, keys, and relationships, as well as integrity and minimal redundancy (everything related to the 2.5 BT) Demonstrate mastery of various queries Both Select and Action, use of functions, calculated fields, inner/outer joins, aggregate functions, etc. (everything related to the 2.0, plus Action queries from the 1.5) Demonstrate ability to learn new concepts Use new functions, query types, etc. that we didnt cover in-class or on any BT

Many points here; don't miss this or you won't get 4.0 /page.php Day 20, Slide 18 UBT Topics and Homework There is a list of suggested topics on todays classwork page E-mail [email protected] with your first three choices ASAP (by this Friday, April 1 at latest) Homework: Read textbook and links from day 19 homework, if you haven't already Practice date formatting /page.php Day 20, Slide 19

Recently Viewed Presentations

  • Use QuickSlide tab to insert picture PGMD: a

    Use QuickSlide tab to insert picture PGMD: a

    Patient with complex genotype. the de-novo CHEK2 variant may increase cancer risk in the patient. the 22q11.2 duplicationmay increase cancer risk in the patient and enhance the effect of intellectual disabiltiy.
  • From Ether to Matter to Ether by Francis

    From Ether to Matter to Ether by Francis

    Planck Ether Mass. 186 Ether Mass. Einstein actually predicts a collapse of matter to the superforce and the Planck scale. Just substitute the Planck length and the Planck mass into the Newton gravitational force. What you have derived in your...
  • Pacific Northwest

    Pacific Northwest

    Pacific Northwest Geography 1500-200 miles long Only 100 miles wide Rich marine and forest biome Redwood and cedars common Surprisingly warm coastal water Bounded by coast range to the east Subsistence Primarily marine (H&G) Halibut Whale Salmon Sturgeon Eulachon (smelt)...
  • Linear Collider R&amp;D Opportunities Workshop May 31, 2002

    Linear Collider R&D Opportunities Workshop May 31, 2002

    Need new students! 2016 Bump Hunt (100% sample/Pass2) 2016 SIMP Search 2019 Bump Hunt 2019 Vertex Search …plus more hidden sector searches possible! Discussed Strategy for next HPS publications Matt and Nathan reviewed plans. 2015 0.5mm Bump Hunt to be...
  • Sidestepping cultural chauvinism by teasing the etics out

    Sidestepping cultural chauvinism by teasing the etics out

    Judging scientifically how to decide? predictive power for the explicandum the issue to be explained… Yik and Bond's (1993, p. 91) conclusion that, "for present purposes, the emic measure did no better than the imposed etic" [in predicting degree of...
  • Water Balance of Plants - Page Not Found - Minnesota State ...

    Water Balance of Plants - Page Not Found - Minnesota State ...

    Aluminium toxicity is the most widespread problem in acid soils. Aluminium is present in all soils, but dissolved Al3+ is toxic to plants; Al3+ is most soluble at low pH, above pH 5.2 little aluminum is in soluble form in...
  • News from France - EdReNe

    News from France - EdReNe

    ICT for education in France Rosa María Gómez de Regil 5th EdReNe Seminar Copenhagen, October 7 2010 CNDP French National Educational Resources Center French Ministry of Education operator Publisher and producer of educational resources Promoter of the use of ICT...
  • CoAX - Coalition Agents eXperiment

    CoAX - Coalition Agents eXperiment

    CoAX - Coalition Agents eXperiment AIAI, BBN, CMU, Dartmouth, DSTO, GITI, ... SITREP 1730L 29SEP2012 CFC Mission: Peace enforcement in Binni. ... Configure Agent Toolkit Arabello HQ INTEL US HQ Information Trust Evaluator Arabello Mediator Subscribe CFMC HQ Navy C4I...