Having spent a while working on security you suddenly discover that your intval() checking means that going to the page with an ID of two will put you on the page with an ID of one!
$page = $_GET['p'];
if (intval($pageID) == 0){
$page = 0;
} else if (intval($pageID) == 1) {
$page = 0;
}
$pageID = $page + 1;
As you can see we GET the variable 'p' then check its an int before adding one on to it (as the 'p' variable starts at 0 and MySQL's page IDs start at 1).Apparently if $pageID is not a number it will return 0 or 1- However sadly intval returns $pageID on success so if $pageID is page two then it sees it as invalid and tells php to show the homepage instead.
So any ideas for a workaround?
Gosh writing makes me thirsty...


Sign In
Create Account


Back to top









