old-46 -- SQLi (String Formats)

<?php if ($_GET["lv"]) {
$db = dbconnect();
$_GET["lv"] = addslashes($_GET["lv"]);
$_GET["lv"] = str_replace(" ", "", $_GET["lv"]);
$_GET["lv"] = str_replace("/", "", $_GET["lv"]);
$_GET["lv"] = str_replace("*", "", $_GET["lv"]);
$_GET["lv"] = str_replace("%", "", $_GET["lv"]);
if (preg_match("/select|0x|limit|cash/i", $_GET["lv"])) {
exit();
}
$result = mysqli_fetch_array(
mysqli_query($db, "select id,cash from chall46 where lv=$_GET[lv]")
);
if ($result) {
echo "{$result["id"]} information<br><br>money : {$result["cash"]}";
if ($result["id"] == "admin") {
solve(46);
}
}
} ?> 
Last updated