L
L
lik1732020-05-10 19:31:40
PHP
lik173, 2020-05-10 19:31:40

How to make a user system?

There is just a form:

<form action="blabla.html">
  <div class="container">
    <label for="username"><b>Username</b></label>
    <input type="text" placeholder="Enter Username" name="username" required>

    <label for="psw"><b>Password</b></label>
    <input type="password" placeholder="Enter Password" name="psw" required>
  </div>
</form>

where just after execution throws on the specified page.
But it is necessary for me that the data in one or several files would be stored.
And what would be associated with the input data.
Example:
Form. You enter the wrong name and / or password, it does not go, or goes, but to the page where it says "Data entered incorrectly."
Need a simple example
$username = "Admin";
$psw = 1234567890;
if username=Admin; psw = 1234567890
require('loggedhome.html')
else
echo 'Неверный пароль'

but it is necessary that it be stored in one file and does not require registration and the user session begins.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nadim Zakirov, 2020-05-10
@lik173

The simplest authorization option does not require a database at all. For example, for each e-mail, you can calculate some unique checksum and issue it during registration, like a password. Further, during authorization, simply check that the e-mail matches the entered password (checksum) and, depending on this, either authorize or give an error. Of course, only you should know the algorithm for calculating the sum.
As for storing passwords in a text file, the idea is frankly bad, since under certain circumstances you can simply lose them due to cross-writing or server failure. Better to do without a text base at all.

4
4sadly, 2020-05-10
@4sadly

You can upload json to a file, use mysql or other databases

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question