Task 8 - Cookies Programming Tasks for Practice using PHP
Before doing below listed tasks, understand what are cookies and how they work. Then understand my given code samples. Note that, below tasks are just to understand the cookies, it may not appear in real applications.
Here are the tasks:
1. Make interval.php that saves a cookie in user internet browser with current time. When user access the page again, show the duration in seconds after which the page is opened.
2. Make a form with two input text fields. First for cookie name and other for cookie value, when user submit the form. Create new cookie with passed name and value.
3. Make a form with one input text field and Delete Cookie button, when user submit the form, delete only the cookies whose name is submitted by form. Must handle form using Postback mechanism.
4. Make show-all-cookies.php page, it should display all cookies the application has stored in user browser. (assume, you don't know the keys).
5. Create control-panel.php to manage, view and create cookies. User shall use it to view and update cookies' names and values. This form must be dynamic, that means, if there are 10 cookies received from browser, you must make 10 input text fields for cookie names and 10 for cookies values and so on ... If user set the value field empty, that cookie shall be deleted from browser.
At end of form, add two text input fields to be used to add a new cookie by entering its key and value, e.g.
- Enter New Cookie Key : _______________
- Enter Cookie Value: _______________
Comments
Post a Comment