Re: check if a file is included

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Could you not check one of the variables in the $_SERVER array to
determine if the script called by the browser is the current file?


Ash
www.ashleysheridan.co.uk
--- Begin Message ---
On Fri, Sep 12, 2008 at 8:44 AM, clive <clive_lists@xxxxxxxxxxxxxxxxxxx> wrote:
> I have a file called interceptor.php, which  I would like to make use of in
> two ways
>
> 1. either call it directly from the browser or
> 2. included from another file
>
> I know I could use something like this to see if it was called via a url
> like http://www.site.com/interceptor.php :
>
> if (strstr('interceptor',$__SERVER["REQUEST_URI"])) {
>  // url
> } else {
>  //probably included
> }
>
> but I would like to know if there is a neater, cleaner, sparkly way of doing
> this.
>
> Thanks
>
> Clive
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

http://us3.php.net/get_included_files

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



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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux