There is a login.php page and 10 more pages (1.php, 2.php ... 10.php), which should be accessed through a password with a redirect to this page.

In addition, each page has a different password. Passwords are stored in a table in the database.

How to do this?

  • If you are given an exhaustive answer, mark it as correct (a daw opposite the selected answer). - Nicolas Chabanovsky

1 answer 1

I would do this:

  1. it is necessary for each page to store different sessions, for example:

    p. http: // sitename / users - $ _SESSION ['users_login'];

    p. http: // sitename / news - $ _SESSION ['news_login'];

  2. when the user comes to the page, it is necessary to check if he has already logged in;

  3. if not logged in - redirect the login with some get parameter to the page (for example, the name of the page is users)
  4. when the user enters login / password, it is checked depending on the page (get parameter)
  5. if the data is correct, write the necessary records to the session and redirect to the previous page (get parameter), if the data is not correct, output an error