I want to write a login form, and I got one example from the web. I want to know, if there is any SQL injection for this code? If there is, what could the exploit's web form entry look like?
This is my form:
<form method="post" action="">
<dt class="title"><label for="username">name:</label></dt>
<dt><input type="text" name="username" id="username" size="50"></dt>
<dt class="title"><label for="password">pass:</label></dt>
<dt><input type="password" name="password" id="password" size="50"></dt>
<input type="hidden" name="post" value="1" />
<input type="submit" name="submit" value="submit" class="button">
</form>
and this is my check:
if (($post[username]) AND ($post[password]))
{
$query = 'SELECT * FROM `config` WHERE `config_admin_username`="'.$post[username].'" AND `config_admin_password`=MD5("'.$post[password].'") LIMIT 1';
$sql_user_check = $db->fetch($query);
if (!$sql_user_check) {
$error .= "Wrong Entry.<br />";
} else {
$_SESSION[admin] = 1;
header("Location:index.php");
exit;
}
}
I'm using phpmyadmin 3.2.0.1 on wamp 2.0i