Login system failed (using mysql database)

hi, i have a problem here. may i can get the answer and helps.

i want to build a login system. the data are from mysql database.
this is my php code.

my block allow to login with any text inserted even the data are not correct (not from mysql). then, my block allow to go to next page even the login are incorrect.

can i get helps why do this happen?
image

1 Like

Your are using get method to take users input… User input will be past in URL

Friend , Your open screen block is inside the else. The else works when you have no return = 200. Return = 200 is when everything is ok. So the Open Screen block must be in the part where “everything went right In the PHP”(not exactly that, but) script, you are not dealing with whether the return of Select is ok or not.
Debug your script. Place a print_r (variable) and a die () underneath and check what is going on.
POST != Get
There are many errors.

1 Like

But can you can see in the php script that he is using GET method but in app block he use POST method in app block

please refer here, Already an Guide is there

I saw. But as an apprentice he must try to debug and understand the code and errors …

In the .POST Text block, change the names:

uname= to username=
and
&pwd= to &password=

It’s is just because you are receiving those parameters this way in your PHP script.

2 Likes

login success but not open the next page. why?

why you are using response content = Login success

just use this -
if response code = 200 then next screen
else “show alert = Invalid Username or Password”

try this, it will work.

Screenshot_1

it works. but why is it the block allow to open another screen even the it was invalid username and password? can you help me with this matter.

use it like this
if response code = 200
then = next screen
else = Show Alert (Invalid username or password)

i did that but still the blocks allow to open another screen even it was inavlid username/password

if you mean you did it like this
then it is wrong

do it like what I mentioned above

image

yes i did already as you mentioned. but, it still allow to another screen even the login data is inserted wrong.

check what you get in response content when you fill write username and password. Suppose for example you got in response content ‘success’

then use it like this

if response code = 200
then = if response content contains text = success
then = next screen
else = show alert (invalid username or password)
else = show alert (invalid username or password)

image

it’s still same. still allow to another page even wrong fill in data

The reason is as per your block, you are not checking/verifying user details with SQL details… just your are asking users to enter username and password. So whatever they input it will store in the SQL server alsolso next screen opening

how can i solve this problem?

Please follow the block as said here

. You need to change the URL as, instead of using post text, just combine URL+username+pwd