On Sunday 18 August 2002 05:53, eriol wrote:

> It works fine on .php files but I was hoping I could include .inc files as
> well when someone wanted to view the source of them.. To include .inc files
> as viewable php source code, I'd rewrite it similar to below I assume, but
> I'm not understanding the syntax I'm missing..
>
>
>     if (ereg("(\.inc | .php)$",$o0o) && !ereg("\/\.\.", $o0o)){
>       ...
>     }
>
>
> I know I have to use a pipe to seperate allowable file types, but that's
> the extent of what I know.. Any help would be appreciated.. TIA..

A period (.) has a special meaning in that it matches any character. To match 
a literal period you have to escape it with a backslash:

  if (ereg("(\.inc | \.php)$",$o0o) && !ereg("\/\.\.", $o0o)) {

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
vacation, n.:
        A two-week binge of rest and relaxation so intense that
        it takes another 50 weeks of your restrained workaday
        life-style to recuperate.
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to