I decided to look into security more since i am coding everyday and been rooting through websites, tons of information and said the best way is just ask and see what comes back! For my own information and to learn more and more of injections etc. I would like someone to simply let me know if my code samples are injectable? If they are, could you provide how they are and how to solve/fix it?
NOTE: The samples are in my main code structure but put in different ways.
//Sample 1:
$file = '/var/lib/mpd/playlists/'.$_POST['playlistlink'].'.m3u';
shell_exec('/sbin/sudo /sbin/chmod 664 "'.$file.'"'); //Perhaps? file.mp3"; ls; echo "success
//Sample 2:
$file = '/mnt/MPD/SpotifyPlaylists/'.$_GET['track'].''; //Possible to manipulate to remove more files?
if (file_exists($file) && unlink($file))
{
echo "Success!";
}