Jump to content

How to check which page is freading a script?


sKunKbad

Recommended Posts

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?

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.