Chris Pollett> Old Classses >
CS174

( Print View )

Student Corner:
[Final Exam-PDF]

[Submit Sec1]
[Grades Sec1]

[Lecture Notes]
[Discussion Board]

Course Info:
[Texts & Links]
[Description]
[Course Outcomes]
[Outcomes Matrix]
[Course Schedule]
[Grading]
[Requirements/HW/Quizzes]
[Class Protocols]
[Exam Info]
[Regrades]
[University Policies]
[Announcements]

HW Assignments:
[Hw1] [Hw2] [Hw3]
[Hw4] [Hw5] [Quizzes]

Practice Exams:
[Midterm] [Final]

HW#2 --- last modified October 05 2020 22:29:16.

Solution set.

Due date: Oct 9

Files to be submitted:
  Hw2.zip

Purpose: To write a server-side application using PHP.

Related Course Outcomes:

The main course outcomes covered by this assignment are:

CLO1 -- Write HTML documents containing standard HTML elements including forms, tables, client-side scripts, and server-side scripts.

CLO3 -- Write server-side scripts that process HTML forms.

Description: For this homework I want you to make a site for managing your bookmarks using PHP.

Bookmark Manager

My Bookmarks

VisitsBookmarkActions
802Yahoo
651Wikipedia
236Amazon
Landing Page

Bookmark Manager

Edit: Yahoo

Edit Page

Bookmark Manager

Are you sure you want to delete the bookmark: Untitled ?

Confirm Delete Bookmark
Here are the requirements for your project:
  1. Your Hw2.zip folder should have a readme.txt file with all the names and ids for your group.
  2. All pages produced by your app should be valid XHTML 5.
  3. Your app should work regardless of what folder under DOCUMENT_ROOT the grader chooses to grade it. If you have variables/constants that need to be set to ensure this, they should be in a file config.php which is require_once'd by your index.php file.
  4. All urls used by your app (for links, form data, etc) should be of one of the following forms:
    (1) index.php
    (2) index.php?a=some_activity&arg1=some_argument1
    (3) index.php?a=some_activity&arg1=some_argument1&arg2=some_argument2
    Here allowed activities are: landing, edit, goUrl, confirm. An example possible use of the arg1 variable might be to hold a file title.
  5. Your index.php should have four functions: landingView, editView, goUrlView, confirmView. These are supposed to draw the Landing Page, The Edit Page, the Update-Visits-Go-to-Url page, and the Confirm Page respectively, according to the mock-ups shown above. The only HTML that is output by your code, must be output in one of these four methods.
  6. The h1 tag with Bookmark Manager in it on all pages should link back to the landing page.
  7. On the landing page, the input text field should have Title for Bookmark as a placeholder attribute.
  8. On the landing page, if a user enters a title which is empty, only white space characters, or has characters which are non-alpha numeric or space, then clicking create will take on back to the landing page.
  9. On the landing page, if a user enters a non-empty, title which consists of alphanumeric and space characters, they should be taken to the edit page, and the title should appear in the h2 tag next to the words Edit:
  10. Similarly, if a user clicks the edit button next to an existing file name they should be taken to the edit page. In this case, the url from a previous edit session should be loaded.
  11. Clicking the save button on the Edit Page should save the text in the textarea into the url_files subfolder of your web application's folder. The name should be the string url concatenated with the php md5 function applied to title that was given on the landing page followed by .txt. For example, the above Edit page with title Yahoo would save to "url1334b6ec0ff0dc970481738a2374448c.txt".
  12. The Return button on the Edit Page should just go to the landing page without saving the document.
  13. If a user clicks on a link under my files, the browser should first go back to the bookmark site, update the number of visit count for that url which should be stored in a file in the url_files subfolder with the name "cnt" concatenated with the md5 of the title ."txt" (i.e., for our example, "cnt1334b6ec0ff0dc970481738a2374448c.txt"). The php script which updated this count should then output an HTTP Location: header to take the user to the desired URL.
  14. If a Delete button on the Landing Page is clicked, the user should be taken to a Confirm Delete Page. This should have the text as in the mock-up above except that the name of the title should correspond to the Delete button clicked.
  15. Clicking Confirm on a Delete Page should delete the corresponding file and return the user to the Landing Page.
  16. Clicking Cancel on a Delete Page should return the user to the Landing Page without deleting the file.
Point Breakdown
Items (c)-(e), and (m) are each worth up 1pt 4pts
Items (a), (b), (f)-(p) (excluding (m)) are each worth a 1/2pt 6pts
Total10pts