Forum Moderators: coopster
# I really need to ensure that they're numbers AND range from 18-99, but for now...
if ($_GET['fromage'] != intval($_GET['fromage']))
$_GET['fromage'] = 18;
if ($_GET['toage'] != intval($_GET['toage']))
$_GET['toage'] = 99; $p_query = 'SELECT colA, colB FROM tableA WHERE ';
$p_query .= sprintf("age >= %s AND age <= %s ORDER BY updated DESC",
mysql_real_escape_string($_GET['fromage']),
mysql_real_escape_string($_GET['toage'])); SELECT colA, colB FROM tableA WHERE age >= 18 OR JSON_KEYS((SELECT CONVERT((SELECT CONCAT(0x773441,(SELECT (ELT(1196=1196,1))),0x376f4c)) USING utf8)))# j9Tm AND age <= 99 ORDER BY updated DESC Any guesses on what they did to get the OR JSON... # j9Tm part to go through?
$_GET['fromage'] = "18 OR JSON_KEYS((SELECT CONVERT((SELECT CONCAT(0x773441,(SELECT (ELT(1196=1196,1))),0x376f4c)) USING utf8)))";
var_dump(intval($_GET['fromage'])); var_dump(is_numeric($_GET['fromage'])); if(!is_numeric($_GET['fromage']) || $_GET['fromage'] < 18 || $_GET['fromage'] > 99) {
$_GET['fromage'] = 18;
} $p_query .= sprintf("age >= '%s' AND age <= '%s' ORDER BY updated DESC",
mysql_real_escape_string($_GET['fromage']),
mysql_real_escape_string($_GET['toage'])); SELECT colA, colB FROM tableA WHERE age >= '18 OR JSON_KEYS((SELECT CONVERT((SELECT CONCAT(0x773441,(SELECT (ELT(1196=1196,1))),0x376f4c)) USING utf8)))# j9Tm' AND age <= '99' ORDER BY updated DESC It only just clicked that it's "from age", and not fromage (as in omelette).
For the sake of my own education, can you explain why if ($_GET['fromage'] != intval($_GET['fromage'])) doesn't work?
("18 and some text" !== 18) // interpreted as (string) "18 and some text" vs. (int) 18
("18 and some text" != 18) // interpreted as (int) 18 vs (int) 18 I just now uploaded your suggestions, thanks a lot! I'll post back if it happens again.
Fromage === Cheese in French!
I actually DID try using !== earlier, but it failed all tests; I assumed that, because it was a $_GET variable, it was coming in as a string instead of an integer?
$_GET['fromage'] = "18";
var_dump(is_numeric($_GET['fromage'])); // true
var_dump(is_int($_GET['fromage'])); // false
$_GET['fromage'] = "18 AND JSON_KEYS etc";
var_dump(is_numeric($_GET['fromage'])); // false
var_dump(is_int($_GET['fromage'])); // false I had a cassette player that you could set to loop, so I recorded myself saying all of the states, set it to loop, then tucked it under my pillow.