Presentation is loading. Please wait.

Presentation is loading. Please wait.

CIS166AE : PHP Web Scripting Rob Loy. Tonight’s Agenda Housekeeping items Housekeeping items PHP basics PHP basics Student connection to server Student.

Similar presentations


Presentation on theme: "CIS166AE : PHP Web Scripting Rob Loy. Tonight’s Agenda Housekeeping items Housekeeping items PHP basics PHP basics Student connection to server Student."— Presentation transcript:

1 CIS166AE : PHP Web Scripting Rob Loy

2 Tonight’s Agenda Housekeeping items Housekeeping items PHP basics PHP basics Student connection to server Student connection to server In-class work In-class work

3 Class Logistics Dates: Sept 5 to Dec 12 Dates: Sept 5 to Dec 12 Time: Wednesday 6:00 - 9:50pm (Lab time included in class time) Time: Wednesday 6:00 - 9:50pm (Lab time included in class time) Room: CM 447 Room: CM 447 Section: 36721 Section: 36721

4 Class Structure Review of homework and lab Review of homework and lab Any quizzes or presentations Any quizzes or presentations Lecture/new materials Lecture/new materials In-class (hands on) work In-class (hands on) work Lab work Lab work

5 Class Contact Web Content: http://www.robloy.com/php Web Content: http://www.robloy.com/phphttp://www.robloy.com/php Email1: rob.loy@scc.maricopa.edu Email1: rob.loy@scc.maricopa.edu Email2: rob.loy@gmail.com Email2: rob.loy@gmail.com Phone: 602-418-4041 Phone: 602-418-4041 Send email to BOTH emails for faster response

6 Eclipse with PHP Eclipse with PHP Filezilla Filezilla Internet Explorer Internet Explorer Phpmyadmin (SQL) Phpmyadmin (SQL) mySCC mySCC SCC Class Folders “CIS-166/” SCC Class Folders “CIS-166/” Class Tools

7 Understand basic HTML Understand basic HTML Do not need to know programming logic Do not need to know programming logic All assignments will be attempted even if not completed to get a “C” All assignments will be attempted even if not completed to get a “C” Some assignments will require work OUTSIDE the class room Some assignments will require work OUTSIDE the class room Student Expectations

8 Expected Knowledge Basic HTML Code Basic HTML Code Right+click menus Right+click menus Shortcuts (Copy/Paste etc.) Shortcuts (Copy/Paste etc.) Folder structures Folder structures

9 Class Standards Lower-case, alphanumeric filenames Lower-case, alphanumeric filenames Homework submitted by 6:00pm next class Homework submitted by 6:00pm next class All links emailed to working page on the site All links emailed to working page on the site New folder created each week New folder created each week Lab time is optional, but lab assignment MUST be completed Lab time is optional, but lab assignment MUST be completed

10 PHP Basics PHP Basics PHP Functions PHP Functions PHP Object Orientated Programming (OOP) PHP Object Orientated Programming (OOP) PHP/mySQL Databases PHP/mySQL Databases PHP Module Creation PHP Module Creation PHP Applications PHP Applications Semester Agenda

11 Open Source Environment L INUX: Operating system for server L INUX: Operating system for server A pache: Web server for server A pache: Web server for server M ySQL: DB application for server M ySQL: DB application for server P HP: programming language P HP: programming language XXAMP: Windows complete Apache, PHP and mySQL environment XXAMP: Windows complete Apache, PHP and mySQL environment

12 PHP Environment Filename extensions has to be.php Filename extensions has to be.php Requests from the user goes to an Apache Web Server Requests from the user goes to an Apache Web Server Server processes all programming and returns HTML to client (browser) Server processes all programming and returns HTML to client (browser) Any storage is usually in a database on the server side Any storage is usually in a database on the server side

13 PHP Basics Environment Environment Variable Variable Constants Constants Arrays Arrays Code branching Code branching Loops Loops

14 PHP Functions PHP Built-in functions PHP Built-in functions User created functions User created functions Parameters Parameters Scope Scope

15 PHP OOP Object Oriented Programming (OOP) Object Oriented Programming (OOP) Class creation Class creation Object creation Object creation OOP Methods OOP Methods

16 PHP/mySQL DB Databases 101 Databases 101 phpmyadmin phpmyadmin SQL SELECT SQL SELECT SQL INSERT SQL INSERT SQL UPDATE SQL UPDATE

17 User Created Modules Web contact page Web contact page Newsletter sign-up Newsletter sign-up Secured pages Secured pages Image gallery Image gallery Facebook application Facebook application Mobile application (web service) Mobile application (web service)

18 PHP Applications WordPress WordPress OSCommerce OSCommerce Drupal Drupal Any other PHP applications? Any other PHP applications?

19 Student Connection Domain: http://.com Domain: http://.com FTP URL:.com FTP URL:.com Username: springscc Username: springscc Password: Password: Directory: Directory: mySQL Admin: mysql..com mySQL Admin: mysql..com

20 acrossthemiddle<01>akbarcommand<02>bowlofmarbles<03>credass<04>designporch<05>druidtemple<06>fadedhistory<07>frinkster<08>fumbledball<09>galaxyclass<10>kneescrape<12>loyalpenguin<13>nimbledesigns<14>poorchimp<15>rancidcheese<16>reekingonion<17>rockinggranny<18>rustednails<19>sharperthoughts<20>shouldabeen<21>slantroute<22>sometimeswhen<23>squishybread<24>swezzer<25>weekoldbread<26>wipedmemory<27>zourn<28> Domains for Class

