Mostly asking for critiques of vulnerability. Am I using any functions or methods that are unsafe?
<?php
$menu = array( "page1","page2","page3" );
$defpage = "page1";
$section = $defpage;
if ( isset( $_GET['section'] ) ) $section = $_GET['section'];
if ( !in_array( $section, $menu ) ) $section = $defpage;
?>
This is code that checks if the section is in the array and then sets it as such, but hardwires it back to default if it's not valid.