SQL injection issue

While you do have a "loggedUser" check, it's possible for you (when logged in) to visit another website (i.e. "evil.example.com"), which includes an `<img src="XXX" />` where the source is:

http://diet.example.com/remove_diet.php?id=1%27%20OR%20true%20--

Or after url decoding:

http://diet.example.com/remove_diet.php?id=1' OR true --

Which will run the SQL:

DELETE FROM `diet` WHERE `id` = '1' OR true; -- the rest is a comment

Which will simply delete everything from the `diet` table :-)

So worth looking into SQL injection, and Cross Site Request Forgery (CSRF).

And yes, security stuff can be fun :-)