21 PHP Coding Terms Whitespace does not impact results Whitespace does not impact results { } = braces / curlies { } = braces / curlies () = parenthesis () = parenthesis ; = semicolon ; = semicolon \ = back slash \ = back slash / = forward clash / = forward clash

22 PHP Operators - Math + - Addition + - Addition - - Subtraction - - Subtraction * - Multiplication * - Multiplication / - Division / - Division % - Modulus (division remainder) % - Modulus (division remainder) ++ - Incement + 1 ++ - Incement + 1 --- Decrement – 1 --- Decrement – 1. - String addition (e.g 1.1 = 11). - String addition (e.g 1.1 = 11) http://www.w3schools/php/php_operators.asp

23 PHP Operators - Comparison < - Less than < - Less than > - Greater than > - Greater than <> - Not equal <> - Not equal == - Equals == - Equals !- NOT (e.g. !== means NOT equal) !- NOT (e.g. !== means NOT equal) http://www.w3schools/php/php_operators.asp

24 Basic PHP Code Syntax : contains PHP code for the server to translate : contains PHP code for the server to translate //: php comments //: php comments echo $a;: prints the item or variable to the screen echo $a;: prints the item or variable to the screen print($a);: prints the item or variable to the screen print($a);: prints the item or variable to the screen All statements end with a semicolon All statements end with a semicolon

25 PHP Variables Variables are represented by a dollar sign followed by the name of the variable. Variables are represented by a dollar sign followed by the name of the variable. Not tied to a specific type of variable like Java,.NET. Not tied to a specific type of variable like Java,.NET. A variable name can only contain alpha-numeric characters and underscores A variable name can only contain alpha-numeric characters and underscores Variable name is case-sensitive. Variable name is case-sensitive. Examples: $cost, $obj_name Examples: $cost, $obj_name Syntax: $cost = 4.12, $obj_name = “bike” Syntax: $cost = 4.12, $obj_name = “bike” http://www.w3schools/php/php_variables.asp

26 PHP Arrays Variable capable of holding more than one value in a single reference variable Variable capable of holding more than one value in a single reference variable Content held in a Key / Value config Content held in a Key / Value config Examples: $month[] Examples: $month[] Syntax set-up: $month = array(“Jan”,”Feb”,“Mar”,“Apr”); Syntax set-up: $month = array(“Jan”,”Feb”,“Mar”,“Apr”); Syntax look-up: echo $month[2]; $month = array(“Jan”,”Feb”,“Mar”,“Apr”); Syntax look-up: echo $month[2]; $month = array(“Jan”,”Feb”,“Mar”,“Apr”); http://php.net/manual/en/language.types.array.php

27 PHP Constants A constant cannot change value A constant cannot change value A constant is case-sensitive by default A constant is case-sensitive by default Constant identifiers are uppercase Constant identifiers are uppercase Examples: COST, UNIT_TAX Examples: COST, UNIT_TAX Syntax: DEFINE (COST, 4.12) DEFINE (OBJ_NAME, “My bicycle”); Syntax: DEFINE (COST, 4.12) DEFINE (OBJ_NAME, “My bicycle”); http://php.net/manual/en/language.constants.php

28 PHP & HTML (1) <?php $a = “John”; ?><html><body> Hello Hello </body></html>

29 PHP & HTML (2) <?php $a = “John”; echo “ \n”; echo “ echo “ echo “ Hello “. $john. “ \n”; echo “ \n”; ?>

30 IMPORTANT NOTE Eclipse is part of MySCC Eclipse is part of MySCC Filezilla is part of MySCC Filezilla is part of MySCC You can NOT use MySCC Filezilla in class You can NOT use MySCC Filezilla in class For each class, download Filezilla and install on the desktop! For each class, download Filezilla and install on the desktop!

31 In Class Work

32 FTP (Filezilla) Connect to remote server using credentials Connect to remote server using credentials Click files and then click: Click files and then click: GET file FROM remote server GET file FROM remote server PUT files ON to remote server PUT files ON to remote server Drag files to move files Drag files to move files Can also RIGHT CLICK to see more options Can also RIGHT CLICK to see more options

33 Editing (Notepad) Open Notepad Open Notepad Save file as index.php Save file as index.php You can use any text editor You can use any text editor

34 HTML Form Syntax Form method: How the information goes. Form method: How the information goes. GET = in the URL string GET = in the URL string POST = in HTTP Header (preferred) POST = in HTTP Header (preferred) Form action: Where the information goes. Form action: Where the information goes. Input name: How the information is stored (“variable” name) Input name: How the information is stored (“variable” name)

35 PHP & HTML Forms </form> <?php echo “ Name is “.$_POST[“fred”].“ \n”; ?> form.php form.html

36 Previewing Work Use any browser Use any browser Navigate to the URL and the folder/file name (reminder case-sensitive) Navigate to the URL and the folder/file name (reminder case-sensitive) Might have to click F5 to refresh pages Might have to click F5 to refresh pages Check HTML -> View Source Check HTML -> View Source

37 Next Week Programming basic Programming basic User Functions User Functions PHP Functions PHP Functions Eclipse (IDE) Eclipse (IDE)

38 Homework/Lab 1) Send me an email with your domain name you picked in class 1) Send me an email with your domain name you picked in class 2) Send me an email with the link to the work we did in class in a folder called “homework1”. The homework should be accessible at the following URL: 2) Send me an email with the link to the work we did in class in a folder called “homework1”. The homework should be accessible at the following URL:http://<domainname>.com/homework1/index.php


Download ppt "CIS166AE : PHP Web Scripting Rob Loy. Tonight’s Agenda Housekeeping items Housekeeping items PHP basics PHP basics Student connection to server Student."

Similar presentations


Ads by Google