Εργαστήριο 7. Implementing and Deploying a PHP Web Application

Σχετικά έγγραφα
Εργαστήριο 9. Styling with Javascript

derivation of the Laplacian from rectangular to spherical coordinates

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 6/5/2006

3.4 SUM AND DIFFERENCE FORMULAS. NOTE: cos(α+β) cos α + cos β cos(α-β) cos α -cos β

Οδηγίες Αγοράς Ηλεκτρονικού Βιβλίου Instructions for Buying an ebook

Εργαστήριο Ανάπτυξης Εφαρμογών Βάσεων Δεδομένων. Εξάμηνο 7 ο

Advanced Subsidiary Unit 1: Understanding and Written Response

How to register an account with the Hellenic Community of Sheffield.

Modbus basic setup notes for IO-Link AL1xxx Master Block

Finite Field Problems: Solutions

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 19/5/2007

ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΥΠΡΟΥ - ΤΜΗΜΑ ΠΛΗΡΟΦΟΡΙΚΗΣ ΕΠΛ 133: ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΕΦΗΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΣ ΕΡΓΑΣΤΗΡΙΟ 3 Javadoc Tutorial

ΚΥΠΡΙΑΚΟΣ ΣΥΝΔΕΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY 21 ος ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ Δεύτερος Γύρος - 30 Μαρτίου 2011

department listing department name αχχουντσ ϕανε βαλικτ δδσϕηασδδη σδηφγ ασκϕηλκ τεχηνιχαλ αλαν ϕουν διξ τεχηνιχαλ ϕοην µαριανι

Homework 3 Solutions

Section 9.2 Polar Equations and Graphs

Στο εστιατόριο «ToDokimasesPrinToBgaleisStonKosmo?» έξω από τους δακτυλίους του Κρόνου, οι παραγγελίες γίνονται ηλεκτρονικά.

SOAP API. Table of Contents

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 24/3/2007

C.S. 430 Assignment 6, Sample Solutions

SPEEDO AQUABEAT. Specially Designed for Aquatic Athletes and Active People

Εγκατάσταση λογισμικού και αναβάθμιση συσκευής Device software installation and software upgrade

VBA ΣΤΟ WORD. 1. Συχνά, όταν ήθελα να δώσω ένα φυλλάδιο εργασίας με ασκήσεις στους μαθητές έκανα το εξής: Version ΗΜΙΤΕΛΗΣ!!!!

(C) 2010 Pearson Education, Inc. All rights reserved.

Physical DB Design. B-Trees Index files can become quite large for large main files Indices on index files are possible.

Section 7.6 Double and Half Angle Formulas

Special edition of the Technical Chamber of Greece on Video Conference Services on the Internet, 2000 NUTWBCAM

The Simply Typed Lambda Calculus

Areas and Lengths in Polar Coordinates

EE512: Error Control Coding

HOMEWORK 4 = G. In order to plot the stress versus the stretch we define a normalized stretch:

2 Composition. Invertible Mappings

Phys460.nb Solution for the t-dependent Schrodinger s equation How did we find the solution? (not required)

b. Use the parametrization from (a) to compute the area of S a as S a ds. Be sure to substitute for ds!

Πρόβλημα 1: Αναζήτηση Ελάχιστης/Μέγιστης Τιμής

PARTIAL NOTES for 6.1 Trigonometric Identities

