PHP IGB

From EVEDev

Jump to: navigation, search
Image:Api.pngIn Game Browser Documentation - Category Home - Documentation Home

[edit] IGB trust and detection routines for PHP.

 
<?php
 
////////////////////////////////////////////////////////////////////////////////////////
//
// Returns TRUE if the user trusts the site, FALSE otherwise.
//
////////////////////////////////////////////////////////////////////////////////////////
function IGBRequireTrust()
{
  if($_SERVER['HTTP_EVE_TRUSTED'] != 'yes')
  {
    header('eve.trustMe:http://' . $_SERVER['HTTP_HOST'] . '/::This site needs trust to function.');
    return false;
  }
 
  return true;
}
 
////////////////////////////////////////////////////////////////////////////////////////
//
// Returns TRUE if the browser is the EVE mini-browser, FALSE otherwise.
//
////////////////////////////////////////////////////////////////////////////////////////
function IGBDetect()
{
  return isset($_SERVER['HTTP_EVE_TRUSTED']);
}
 
?>
 

[edit] Alternative, more efficient way to use IGB detection in scripts.

 
<?php
 
/** Set EVE_IGB constant once
*/
 
if(array_key_exists('HTTP_EVE_TRUSTED', $_SERVER))
{
  define('EVE_IGB', true);
}
else
{
  define('EVE_IGB', false);
}
 
// Then all you need is to use this constant value to lay your pages accordingly
if(EVE_IGB)
{
  // IGB stuff here
}
else
{
  // OOG stuff here
}
 
?>
 
Personal tools