According to netbeans IDE, I need to add some sort of a filter to superglobals, filter_input() suggested by netbeans, for the code below
$page = (isset($_GET['p']) && !empty($_GET['p'])) ? $_GET['p']: 'home';
After researching, I found this example on stackoverflow
$name = ($name = filter_input(INPUT_GET, 'name')) ? $name : 'default_value';
But I fail to understand how to apply this to the code above.
Original Code, just in case you need to see.
$page = (isset($_GET['p']) && !empty($_GET['p'])) ? $_GET['p']: 'home';
$page = htmlspecialchars($page, ENT_QUOTES, 'UTF-8');
$page = preg_replace('/[^-a-zA-Z0-9_]/', '', $page);