Jump to content

Awkward access


damiancds
 Share

Recommended Posts

I recently redid my 404 page and included error reporting where it sent me an email and gave the recent url (where they came from) and the current url (where they were trying to go)now, I'm getting email (my error reports) stating things like a background.gif request (inside my resources folder) from pretty much any page on my domain.the only problem is i don't have a background.gif referenced anywhere (long since commented out from my css)also, i think a lot of these errors are from robots or spiders, so is there any way to detect if the user is a robot (ie through testing user agent in the server array) and not send reports generated by them?if you get what I'm saying please point me in the right direction,thanks,EDIT: changed the background.gif to take away the url

Edited by damiancds
Link to comment
Share on other sites

the only problem is i don't have a background.gif referenced anywhere
Occam's Razor says you do, and just don't realize it. Would it be possible that your visitors have the old sytlesheet cached? Would that file be linked from another site? You can use a traffic analyzer like Wireshark or Fiddler to look at all of the requests going out to the server. Your emails should also tell you what the referer is, right? That will tell you which page is referencing that file.Also, posting the link here may generate additional traffic to that missing file.
is there any way to detect if the user is a robot (ie through testing user agent in the server array)
Right, you can check the user agent. You can also check the IP against a list of known IPs. There are sites online which list user agent strings and IPs for several bots.
Link to comment
Share on other sites

I've been looking up how to stop caching, and several sites mention the use of http headers, and adding expiration date and no cache statements to them, the only thing is I've never heard of http headers and I have no idea how to create/modify them.

Link to comment
Share on other sites

I've been looking and a lot of places say to put the headers before any outputbut...is that before even the doctype, or just in the header before the bodyonce i get that straightened out, i'll be all set,thanks,EDIT: looking at the info here, it shows it going before the opening html tags, but doesn't say whether it has to be before the doctype declaration.

Edited by damiancds
Link to comment
Share on other sites

It has to be before any output at all. The DOCTYPE markup declaration is output. Even a single space is output.Note that the header() function has no correlation to any particular piece of markup - it needs to be above output simply because headers are sent when you first output anything.

Link to comment
Share on other sites

  • 1 month later...

It took me a while but I finally found the topic I started,I've put the php header(s) on the main page of my site, which appears to be working as it should, but I recently noticed this in my error logs[25-May-2010 08:15:15] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/ledger6/public_html/index.php:1) in /home/ledger6/public_html/index.php on line 1the actual php header code i've used is:

<!-- <?php Header("Cache-Control: must-revalidate"); $offset = 60 * 60 * 24 * 1; $ExpStr = "Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT"; Header($ExpStr); ?> -->

I'm wondering why I'm getting this error, if the caching seems to be working. (should i get rid of the html comments <!-- , --> )thanks,

Link to comment
Share on other sites

A header cannot be sent if any output was sent before. The HTML comments are considered output.You don't need to comment out PHP code, it never gets sent to the client to begin with.

Link to comment
Share on other sites

thanks, I guess I wasn't really paying attention when I put it in there. Hopefully nothing else shows up in my error logs

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...