Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.