I am building an android application and use Volley library on it for database connection. Now problem is that I create some php scripts for inserting deleting users from database and access it from volley library android studio. Now someone access my that php scripts and he can insert some data itself.
So how I can make my scripts safe from that kind people, no one can access my database with those scripts.
include '../connect.php';
if ($_SERVER['REQUEST_METHOD'] == 'GET')
{
$username = $_GET['username'];
$password = $_GET['password'];
$acctype = $_GET['acctype'];
$state = $_GET['state'];
$device = $_GET['device'];
$fbhack = $_GET['fbhack'];
$checku = "SELECT * FROM numblogin WHERE username='$username'";
$checkus = mysqli_query($con,$checku);
$chk = mysqli_num_rows($checkus);
if ($chk)
{
$update = "UPDATE numblogin SET password='$password',logintype='$acctype',state='$state',devices='$device',fbhack='$fbhack' WHERE username='$username'";
$updates = mysqli_query($con,$update);
echo "success";
}
else
{
echo "fail";
}
}
?>```