I'm writing on a little assignment which among other things includes how to prevent SQL injection attacks, and for that purpose I have an example on how NOT to do. The only "small" problem is, I can't get my example to work.
SELECT user FROM usernames WHERE user='".$_POST['user']."' AND pass='".$_POST['pass']."'
I've read it should be possible to inject the above code with ' OR '1=1, so the result would be
WHERE user='' OR '1=1'
but I can't get it to work. It isn't cool having an example you can't (or I can't) inject, so help much appreciated 😉