Task 8 - Creating, Using, Updating and Destroying Cookies in PHP

First practice the provided code samples and fully understand all concepts / code-snippets related to cookies. Please note, below scenerios are given just to make you well understand how cookies work, may be you never have to use such cases in real apps.

Then do following tasks:

1. 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.

2. 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.

3. 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)

4. 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:          _______________

Male a login.php page that shall take user-name and password i.e. admin and test. If user enters, correct user name, redirect user to control-panel.php, if credentials are incorrect, show same login.php page with error message whether the user-name was incorrect or password. After successful login, before redirecting, save some key in cookie to keep record, user has entered correct user-name/password. When user fetches control-panel.php directly, make sure whether the user is login, checking the cookie. If user is not login, redirect to login.php page.