On Thu,  1 Jan 1970 09:30, [EMAIL PROTECTED] wrote:
> >    I come for advice once again. Say i have a file dbconnect.inc
> > which connects to my database. Now if this file is located in a
> > directory accessible for to the web is there anyway that if someone
> > types in that file i can detect it being accessed, instead of
> > included, and redirect them elsewhere?
> >
> >Thanks guys!
> >
> >- Noah
>
> Sure, try putting a quick if statement at the top checking for the
> $PHP_SELF.  If it's dbconnect.inc, then have it die with a message...
>
> if($PHP_SELF == 'dbconnect.inc') { die{"Access Denied!"); }
>
> Also, I know that my server isn't set to parse .inc files, and it shows
> the source of them.  For that reason, I renamed all my include files to
> .php.
>
> rick
> http://techno-weenie.com

Of course, if your server has the capability, you could always set it not 
to serve .inc files.

Apache:

# Keep from serving .inc files anywhere in the DocumentRoot structure
<LocationMatch ".*\.inc$">
    Order allow,deny
    Deny from all
</LocationMatch>


-- 
David Robley      Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES      Flinders University, SOUTH AUSTRALIA  

   Oxymoron: Safe Sex.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to