FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Ignoring Case on directories
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Ignoring Case on directories [message #171175 is a reply to message #171170] Tue, 28 December 2010 21:33 Go to previous messageGo to previous message
Robert Heller is currently offline  Robert Heller
Messages: 60
Registered: December 2010
Karma:
Member
At Tue, 28 Dec 2010 12:33:10 -0800 (PST) jwcarlton <jwcarlton(at)gmail(dot)com> wrote:

>
> I think that the answer to this is "no", but I thought I'd ask :-)
>
> I'm wanting to open a file where the directory path is given by the
> user. For example:

Most web servers run on some flavor of UNIX and UNIX file/directory
names are case sensitive...

>
> if (is_file("/path/to/" . $_GET['directory'] . "/file.txt"))
> $example = FILE("/path/to/" . $_GET['directory'] . "/file.txt");
>
> else
> // return error
>
> // please ignore any typos; I just typed this up here for the example
>
> The thing is, the directory path could be, say, /path/to/SomeDirectory/
> file.txt, but the user could enter "somedirectory"; in which case,
> they would get the error.
>
> Currently, I keep all of the directory names in a MySQL database, then
> before opening file.txt, I search for the directory in MySQL (which is
> case insensitive), then load the path based on the name in the
> database instead of what's given. But during peak hours, this method
> can result in several hundred MySQL queries per minute.
>
> Before this, I just used opendir to load all of the directories into
> an array on the fly, then did a case insensitive search through the
> array. But, when I started having 90,000 directories (30,000 in 3
> separate parent directories), this was considerably slower than using
> MySQL.
>
> So, the MySQL search works, but the question is, can PHP do a
> directory lookup that's case insensitive; and, preferably, return the
> case-correct directory name?
>

--
Robert Heller -- 978-544-6933 / heller(at)deepsoft(dot)com
Deepwoods Software -- http://www.deepsoft.com/
() ascii ribbon campaign -- against html e-mail
/\ www.asciiribbon.org -- against proprietary attachments
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Value in a grid
Next Topic: Checking equal number of <div> and </div>
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 30 11:57:41 GMT 2024

Total time taken to generate the page: 0.03318 seconds