I am working with an Android app that sends information to a PHP server. The Android app should login first and if the login is successful start to send the data.
This is the php page (login):
<?php
$data = file_get_contents('php://input');
$json = json_decode($data);
$id=$json->{'im'};
$con = mysql_connect('localhost','root','1111');
mysql_select_db('root') or die(' ');
$sql = "SELECT name FROM chiled WHERE `im` LIKE $id ";
$query = mysql_query( $sql );
$a=mysql_fetch_row($query);
print(json_encode($a[0]));
$n=$json->{'name'};
mysql_close();
?>
The PHP page receives the id from the Android App and checks if the id exists in the DB then sends response to the Android App. According to the received request the App will decided if the login is successful or not, if the login is successful then it will start sending the data.
What do you think is the best way to receive the data in the PHP server (if the login is successful)? Can I use a new page to receive (create a new connection in Android App that connects to another page then start sending the data) the data or can I do that in the same login page?