PHP:
<?
$databasehost = "localhost";
$databasename = "";
$databaseusername ="";
$databasepassword = "";
$con = mysql_connect($databasehost,$databaseusername,$databasepassword) or die(mysql_error());
mysql_select_db($databasename) or die(mysql_error());
mysql_query("SET CHARACTER SET utf8");
$query = file_get_contents("php://input");
$sth = mysql_query($query);
if (mysql_errno()) {
header("HTTP/1.1 500 Internal Server Error");
echo $query.'\n';
echo mysql_error();
}
else
{
$rows = array();
while($r = mysql_fetch_assoc($sth)) {
$rows[] = $r;
}
print json_encode($rows);
}
?>
how can i protect this file for use on my apps?
this code is on many tutorials on the forum, many times i see this code on the forum
but this code is not safe, how to make this safe?
have a way to only my app can use this file on my site? and not all users
site.com/file.php << can i block this for all users and only my app can use this?
pls help me *-* what can i make to total protect this files and made my querys safe?
http://www.b4x.com/android/forum/threads/connect-android-to-mysql-database-tutorial.8339/#content
http://www.b4x.com/android/forum/th...tputils2-part-3-php-mysql-json.42663/#content