Login Screen change page ONLY if username and password is corret

Hi! :smiley:

I am making a login screen and I want the user to enter their username and password.
When the user has entered their information and pressed the login button, I want to button to check if both the username AND the password is correct before they are allowed enter the next page.

If one is correct and one is wrong, they are not allowed to go to the next page. Both the username AND the password has to be correct in order for them to move on.

I have made a table which stores the user information, but I don’t know how to apply it to what I want to achieve. :frowning:

Login
Here is a photo of my login screen

  1. Username
  2. Password
  3. Login
  4. Go to next page

There’s probably an easy solution, but I can’t for the life of me figure out what it is! :open_mouth:

Does the table store the data of one user or several?

1 Like

Only one user will be stored in the table. :slight_smile:

How do you plan to save the username and password in a table? Will it be a registration form or manual?

1 Like

(Let’s say that the user is already registered into the system - I am the user who will be using the app, no one else)

  1. The user enters their username and password.
  2. When they Press Return Key or Click the login Button, the system checks the database to see if they have typed in what they registered with.

The best thing for me would be to have a table on my login page which contains a row and column for username and password already filled in with a username and a password, and if I want to change my username and/or password, I can just change it in the table database.

Recap:

  1. The user types in their username.
  2. The user types in their password.
  3. The user Press the Return Key or Click the login Button.
  4. The system checks the table on the login page to see if username == username & if password == password.
  5. If username == username & password == password then let the user go on to the next page.

I hope the explanation isn’t too complicated :sweat_smile:

Here is some pictures illustrating where I’m at.

I have a table with the first row already filled in with the username and password (I have written Username and Password because I don’t want to use my real login information of course :sweat_smile:)

The second row is what the user enters.
Login Screen

After this part is where I’m struggling. I don’t know which IF condition I should use since I want to check IF the Username == username (from the user) & IF the Password == password (from the user).

I am able to enter the page I want to after Pressing the login button, but what I enter in the text fields doesnt have to be correct even though if I enter the wrong information, it shouldn’t let me go to the next page.

This is where I am stuck. :slight_smile:

(Yes, I am new to app development :sweat_smile:)

Login Button

It’s simple, you need to check the number of rows that will match the specified data.
Use a filter to select matching data, then get the number of remaining rows (0 or 1).
An example of filtering can be found on my website.

https://pavlenkovv.ru/2022/10/01/проверить-строку-в-бд/

Все просто, Вам нужно проверить количество строк, которое будет совпадать с указанными данными.
Используйте фильтр, для отбора совпадающих данных, потом получите количество оставшихся строк (0 или 1).
Пример фильтрации можно найти на моем сайте.

1 Like
  1. Filter the table by username and password.
  2. If the result is one record (rows count = 1), then the authorization is successful.
  3. Otherwise (rows count <> 1) authorization is invalid.

image

The condition is set on the corresponding tab:

image

See the example login_database.pma (19.9 KB)

1 Like

I downloaded your project and tested it, @Michael. It seems that as long as you type the correct password it doesn’t matter what username is written, you still get to enter. I got ‘‘Success’’ with the right password, but wrong username. :frowning:

I also tested a private video that @Vladimir_PV sent me, and the solution he came up with works like a charm! If he wants to share the video he sent me in the reply section, that’s okay with me (maybe someone has the same problem as me). :smiley:

I appreciate everyone’s help! :slight_smile: :black_heart:

да, это хорошая мысль
yes, that’s a good idea

2 Likes

Back to Flipabit >
Copyright © 2018. Flipabit Team. All rights reserved.