Re: how to hide dbconnect file if its in published directory?

From: Date: Mon, 09 Jul 2001 22:56:11 +0000
Subject: Re: how to hide dbconnect file if its in published directory?
Groups: php.general 
Request: Send a blank email to php-general+get-57023@lists.php.net to get a copy of this message
> 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

« previous php.general (#57023) next »