In this part requires to replace it:
$sql = "SELECT * FROM wallets WHERE id = '$user' LIMIT 1";
Requires to do this: use the mysql_real_escape_string() function for the $user parameter
How to implement it?
$sql = "SELECT * FROM wallets WHERE id = '$user' LIMIT 1";
Eliminate vulnerability!