Project 1 Creating A Dynamic Web Page: Header - PHP Footer - PHP
Project 1 Creating A Dynamic Web Page: Header - PHP Footer - PHP
A. Create a home page with the following specifications: 5 Navigations (Home, About, News, Products, Contact) a header (Name of the Company with a registered symbol) a footer (copyright symbol, any detail (eg. "2010 Some Company Inc. All rights reserved.") each navigation must have a page title and a page content (Hint: use variables to store the page title of each page.) use the include statement to include the header (header.php) and footer (footer.php) for every page
B. Create a Log-in page In a file named login.php, - create a username field, a password field, and a login button In a file named auth.php, - create an associative array of with usernames as index and passwords as values - create a function (user_valid) with two arguments: username and password o the function checks the validity of the user
o compare the username and password entered in the log in page to the array of usernames and passwords - create a function (log_in) with an argument o the function creates a session variable named - create a function (current_user) with no argument o the function returns the value of the session variable In a file named authenticate.php, - include the file auth.php, call the user_valid function and determine whether the user is a valid user or not - If it is a valid user, redirect to the home page; otherwise redirect to the login page and display an error message. Modify the header.php, - If the user had successfully logged in to the system, add a and a hyperlink at the upper right corner of the page (Hint: call the function current_user from auth.php to indicate the current user) - If it is an invalid user, add a hyperlink In a file named logout.php, - unset session variables and redirect it to the home page
C. Require log in In the products page, require a log in functionality that will allow the user to view the page. Modify the auth.php o add a new function (require_login) o checks the current user, if it is a current user then allow the user to view the product page; otherwise redirect to login page and display a message You need to log in to view this page o if the user had successfully logged in to the system, display the content of the page; otherwise redirect to home page. D. Registration page Create a database (web2project) Create a database table (member) - add the following fields: an auto increment id Name (first name, last name) Permanent address (address, city) Email address Contact number Password In a file named, register.php - add the following elements: Name Permanent address Email address Contact number
Password Confirm Password - Note: all the fields are required - add a register button - Validate all the fields before updating the member table o Empty values should not be accepted o Check the Email format o If values are validated, display a check mark beside the text box; otherwise display the error/s incurred in the same page.