I have some really simple code that I need to port to PHP because a customer has a linux server and needs this code to run on it.

All the code does is check the USER_AGENT string sent by the browser to determine if the .NET framework is present. This info is ONLY sent in the USER_AGENT string if the webbrowser being used is IE, otherwise its not there.

So there are 3 possible outcomes.

1) User is using IE and .NET framework is present
2) User is using IE and .NET framework is NOT present
3) User is not using IE and .NET framework can not be determined

The code is not fool proof, but all it is supposed to do is give the user a suggestion on which of the 2 files they shoudl download, one that has the .NET framework (25+MB file) or the one that is just the program (~2MB file)

since the end users of this software are not computer savvy, this helps them to get the right one (and I would say 85% are using IE)

anyway, here is some of the ASP code so you can see the actual checks I am doing (basically just looking for keywords in the USER_AGENT string)

VB Code:
  1. if instr(1, Request.ServerVariables("HTTP_USER_AGENT"), "1.1.4322") <> 0 or instr(1, Request.ServerVariables("HTTP_USER_AGENT"), "2.0.40607") <> 0 then
  2. 'WRITE OUT SOME HTML
  3. elseif instr(1,Request.ServerVariables("HTTP_USER_AGENT"),"MSIE") <> 0 then
  4. 'WRITE OUT SOME HTML
  5. else
  6. 'WRITE OUT SOME HTML
  7. end if

I also call a sub that is in the same page
VB Code:
  1. Sub DisplayDownloads(LargeFirst)
  2.     If LargeFirst then
  3.        'WRITE OUT SOME HTML
  4.     else
  5.        'WRITE OUT SOME HTML
  6.     end if
  7. End Sub

Thanks!