Hello everyone, and thanks for looking at my question.
I like to note first that this is an education attempt on my own database to better understand mysql injections to protect my own code.
I need to work out a couple of examples of how a mysql injection can be constructed against the following code. It's a basic user login system where I'm accepting the username and password without any escaping
$user = (!empty($_POST['user'])) ? $_POST['user'] : '';
$pass = (!empty($_POST['pass'])) ? $_POST['pass'] : '';
The mysql query then tries to find the entered username and password in my table called users, as follows:
$res = mysql_query("SELECT * from users where user='{$user}' AND pass='{$pass}'");
This is un-escaped input, and I'm trying to come up with mysql injections to 1) bypass the password knowing a legitimate user's username (one user in my users table is tester) and 2) an injection that would drop the users table in its entirety.
I've tried a couple of mysql injection examples from wikipedia, but I'm guessing the {} in my query is preventing the injection, so I would appreciate some help from those who are confident with this, and thank you to all..