|
is valid pageA 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;
}
|
Japanese proverb
Kiji mo nakazuba utaremai If the pheasant dosen´t make a noise, it won´t be shot |