What is the best and method of ensuring that $page
and $getVars
are clean and safe?
//fetch the passed request
$request = $_SERVER['QUERY_STRING'];
//parse the page request and other GET variables
$parsed = explode('&', $request);
//the page is the first element
$page = array_shift($parsed);
//the rest of the array are GET statements, parse them out;
$getVars = array();
foreach($parsed as $argument)
{
//split GET vars along '=' symbol to seperate the variable and its value
list($variable, $value) = explode('=', $argument);
$getVars[$variable] = $value;
}