Question

In: Computer Science

PHP Question - Subject: PHP File Handling and Uploads INSTRUCTIONS: Objective: • Create a sticky HTML...

PHP Question -

Subject: PHP File Handling and Uploads

INSTRUCTIONS:

Objective:

• Create a sticky HTML form.
• Submit form for processing.
• Sanitize and validate form data.
• Upload a profile image.
• Add a record to a text file.
• Display form results with content from another text file and the uploaded image.

Description:

This assignment deals with file management. It requires the use of 3 new files and 1 new directory. You will create the new file-uploads.php file, a new membership.txt file to record form data, a poem.txt file to store a "poem" of your choice and a new images directory. All information in this assignment is processed and displayed using the file-uploads.php page. There are no redirects.

You will need to build a form to upload user images and access a couple of files on the server. The form will be processed and validated. The sanitized and validated form information will be saved to a text file (membership.txt) you create on the server. Once the form has been processed and the image uploaded to the new images directory, you will not redirect the user to a new page to display the results as specified. Instead, you will code the existing page to process the form, including the image upload, then display the formatted information (instead of the form) along with some information from a text file (poem.txt) you create.

Requirements:

Create a PHP page named file-uploads.php with a form using the following field controls:

• Single line text box for the user's first name.
• Single line text box for the user's last name.
• Single line text field for email.
• Single line text field for password.
• Single line text field for password verify.
• Add a file control to the form to upload a profile image file.

Process the form text information.

• Upon form submission, sanitize and validate the text information.
• If the information is valid, create a new lowercase username with the first initial of the first name concatenated with the last name. (IE: sherd)
• Set the first letter of the first and last names to uppercase then concatenate the first name and last name into one field with a separation space between the names.
• Append the membership.txt file with the user's name, email, password and new username.

Process the image upload.

• Add validation to make sure the image file is an appropriate image type and size is 100KB or less.
• If the image passes validation, check to see if it already exists. If so, display an error and return the form to the user..
• If the image file doesn't exist, upload the image to the server.

Style and prep the HTML in both pages.

• Include the functions file.
• Wrap the page output in your header and footer.
• Utilize the Bootstrap framework to style your page contents.

Add form processing to the file to sanitize and validate the form submission. Include sticky form fields and error messages.

• Text fields must be present and convert any HTML tags present using htmlspecialchars().
• Text fields and passwords must be trimmed using trim().
• Email must validate using preg_match().
• Convert all names in name field to first letter uppercase.
• All form fields must be checked for content. Any missing content should trigger the form to be redisplayed to the user with a warning to provide acceptable information.

Solutions

Expert Solution


Related Solutions

PHP Question - Subject: PHP File Handling and Uploads INSTRUCTIONS: Objective: • Create a sticky HTML...
PHP Question - Subject: PHP File Handling and Uploads INSTRUCTIONS: Objective: • Create a sticky HTML form. • Submit form for processing. • Sanitize and validate form data. • Upload a profile image. • Add a record to a text file. • Display form results with content from another text file and the uploaded image. Description: This assignment deals with file management. It requires the use of 3 new files and 1 new directory. You will create the new file-uploads.php...
PHP Question: Subject: Functions and Arrays. INSTRUCTIONS: Objective: • Write functions. • Use server-side includes. •...
PHP Question: Subject: Functions and Arrays. INSTRUCTIONS: Objective: • Write functions. • Use server-side includes. • Create and utilize a numeric array. • Create and utilize an associative array. Requirements: Create a script file called functions.php, where you will be adding functions. priceCalc() function: • 2 parameters: price and quantity. • Create a numeric array of discounts with the following values: 0,0,.05,.1,.2,.25. • Get the discount percent from the array using the quantity as the index. If the quantity is...
PHP Question: Subject: Managing Persistence. Objective: • Create a login script. • Strengthen passwords. • Authenticate...
PHP Question: Subject: Managing Persistence. Objective: • Create a login script. • Strengthen passwords. • Authenticate users. • Create sessions. • Create cookies. • Manage persistence. Description: All dynamic sites need a way to manage access to resources. Many dynamic sites use back-end databases that can contain sensitive information that needs to be securely managed. At the same time, sites want to be inviting to guests. Managing the access to sensitive information is a critical function. Requirements: Update site for...
PHP    1. Create a new PHP document (nit Objective 1)    2. Write a comment...
PHP    1. Create a new PHP document (nit Objective 1)    2. Write a comment similar to the following: "This is my first PHP document, which displays some data in the web browser"(Unit Objective 1)    3. Assign your name as a string value into the variable labeled myName (Unit Objective 2)    4. Assign 53870 numeric value into the variable named randomNumber (Unit Objective 2) 5. ssign the name of the web browser and operating system of the...
- Create an html form (bank form) and the PHP code with 2 accounts with options...
- Create an html form (bank form) and the PHP code with 2 accounts with options to transfer, deposit or withdraw money.
I already have a database in phpMyAdmin and need to create an html/php "SEARCH" page to...
I already have a database in phpMyAdmin and need to create an html/php "SEARCH" page to retrieve the information from the database on to my localhost. Please post a php/html code that will create a search page and return the data from my phpmyadmin database. The 3 items I have on the database are first_name, last_name and birth_day.
Create a web page using PHP and HTML that contains a list of movie names available...
Create a web page using PHP and HTML that contains a list of movie names available for rent (at least 10 movies), so that each time you visit the home page, you see a different order of movies in the list. The movie names are required. 2) The rental price for each movie ranges between $1.99 to $7.99. • Create an associative array with a code for the movie as the key (e.g., movie1, movie2, etc.) and the associated rental...
Create a new PHP document (Unit Objective 1) Write a comment similar to the following: "This...
Create a new PHP document (Unit Objective 1) Write a comment similar to the following: "This is my first PHP document, which displays some data in the web browser"(Unit Objective 1) Assign your name as a string value into the variable labeled myName (Unit Objective 2) Assign 53870 numeric value into the variable named randomNumber (Unit Objective 2) Assign the name of the web browser and operating system of the user accessing the file into the variable named userAgent (Unit...
Create a new PHP document (Unit Objective 1) Write a comment similar to the following: "This...
Create a new PHP document (Unit Objective 1) Write a comment similar to the following: "This is my first PHP document, which displays some data in the web browser"(Unit Objective 1) Assign your name as a string value into the variable labeled myName (Unit Objective 2) Assign 53870 numeric value into the variable named randomNumber (Unit Objective 2) Assign the name of the web browser and operating system of the user accessing the file into the variable named userAgent (Unit...
Exercise 1 (a) Create a HTML file that uses createElement and appendChild to dynamically insert three...
Exercise 1 (a) Create a HTML file that uses createElement and appendChild to dynamically insert three paragraphs when a button is clicked. (b) Create a HTML file that includes JavaScript that is similar to: let recs = [“my item …1”,”my item…2”, …] i.e. an array that contains several CSV item records. When the user clicks a button, each array element will be rendered as a list element. Use a HTML list. Use createElement and appendChild. (c) Redo your createTable code...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT