Re: Problem with require(), determining context.

From: Date: Tue, 07 Aug 2001 00:35:36 +0000
Subject: Re: Problem with require(), determining context.
Groups: php.general 
Request: Send a blank email to php-general+get-61520@lists.php.net to get a copy of this message
> Hello! :) > > I have a script that loads another script with require() and based on > the context, I'd like different things to happen. So, index.php is > calling the required file require.php. And when require.php is run, if > there's no HTTP_REFERER and the file is index.php, everything is OK. > But if the file is accessed directly (say by GET) then I want an error > to be thrown. Reason being is require.php can also accept POST > operations, but I don't want it to accept GETs, because it's not > supposed to be used alone. Problem is, when it's required with another > file, GET is OK. So basically, I want to detect if the file is being > required or called on its own. At least, that's what it sounds like I > want to do from my above explanation. Any ideas how I can accomplish > this? Thanks! :) I think $PHP_SELF is your friend! hth Michael -- Aufgepasst - jetzt viele 1&1 New WebHosting Pakete ohne Einrichtungsgebuehr + 1 Monat Grundgebuehrbefreiung! http://puretec.de/index.html?ac=OM.PU.PU003K00736T0492a

« previous php.general (#61520) next »