Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7940807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:28:57+00:00 2026-06-03T23:28:57+00:00

I am after some advice on a PHP situation. Currently I have an HTML

  • 0

I am after some advice on a PHP situation.

Currently I have an HTML page that has two username and password fields. When a ‘submit’ button is pressed, a PHP file is loaded via the Action and if the username and password are correct, a game starts up. The game is in the same PHP file as the checking for the user. The user can answer many questions and gets scored based on their results. After the user has finished, they can press a logout button that saves their current score and level.

I have been asked to use a model/view/controller setup. Can I please have some advice on the process that I should undergo to modify my one PHP game file into this sort of setup?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T23:28:58+00:00Added an answer on June 3, 2026 at 11:28 pm

    I’m excluding the functioning of the game itself, and using your authentication as an example.

    Controller

    The controller in your case is some page that receives the form submission. It will validate any inputs, and decide what service to call to get a response. It will then pass that response (which should include only data that is going to be displayed on the page, and nothing regarding formatting or other information) to a view.

    Model

    The model in this case is the service that provides the authentication. This should be a set of functions, such as:

    //returns 1 if successful, 0 otherwise
    function authenticate(&$username, &$password) { ... }
    

    Usually these are encapsulated in a class that can be called from anywhere. This is your ‘model’ because it interacts with the data of the problem’s domain.

    View

    In this case, once the controller passes the response from the authentication service to the view, the view will unpack it and mark it up with html and css. In this case it will probably mean showing the user’s login name and grabbing the information for the game. Or, if the login failed, the view should show be all about the failure; the error message, etc. Note these are two different views: success and failure of authentication.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently after my form has passed validation it forwards to an html page. I
After some reading and R&D, I have came to conclusion that ? Forms in
After some advice. I have a client wishing to have an app which lets
After some advice on how to clear markers on googlemaps, I have a map
Need some advice, I'm after a decent process/task manager for Ubuntu. Basically I have
after some advice regarding a problem i am getting using a linux based piece
Summary I am after some advice on the easiest way to analyze simple data
I'm after some design advice. I'm working on an application with a fellow developer.
I'm a newbie to Unit Testing and I'm after some best practice advice. I'm
After some use Visual Studio 2008 when opening a solution that is checked into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.