Problem with require(), determining context.

From: Date: Tue, 07 Aug 2001 00:32:17 +0000
Subject: Problem with require(), determining context.
Groups: php.general 
Request: Send a blank email to php-general+get-61518@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! :) -- -Ryan :: ICQ - 595003 :: GigaBoard - http://www.gigaboard.net/

« previous php.general (#61518) next »