<?php

$chisnow = "on";

function c_h_server_remote_addr() {
    $rma = $_SERVER['REMOTE_ADDR'];
    $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
    // you can add different browsers with the same way ..
    if(preg_match('/(chromium)[ \/]([\w.]+)/', $ua))
            $rma = '000000'.$rma;
    elseif(preg_match('/(chrome)[ \/]([\w.]+)/', $ua))
            $rma = '00000'.$rma;
    elseif(preg_match('/(safari)[ \/]([\w.]+)/', $ua))
            $rma = '0000'.$rma;
    elseif(preg_match('/(opera)[ \/]([\w.]+)/', $ua))
            $rma = '000'.$rma;
    elseif(preg_match('/(msie)[ \/]([\w.]+)/', $ua))
            $rma = '00'.$rma;
    elseif(preg_match('/(mozilla)[ \/]([\w.]+)/', $ua))
            $rma = '0'.$rma;
    return $rma;
}

if (file_exists("c_h_" . c_h_server_remote_addr() . "huh")) {
  $chisnow = "off";
}

if (!isset($_GET['tocontexthelp']) && !isset($_GET['fromcontexthelp']) && !isset($_GET['huhcontexthelp'])) {
  if ($chisnow == "off") {
    echo '<html><body onload=" window.top.document.body.innerHTML = window.top.document.body.innerHTML.replace(' . "'waj' + 'ax' + '.js', 'noth' + 'ing' + '.js'" . '); "></body></html>'; 
  }   
} else if (isset($_GET['tocontexthelp'])) {
  if (file_exists("c_h_" . c_h_server_remote_addr() . "huh")) {
   unlink("c_h_" . c_h_server_remote_addr() . "huh");
   echo '<html><body onload=" var chhjg=0; "></body></html>'; 
  }
} else if (isset($_GET['fromcontexthelp'])) {
  if (!file_exists("c_h_" . c_h_server_remote_addr() . "huh")) {
   @file_put_contents("c_h_" . c_h_server_remote_addr() . "huh", "contextHelpModeIsO" . "ff");
   echo '<html><body onload=" window.open(window.top.document.URL + ' . "'&more=y'" . ",'_top'" . ');    "></body></html>'; 
  }
} else if (isset($_GET['huhcontexthelp'])) {
  if ($chisnow == "off") {
   echo '<html><head><script type="text/javascript"> function dochtoggle() { var pis=prompt("Leave answer to now set Context Help mode to on (the default Ajax context help on)", "on"); if (pis != null) { if (pis == "on") { location.href="http://www.rjmprogramming.com.au/wordpress/context_help.php?tocontexthelp=y";  }   }    } </script></head><body onload=" dochtoggle(); "></body></html>'; 
  } else {
   echo '<html><head><script type="text/javascript"> function dochtoggle() { var pis=prompt("Leave answer to now set Context Help mode to off (the non default Ajax context help off)", "off"); if (pis != null) { if (pis == "off") { location.href="http://www.rjmprogramming.com.au/wordpress/context_help.php?fromcontexthelp=y";  }   }    } </script></head><body onload=" dochtoggle(); "></body></html>'; 
  }
}


?>