<?php

require 'browserhawk.php';

  // This sample is provided under the terms of the BrowserHawk End User
  // License Agreement. Copyright (c) 2003-2006 cyScape, Inc. All rights
  // reserved.

	// This sample demonstrates how to accurately detect the user's operating
	// system name and version, and the hardware architecture (such as x64 vs.
	// PPC).  These properties are exposed through the ExtendedBrowserInfo class
	// OSName, OSVersion, and OSArch.

	// Note: The user must have Java installed to detect these properties.

	// YOU MUST HAVE THE JVMDetector.class FILE, DISTRIBUTED WITH YOUR
	// BROWSERHAWK INSTALLATION FILES, IN THE WEB DIRECTORY WHERE YOUR SCRIPT
	// THAT DETECTS THESE PROPERTIES RUNS FROM.

	// Although we have made this sample very verbose with comments for
	// educational purposes, note that it takes only a few lines of code to
	// detect the Broadband property -  1) use $options to set testing
  // preferences, and 2) call bhextended($optoins) to obtain an
	// ExtendedBrowserInfo instance where the answers can be obtained via the
	// OSName, OSVersion, and OSArch properties.

  // First we make sure the system executing this example has an
  // Enterprise Edition license as required for this test.
  // Note: This is NOT needed in your pages, only for this sample.

  if (strpos($BrowserHawk->getVersion(), "Ent") === false) {
    echo "Enterprise License Required.  ";
    echo "You are using " . $BrowserHawk->getVersion() . ".  ";
    echo "See <a href='http://www.cyscape.com/order/'>http://www.cyscape.com/order/</a> for upgrade information.";
    return;
  }

	// We tell BrowserHawk we want to test for OSName, OSVersion, and
	// OSArch.  If there are other settings you want to check as well, such as
	// disabled cookies/JavaScript, plugins, etc, you can do so concurrently
	// with these tests by adding the appropriate values to the statement below.
	// See the ExtendedOptions class in the BrowserHawk documentation for more
	// information.
	$options->addProperties("OSName, OSVersion, OSArch");

	// OK, let's perform the check for Broadband. See the ExtendedOptions class
	// in the documentation for details on options available such as controlling
	// the background color of the screen and page messages i.e.  "Checking your
	// browser. Please wait...". TIP: Set the BGCOLOR parameter below to your
	// site's background color. Otherwise you may notice a color
	// flicker during the test.

  $options->setPageMessage("BrowserHawk is checking your operating system. Please wait...");
  $options->setBodyTag("BGCOLOR=#FFFFFF");
  $options->setPageTitle("Please wait...");

  $einfo = bhextended($options);
?>

<html>
<head><title>BrowserHawk Sample - Operating System information</title>
</head>
<body><font face="arial">
<blockquote>

<h2>BrowserHawk Operating System Information</h2>
<font size=3>

Operating system name: <?php echo $einfo->getOSName() ?>
<p>
Operating system version: <?php echo $einfo->getOSVersion() ?>
<p>
Operating system architecture: <?php echo $einfo->getOSArch() ?>
<p>

Note: If you do not see answers above it is because you do not have Java 
available. Detection of these properties requires Java.
<hr>

<P>
<b><a href="osinfo.php">Retry this test</a></b><P>
<b><a href="index.html">Return to list of other PHP samples</a></b><P>
<b><a href="http://www.cyscape.com/order/">BrowserHawk Pricing and Ordering</a></b><P>
<b><a href="http://www.cyscape.com/">cyScape home page</a></b><P>
</font></blockquote>
</body>
</html>
