Domanda

I am developing a corporate website for my HSC Software Design and Development Major Project. I have a section of code to check if the user's browser was supported in a MySQL database and, if not, display a warning to them and log their browser type. This code was working (almost) perfectly using the get_browser function, displaying a message that looked a bit like this:

We detected that you're using Internet Explorer to view this site. We have not tested this browser and cannot guarantee full support. For best results we recommend Google Chrome.

Since a bit of messing around in httpd.conf and a few server restarts however, this code no longer works. It detects ever browser as being "". (just an empty string) Trying to figure out the source of the problem, I put a quick debug line in:

echo $_SERVER['HTTP_USER_AGENT'];

For some reason this returns the following in EVERY BROWSER:

Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5

I would imagine that this is the cause of the problem, does anyone know why this might be?

È stato utile?

Soluzione

Once again, the solution to my problem is very specific. Here is what the issue was:

I use WebFaction for hosting, they have a applications, websites and domains setup which is great, but too complicated to fully explain here. Basically, I had been running the website successfully until one day the httpd executable randomly disappeared. After conversations with WebFaction's support team, I decided that I would rebuild Apache and put it in a new Application. Having done this my server was fixed and continued to run smoothly for a couple of weeks afterwards. A couple of days ago I decided it was time to clear out the old Application (which was inactive but still on the server) to regain a bit of disk space. What I didn't realise was that the PHP.ini in my new Application referred to the browscap.ini in my old Application. Once this had been deleted it could not be found anymore, returning errors. When I went to PHP.ini to check that I had the correct setting, I recognised the part that referred to my old Application because I was so used to it, and saw that the bit on the end was still correct, so assumed the problem could not be there.

TL;DR, so long as no-one else screws up a migration they should not have this issue.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top