Assalamu `alaikum wr. wb.

Section 8.3 Trigonometric Equations

Areas and Lengths in Polar Coordinates

Instruction Execution Times

Δημιουργία Λογαριασμού Διαχείρισης Business Telephony Create a Management Account for Business Telephony

ST5224: Advanced Statistical Theory II

PortSip Softphone. Ελληνικά Ι English 1/20

Code Breaker. TEACHER s NOTES

Υλοποίηση Δικτυακών Υποδομών και Υπηρεσιών: OSPF Cost

Example Sheet 3 Solutions

ιαδικτυακές Εφαρµογές

Numerical Analysis FMN011

Main source: "Discrete-time systems and computer control" by Α. ΣΚΟΔΡΑΣ ΨΗΦΙΑΚΟΣ ΕΛΕΓΧΟΣ ΔΙΑΛΕΞΗ 4 ΔΙΑΦΑΝΕΙΑ 1

Statistical Inference I Locally most powerful tests

[1] P Q. Fig. 3.1

Partial Trace and Partial Transpose

Srednicki Chapter 55

Right Rear Door. Let's now finish the door hinge saga with the right rear door

Οδηγίες χρήσης. Registered. Οδηγίες ένταξης σήματος D-U-N-S Registered στην ιστοσελίδα σας και χρήσης του στην ηλεκτρονική σας επικοινωνία

the total number of electrons passing through the lamp.

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 11/3/2006

Approximation of distance between locations on earth given by latitude and longitude

Terabyte Technology Ltd

CHAPTER 25 SOLVING EQUATIONS BY ITERATIVE METHODS

LESSON 14 (ΜΑΘΗΜΑ ΔΕΚΑΤΕΣΣΕΡΑ) REF : 202/057/34-ADV. 18 February 2014

Jesse Maassen and Mark Lundstrom Purdue University November 25, 2013

Block Ciphers Modes. Ramki Thurimella

Other Test Constructions: Likelihood Ratio & Bayes Tests

( )( ) ( ) ( )( ) ( )( ) β = Chapter 5 Exercise Problems EX α So 49 β 199 EX EX EX5.4 EX5.5. (a)

6.1. Dirac Equation. Hamiltonian. Dirac Eq.

Cambridge International Examinations Cambridge International General Certificate of Secondary Education

4.6 Autoregressive Moving Average Model ARMA(1,1)

Exercises 10. Find a fundamental matrix of the given system of equations. Also find the fundamental matrix Φ(t) satisfying Φ(0) = I. 1.

Dynamic types, Lambda calculus machines Section and Practice Problems Apr 21 22, 2016

7 Present PERFECT Simple. 8 Present PERFECT Continuous. 9 Past PERFECT Simple. 10 Past PERFECT Continuous. 11 Future PERFECT Simple

ANSWERSHEET (TOPIC = DIFFERENTIAL CALCULUS) COLLECTION #2. h 0 h h 0 h h 0 ( ) g k = g 0 + g 1 + g g 2009 =?

Παλεπηζηήκην Πεηξαηώο Τκήκα Πιεξνθνξηθήο Πξόγξακκα Μεηαπηπρηαθώλ Σπνπδώλ «Πξνεγκέλα Σπζηήκαηα Πιεξνθνξηθήο»

Concrete Mathematics Exercises from 30 September 2016

ΦΥΛΛΟ ΕΡΓΑΣΙΑΣ Α. Διαβάστε τις ειδήσεις και εν συνεχεία σημειώστε. Οπτική γωνία είδησης 1:.

ω ω ω ω ω ω+2 ω ω+2 + ω ω ω ω+2 + ω ω+1 ω ω+2 2 ω ω ω ω ω ω ω ω+1 ω ω2 ω ω2 + ω ω ω2 + ω ω ω ω2 + ω ω+1 ω ω2 + ω ω+1 + ω ω ω ω2 + ω

14 Lesson 2: The Omega Verb - Present Tense

If we restrict the domain of y = sin x to [ π, π ], the restrict function. y = sin x, π 2 x π 2

Cambridge International Examinations Cambridge International General Certificate of Secondary Education

Ordinal Arithmetic: Addition, Multiplication, Exponentiation and Limit

UNIVERSITY OF CAMBRIDGE INTERNATIONAL EXAMINATIONS International General Certificate of Secondary Education

Πώς μπορεί κανείς να έχει έναν διερμηνέα κατά την επίσκεψή του στον Οικογενειακό του Γιατρό στο Ίσλινγκτον Getting an interpreter when you visit your

Math221: HW# 1 solutions

1) Formulation of the Problem as a Linear Programming Model

If we restrict the domain of y = sin x to [ π 2, π 2

The challenges of non-stable predicates

ΠΑΝΕΠΙΣΤΗΜΙΟ ΠΑΤΡΩΝ ΠΟΛΥΤΕΧΝΙΚΗ ΣΧΟΛΗ ΤΜΗΜΑ ΜΗΧΑΝΙΚΩΝ Η/Υ & ΠΛΗΡΟΦΟΡΙΚΗΣ. του Γεράσιμου Τουλιάτου ΑΜ: 697

Nowhere-zero flows Let be a digraph, Abelian group. A Γ-circulation in is a mapping : such that, where, and : tail in X, head in

Οδηγίες χρήσης υλικού D U N S Registered

Συστήματα Διαχείρισης Βάσεων Δεδομένων

EPL 603 TOPICS IN SOFTWARE ENGINEERING. Lab 5: Component Adaptation Environment (COPE)

Cambridge International Examinations Cambridge International General Certificate of Secondary Education

DESIGN OF MACHINERY SOLUTION MANUAL h in h 4 0.

Econ 2110: Fall 2008 Suggested Solutions to Problem Set 8 questions or comments to Dan Fetter 1

Üzleti élet Rendelés. Rendelés - Megrendelés. Rendelés - Visszaigazolás. Hivatalos, kísérleti

Cambridge International Examinations Cambridge International General Certificate of Secondary Education

Cambridge International Examinations Cambridge International General Certificate of Secondary Education

EU-Profiler: User Profiles in the 2009 European Elections

Practice Exam 2. Conceptual Questions. 1. State a Basic identity and then verify it. (a) Identity: Solution: One identity is csc(θ) = 1

Transcript:

Εργαστήριο 7 Implementing and Deploying a PHP Web Application

Implementing and Deploying a PHP Web Application Brian has written a page named music.php to display his MP3s. He has already written the basic HTML and CSS code. But the HTML is redundant, and he must manually edit it every time he adds songs to his collection. In this lab, you will turn this page into a dynamic PHP page that removes redundancy and dynamically lists the MP3s on the computer.

Exercise 1: Variable for Song Count Brian has 1234 songs (123 hours of music). Turn this into a PHP variable you can change. Download music.php and open it in your text editor. Add a variable for the number of songs, and use it in the HTML/PHP code. Change its value to something other than 1234, such as 5678. Express the number of hours of music in terms of your variable. Assume that 10 songs can be played per hour. Upload it to AWS and point your browser to music.php online to see the change.

Exercise 2: Loop for Links The five Yahoo music links at the top of the page are redundant, so express them using a for loop. You should be able to change your loop bound to get more/fewer page links. Try that. Also, the links should still work when you click on them.

Exercise 3: Query Parameter Add a GET query parameter named newspages for the number of Yahoo links to display. If you like, make it so that if the parameter is not passed, the page defaults to 5 pages. music.php?newspages=2 music.php?newspages=4

Exercise 4: Array of Favorite Artists The page lists Brian's favorite artists as a bulleted list. Create an array containing the favorite artists' names and use the array to generate the bullets in the list. Test that it's working by adding at least one more favorite artist (e.g. Lady Gaga).

Exercise 5: File of Favorite Artists Instead of writing your own array of favorite artists, read them from a file, favorite.txt. Download this file to your machine and upload it to Webster with your PHP page. Read the artists from it, one per line. For added challenge, make each artist's name a link. similar to the artist's name but in lowercase with dashes. The links have names Example: Justin Bieber links to http://music.yahoo.com/videos/justin-bieber/

Exercise 6: List MP3 Files The page hard-codes the list of MP3 file names. Change it to read file names from the server. We have placed several MP3 files on Webster for you in folder /var/www/html/songs/, or you can download them as icon songs.zip. Comment out the existing list of MP3/playlist file names on the page.write PHP code that looks for the names of all.mp3 files in the /var/www/html/songs/ folder using the glob function. (Pass a folder/file path to glob, NOT a URL. For debugging, you may want to print_r the array.) Print each file name as an li list item with the class of mp3item.

Exercise 7: MP3 Formatting Now let's format the MP3 links to look better.make each item display just the song file name, without the.../songs/ folder. Use the basename function to extract the file name from a larger path string. e.g. basename("a/b/c.txt") returns "c.txt". Make each item be a link to download that song. (Add an a tag whose href target is the same as the song file's full URL.) For added challenge, display the size of each song file in kilobytes. You can get the size of a file in bytes using the filesize(filename) function. 1 kb is 1024 bytes.

Exercise 8: Playlists [1/2] Add code to display the contents of.m3u playlists. A playlist is just a text file containing a list of song file names, one per line. It can also have comment lines that begin with #. (You can ignore/skip comment lines.) Example: #EXTM3U #EXTINF:177,Paul Dateh & Oren Yoel - Be Morebe-more.mp3 #EXTINF:291,Christopher Toy - Just Because just-because.mp3 Write code that searches for all playlist.m3u files in the /var/www/html/songs/ directory, and for each one, displays a list of the playlist's songs as a nested list. (Use a separate foreach loop and glob call after the one for the MP3 files.) Use the strpos function to search a line for the index of a given substring.

Exercise 8: Playlists [2/2]

Exercise 9: Ordering/Sorting audio tag: HTML5 includes a new audio tag for playing sounds. Modify the page to insert an audio tag for each song so that it can be played in the page. Shuffle: Display the songs in a random order each time the page loads. Reverse order: Display the songs in reverse ABC order. You may want to look at PHP's array functions related to sorting. Sort by Size (hard!): Display the songs sorted from largest to smallest size rather than in their default sorted order. The largest songs (such as drift-away.mp3) would go first and smallest songs (such as cse-190m-rap.mp3) last.