Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I will be canceling Chegg service since no one knows PHP and how to appropriately assist me. This is the fourth time I've posted this

I will be canceling Chegg service since no one knows PHP and how to appropriately assist me. This is the fourth time I've posted this and I've gotten a response that has nothing to do with my questions or partially answered. This service is a waste of my money.

Can I get assistance using php to answer each line? I need help by a PHP expert.

***I already know this part*** 1*edit form.php - between the section tags - create a form with 2 fields: username, password

2*add a submit button. The action of the form will be userlogin.php (this doesn't exist yet) and the method is post.

3*create local.php in subdirectory 4*create a function called logon in local.php that echos 'Welcome, (your name)' in an h3 tag 5*edit form.php to call logon() above the form; refresh the page - make sure that logon shows up

*6. Create userlogin.php - use the same include files in form.php; create it in the subdirectory

make sure there is a section element, just like form.php, you may also just copy form.php to userlogin.php and remove the form in the middle

*7. Call userlogin.php in the form in form.php (action)

*8. In userlogin.php - at the very top, retrieve the username and password from form.php and save them into variables

*9. In the section element in userlogin.php create an if and else statement:

If the password == thisisyourpassword

echo "correct!"

else echo "wrong!

*Test both a good password and a password that won't work.

*10. Create a function in local.php called loginSite with two parameters, username and password

*11. MOVE and do not copy the if/else logic from userlogin.php to inside of the function;

make sure local.php is required by userlogin.php

*12. In userlogin.php call the function loginSite and pass the two parameters collected in your variables (username and password) into the function

*13. Test both a good password and a bad password

*14. update the function loginSite so that if the passwords match the last line in the if statement returns true

*15. update the function loginSite so that if the passwords do not match the last line of the else statements returns false

*16. in userlogin.php create a variable that will capture what is being returned by loginSite

*17. if that variable is false, copy and paste the following line of code - this will return the user back to the form.phd

*18. If the variable is true, do nothing (they will just stay on the login page)

*19. run tests with a good password and a bad password

*20. Create a new function named happiness and echo an image (any image) as the logic of the function

*21. Create a new function named sadness and echo another image as the logic of that function.

*22. Call happiness function from the if statement inside of loginSite before the return statement (or it will not execute)

*23. Call sadness function from the else statement inside of loginSite before the return

*24. in userlogin.php comment out (do not delete) the if statement that redirects back to form.php, this is so that your code will remain in userlogin.php and display the correct image so you can test. if the passwords do not match; we are going to use the return variable later on

*25. run tests with a good password and a bad password

*26. Add a new input field to form.php, ask the user to enter a number 1 - 10 after their username and password, make sure to capture the new input from the post superglobal

*27. Update loginSite to now accept three parameters in the definition of the function and

*28. update where the function is being called to also have 3 parameters

*29. In loginSite pass the number to your happiness function by adding a parameter to the happiness function definition and another parameter where you are calling the function

*30. In the happiness function, add a for loop or a while loop that echos out the number of images that the user requested upon success. Limit that number to 10 if they enter more than 10 on the form), also check to make sure they do not enter other characters than numbers

*31You do not need to update sadness

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What attracts you about this role?

Answered: 1 week ago

Question

How many states in India?

Answered: 1 week ago

Question

HOW IS MARKETING CHANGING WITH ARTIFITIAL INTELIGENCE

Answered: 1 week ago

Question

Different types of Grading?

Answered: 1 week ago