[kdewebdev-webdeveloper] php SuperGlobals question

obennett obennett at hartford.edu
Thu Aug 5 21:44:58 EDT 2004


Hey all. I have a prob with php and the register_globals directive being off. 
I have the following code which I thought would work with register_globals off 
seeing that they are superglobals, however if I do set  register_globals to 
be off it doesn't work:

<?php
if(stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml")){
  header("Content-Type: application/xhtml+xml");
  echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
  echo ('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">');
}
elseif(stristr($HTTP_USER_AGENT,"Opera 7")||
stristr($HTTP_USER_AGENT,"Opera/7")
||stristr($HTTP_USER_AGENT,"Safari")||
stristr($HTTP_USER_AGENT,"W3C_Validator")
||stristr($HTTP_USER_AGENT,"Konqueror/3.3")){
  header("Content-Type: application/xhtml+xml");
  echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
  echo ('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">');
} else {
  header("Content-Type: text/html");
  echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
  echo ('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">');
}
?>

any idea why it might not be working?


More information about the kdewebdev-webdeveloper mailing list