String Contains Function

String Contains Function

am 11.01.2008 23:33:19 von MD Websunlimited

Is there a function in PHP that will return a boolean if a String
contains another given String. As what I am trying to do is disallow
input that contains ../ or something else that would allow directory
traversal.

j1mb0jay

Re: String Contains Function

am 12.01.2008 00:14:57 von luiheidsgoeroe

On Fri, 11 Jan 2008 23:33:19 +0100, j1mb0jay wrote:

> Is there a function in PHP that will return a boolean if a String
> contains another given String. As what I am trying to do is disallow
> input that contains ../ or something else that would allow directory
> traversal.

strpos()/regex etc. could be used for this, however, I'd use realpath() on
the results to check wether it's still 'safe'.
--
Rik Wasmus

Re: String Contains Function

am 12.01.2008 00:21:22 von MD Websunlimited

Rik Wasmus wrote:
> On Fri, 11 Jan 2008 23:33:19 +0100, j1mb0jay wrote:
>
>> Is there a function in PHP that will return a boolean if a String
>> contains another given String. As what I am trying to do is disallow
>> input that contains ../ or something else that would allow directory
>> traversal.
>
> strpos()/regex etc. could be used for this, however, I'd use realpath()
> on the results to check wether it's still 'safe'.

Did not think of the realpath() function.

Thank you.

j1mb0jay