Skip to first unread message

GORDON MAXWELL

unread,
Nov 8, 2016, 4:33:16 PM11/8/16
to MIT App Inventor Forum
OK here is what is going on I have a screen with a username and password text fields. When submitted
it will post to a php page where it check the table to see if the username and password match a record if not
it will echo a login failed on the php page. If it is ok then it will post back values from the table echos the information in comma delimited where I separate it using a list in the app inventor.

everything works fine but when you type in a incorrect username and password it seems like its not getting the login failed. I know its posting correctly because I post the response in a text field which shows me login failed .
Can anyone tell me why the iff statement is not working? I mean it works but seems like its executing both side of the If statement.

Hopefully you can understand what I am trying to do...
php code.png
Post.png
response.png

Taifun

unread,
Nov 8, 2016, 4:51:29 PM11/8/16
to MIT App Inventor Forum
1. what's that?
2. the closing bracket is missing



don't store passwords in plain text in your database, you should store the hash values in the database instead and compare the hash values in your blocks...

my tools extension https://puravidaapps.com/tools.php provides a block to return a hash value...  



Taifun

Trying to push the limits of App Inventor! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun. 

GORDON MAXWELL

unread,
Nov 8, 2016, 6:25:46 PM11/8/16
to MIT App Inventor Forum
Thank you very much for the reply. I made the corrections and it is still doing the same thing.
If I use a username and password that is in the table ... the code and droid forms work.... it is just if I use a username and password that does not exist. It seems to ignore the if condition. The response is working  cause I posted to a text box and it does give me login failed.

It will not give me a notice saying login failed
php code.png

GORDON MAXWELL

unread,
Nov 8, 2016, 6:28:43 PM11/8/16
to MIT App Inventor Forum
once I get it working property.  I will change the password to a Hash value.


Again thank you for helping me try to solve this issue

GORDON MAXWELL

unread,
Nov 8, 2016, 6:33:14 PM11/8/16
to MIT App Inventor Forum
I just changed if the login fails I send a respose of 1 and when I do use a bad username and password it says login failed but it still executes the else part of the if statement which it should skip ????

Taifun

unread,
Nov 8, 2016, 6:59:25 PM11/8/16
to MIT App Inventor Forum
usually you check for the response code: 200 = ok, 400 = error
Taifun

GORDON MAXWELL

unread,
Nov 9, 2016, 10:49:23 PM11/9/16
to MIT App Inventor Forum
Thank you but it was a beginner mistake all the code was working fine.... i usually send my own code 0 if failed or 1 if success lol 
I was setting my forms to visible when clicked and not when I got the response lol   but thank you for all your help
Reply all
Reply to author
Forward
0 new messages