sKunKbad Posted September 21, 2008 Share Posted September 21, 2008 I've got a need to check which page is freading a script, and output something if it is that page or not. Lets say I want to only let /somepage.php see something output. I've tried REQUEST_URI, but its obviously not the right server variable. So this is within the script, not somepage.php: if ($_SERVER['REQUEST_URI'] == '/somepage.php'){ echo "you are on the somepage.php page"; } What is the correct way to do this? Quote Link to comment https://forums.phpfreaks.com/topic/125212-how-to-check-which-page-is-freading-a-script/ Share on other sites More sharing options...
DarkWater Posted September 21, 2008 Share Posted September 21, 2008 Wait, it's fread()'ing it? I don't know of a way to get the accessing script. Maybe someone else does. >_< Quote Link to comment https://forums.phpfreaks.com/topic/125212-how-to-check-which-page-is-freading-a-script/#findComment-647216 Share on other sites More sharing options...
sKunKbad Posted September 21, 2008 Author Share Posted September 21, 2008 Yes, it is the phpSitemapNG, which is a php sitemap generator that is freading the script. If it freads it, I want to output a last modified header, but if it doesn't, like if it's just anyone else or google, i don't want to output the last modified header. Quote Link to comment https://forums.phpfreaks.com/topic/125212-how-to-check-which-page-is-freading-a-script/#findComment-647233 Share on other sites More sharing options...
DarkWater Posted September 21, 2008 Share Posted September 21, 2008 If it fread()'s it, I don't think that HTTP headers would matter. Quote Link to comment https://forums.phpfreaks.com/topic/125212-how-to-check-which-page-is-freading-a-script/#findComment-647238 Share on other sites More sharing options...
sKunKbad Posted September 21, 2008 Author Share Posted September 21, 2008 Well, unless I put a last modified header on a page that I want in my sitemap, it won't have an accurate last modified date/time. This is what I'm using: header("Last-Modified: " . gmdate("D, d M Y H:i:s", getlastmod()) ." GMT"); it is fopening and freading the file. Perhaps it is executing the php within the file somewhere, because if it didn't I don't know how it would get that last modified date/time. Quote Link to comment https://forums.phpfreaks.com/topic/125212-how-to-check-which-page-is-freading-a-script/#findComment-647241 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.