• Home »
  • Android »
  • MIT App Inventor registration and login system in android app using PHP and MySql

MIT App Inventor registration and login system in android app using PHP and MySql

Here you can see how can we made MIT App Inventor registration and login system in android app using PHP and MySql. In my early post I discussed on the registration system at “Store data to mysql server from MIT App Inventor using php”. Please read this post first. Here I discussed on the login system after saving the user name and password in MySql database.

To implement MIT App Inventor registration and login system in android app using PHP and MySql we have to do some steps.

For making registration system

  1. We have to build mysql database for specific field in registration form.
  2. We have to write php code to collect the data form app and store it to mysql database.
  3. We have to design a registration form on MIT App Inventor.
  4. We have to give proper logical block connection for registration form on MIT App Inventor.
  5. Hosted domain.

To see those steps on my early post at “Store data to mysql server from MIT App Inventor using php”.

For making Login system

  • We have to write php code to collect the user id and password form app and check it to mysql database whether it matches or not.
  • We have to design a Login form on MIT App Inventor.
  • We have to give proper Logical block connection for registration form on MIT App Inventor for log in system.

Login and Registration form on MIT App Inventor

In main login page I used two label, two text box to collect user id and password, two buttons, one for login and another for registration. If anyone not have user id then he has to click on register button to register first. When register button click it will open new page for registration.

To design a registration form on MIT APP Inventor I used eight label to write our eight filed name. Seven text field box to take text input. One password text box to take password. And one button to make register button. For working with programming logic we have to take Non-Visible component Web1 and Notifier1.

MIT App Inventor registration and login system in android app using PHP and MySql

Logical block connection for Login form

In login form very simple logic is used. User enter whatever user id and password, making the proper url of it and call the php to do rest of work. And when user click register button it will open new screen for registration along with registration fileds which was shown at my early post “Store data to mysql server from MIT App Inventor using php”.

Now here I show Logical block connection for Login form

MIT App Inventor registration and login system in android app using PHP and MySql

Now after sending that php start working and it send the response whether login successful or error. By getting those server response we have to give notification to user in our apps. So for that again we have to make some logic connection which is shown bellow.

MIT App Inventor registration and login system in android app using PHP and MySql

php code for login system

Here I give you complete php code which I used in my project is given bellow.

<?php

define (‘dbuser’,’your db user’);
define (‘dbpw’,’your db password’);
define (‘dbhost’,’your db host’);
define (‘dbname’,’your db name’);
$dbc = mysqli_connect(“your db host”, “your db user”, “your db password”, “your db name”); if(!$dbc) {

    die(“DATABASE CONNECTION FAILED:” .mysqli_error($dbc));

exit();

}

$dbs = mysqli_select_db($dbc, dbname);

if(!$dbs) {

    die(“DATABASE SELECTION FAILED:” .mysqli_error($dbc));

exit();

}

$user_id = mysqli_real_escape_string($dbc, $_GET[‘user_id’]);

$psw = mysqli_real_escape_string($dbc, $_GET[‘psw’]);

$sql = $dbc->query(“SELECT * FROM nbcafe WHERE user_id=’$user_id’ AND psw=’$psw'”);

 if (mysqli_num_rows($sql) > 0)

 {

    echo “log in ok”;

 }

 else {

     echo “Log in Error”;

 }

 mysqli_close($dbc);

?>

I think this post MIT App Inventor registration and login system in android app using PHP and MySql will help you to build your own project. Here I give you Video of my complete project work, must see that.