I am writting a peice of code for a simple login page using php and mysql so trying to pentest it myself, i used curly braces to wrap around my variables $password and $username in my query and it totally blocked my attempts to bypass it.
i know i can use mysqli_real_escape_string and prepared statements and im not asking how to secure my code in here , i want to check it this way and know how does a hacker penetrate this exact code. i tried passing ' or 1=1 -- -
just like when there wasn't a curly brace around variable but but it didnt work also tried }' or 1=1 -- -
but couldnt bypass it .so the question is that curly braces inhance the security? and if not what is the payload to inject
the code below is what im using to connect my database .
<?php
if(isset($_POST['login'])){
$connection=mysqli_connect('localhost','root','','users');
$username=$_POST['username'];
$password=$_POST['password'];
$query="SELECT * FROM users WHERE username='{$username}' AND password='{$password}'";
$select_user_query=mysqli_query($connection,$query);
$select_user_result=mysqli_fetch_result($select_user_query);
if(!$select_user_result){
die("Username not found");
}else{
echo "logged in"
}