Is valid page
17 Ⅴ 2010
A little function I use to double check the items in a friendly url to see if they only use valid characters.
// Check if the page name is correct
function isValidPage($page){
$safe = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '_', '.');
$pageCheck = preg_split('//', strtolower($page), -1, PREG_SPLIT_NO_EMPTY);
// Make sure that the page name has only safe variables
foreach($pageCheck as $key => $val){
if(!in_array($val, $safe)) return false;
}
return true;
}