case insensitive file_exists()?
Posted: Mon Mar 31, 2003 5:38 pm
Is there a way to have the file_exists() function do a case insensitive search? I have alot of people who's links (either favorites or search engines) have all lowercased links. My site uses a simple include script like index.php?ServicePage=ClutchNew . If someone for say did a ServicePage=clutchnew I'd like the page to still display. Besides building an array with over a thousand values, one for each page; is there a way to do a case insensitive search? maybe something like:
---- Old Code
To New Code...
---- Old Code
Code: Select all
if (eregi("%", $REQUEST_URI)){
$uri = urldecode(rawurldecode($REQUEST_URI));
header ("Location: http://www.mechanicmatt.com$uri");
}
else {}
$ServicePage = ereg_replace(".php", "", ereg_replace(".mm", "", $ServicePage));
if ($ServicePage == "" || !isset($ServicePage)){
$IncludeFile = "Main";
}
else if (file_exists("$ServicePage.php")){
$IncludeFile = "$ServicePage";
}
else{
//if ($HTTP_REFERER == "" || eregi("unknown", $HTTP_REFERER)){
urlencode(rawurlencode($REQUEST_URI));
header("Location: http://www.mechanicmatt.com/MMIntelligence.php?RURI=$REQUEST_URI;$HTTP_REFERER");
//}
//else {
//$IncludeFile = "e404";
//}
}Code: Select all
else if (strtolower(file_exists(strtolower("$ServicePage.php")))){
$IncludeFile = "$ServicePage";
}