When a user initially visits your page, the title and main heading for the page
ID: 3570333 • Letter: W
Question
When a user initially visits your page, the title and main heading for the page should say "Welcome to FIRSTNAME LASTNAME's Assignment 11 PHP page!" (with your name correctly substituted). It should display one form which allows a user to login if he/she has an existing account (with a user name field and a password field), and a second form which allows a user to create a new account (with a user name field, a password field, a first name field, and a last name field). Both forms should submit to the same page (assignment11.php) and should use the "get" method.
If the user attempts to log in and submits a username and a password pair which exist in the "assignment11-account-info.txt" file, a new session should be created which keeps track of the user's settings (which are read from that file). The user's settings should be used to generate the title and heading for the page (which should be the same as each other), the background color of the page, and the URL of an image to be displayed. There should be a "Logout" button, and also another form which displays the 5 settings which can be edited: first name, last name, background color, page title, and image URL. The fields of the form should be filled in by default with the current settings for the user.
If the username and password entered in the initial page are invalid (either the user does not exist or an incorrect password is given), an error message should be displayed and the original page with the two initial forms should be displayed.
When a user is logged in, if he/she opens a new browser window and types in the URL of the page, they should go directly to their "personalized" page (which uses their title, background color, and image) since their session should still be active.
When a user hits the "Logout" button from their personalized page, their session should be destroyed and they should only see the initial page until they login again.
When a user modifies any of the settings on the form of the personalized page and submits that form, the new values should be stored in the entry of the assignment11-account-info.txt file corresponding to their settings (correctly replacing the old settings), and the personalized page should once again be displayed but with all relevant changes (any changes to the page itself as well as the default values in the form for editing settings).
If the user is not logged in and fills out the form to create a new account, if any fields are left blank an error message should be displayed and the initial page should be displayed again. (This should be done by the PHP, and no JavaScript should be used.) If all fields are filled in, but the user name used is one which already exists in the assignment11-account-info.txt file, an error message should be displayed which says that user name is taken, and the initial page should be displayed again. If all fields are filled in and the user name doesn't already exist in assignment11-account-info.txt, a new entry should be made in that file for the new user (and default values for extra settings as shown below should be used), and the user should become logged in and the personalized page displayed.
Default settings:
title = Welcome to FIRSTNAME LASTNAME's Assignment 11 PHP page!
background color = white
Image url = http://upload.wikimedia.org/wikipedia/commons/thumb/9/94/Stick_Figure.svg/170px-Stick_Figure.svg.png
The file assignment11-account-info.txt should be a text file, with each line containing all of the settings for a single account. The settings should be separated by semi-colons and in the following order: user name;password;first name;last name;background color;title;image URL.
Explanation / Answer
contact on timacs12@gmail.com
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.