I'm trying to learn SQL injection to become a white-hat but I find it quite difficult ...
I found this code on a site and it's told to be a easy-difficulty.
The HTML code has a username ,password boxes and a button.
if(isset($_POST['autentificare']) && $_POST['autentificare']=='OK' && $_POST['admin']!="" && $_POST['adm_password']!="")
{
    $admin=$_POST['admin'];
    $adm_password=$_POST['adm_password'];
    $login="SELECT admin,password FROM owner where admin='".$admin."' AND password='".$adm_password."' ";
    $result_auth=mysql_query($login,$db) or die("Query failed: ".mysql_error()." Actual query: ".$login);
    $user_identity;
    while($dates = mysql_fetch_object($result_auth))
    {
        $user_identity=$dates->admin;
        $password_ident=$dates->password;
    }
    if($result_auth && $user_identity==$admin && $password_ident==$adm_password)
    {
        $_SESSION['adm_username']=$admin;
        $_SESSION['adm_password']=$adm_password;
        $authval="V";
    }
    else
    {
        $authval="D";
    }
}
 
     
     
    