Server Information

These NetCloak commands refer to the server.

<INSERT_HOST>

The requested host is <?php InsertHost(); ?>.

InsertHost()

<?php //----------------------------------------------------- // InsertHost() // - - - - - - // Print the host name of the server as specified in // the HTTP header. //----------------------------------------------------- function InsertHost() { print $GLOBALS[SERVER_NAME]; } ?>

<SHOW_HOST host1 host2 ...>

<?php if( ShowHost("192.") ) { ?>

  This is displayed if the request was to the private network.

<?php } ?>

ShowHost( hosts )

<?php //----------------------------------------------------- // ShowHost($hosts) // - - - - - - - - - // Returns true if any of the hosts match the host as // requested in the HTTP header. // // $hosts - a string containing partial host names // seperated by spaces: "host1 host2 ..." // // Note: This function does not currently support wildcards (*). //----------------------------------------------------- function ShowHost( $hosts ) { if( !is_array($hosts) ) $hosts = explode(" ",trim($hosts)); while( $host = each($hosts) ) { $h = trim($host[value]); if( strlen($h) > 0 ) if( stristr($GLOBALS[SERVER_NAME],$h) ) return true; } return false; } ?>

<HIDE_HOST host1 host2 ...>

<?php if( HideHost("www.") ) { ?>

  This is hidden if the request was for www.anything.???.
  This is also hidden for a host such as dev.mywww.com.

<?php } ?>

HideHost( hosts )

<?php //----------------------------------------------------- // HideHost($hosts) // - - - - - - - - - // Returns false if any of the hosts match the host as // requested in the HTTP header. // // $hosts - a string containing partial host names // seperated by spaces: "host1 host2 ..." //----------------------------------------------------- function HideHost( $hosts ) { return !ShowHost($hosts); } ?>

<INSERT_HEADER>

The header contains:
<PRE>
<?php InsertHeader(); ?>.
</PRE>

InsertHeader()

<?php //----------------------------------------------------- // InsertHeader() // - - - - - - - // Print all of the HTTP header information. //----------------------------------------------------- function InsertHeader() { print "$REQUEST_METHOD $REQUEST_URI $SERVER_PROTOCOL\n"; $h=getallheaders(); while( list($key,$value) = each($h) ) print "$key: $value\n"; print "\n"; } ?>

<SHOW_HEADER text>

<?php if( ShowHeader("Accept-Language: fr") ) { ?>

  Bon jour!

<?php } ?>

ShowHeader( text )

<?php //----------------------------------------------------- // ShowHeader($text) // - - - - - - - - - // Returns true if the text is anywhere in the header. // // $text - a string. //----------------------------------------------------- function ShowHeader( $text ) { return stristr(GetHeader(),$text); } ?>

<HIDE_HEADER text>

<?php if( HideHeader("Accept-Language: fr") ) { ?>

  Hello!

<?php } ?>

HideHeader( text )

<?php //----------------------------------------------------- // HideHeader($text) // - - - - - - - - - // Returns false if the text is anywhere in the header. // // $text - a string. //----------------------------------------------------- function HideHeader( $text ) { return !ShowHeader($text); } ?>

<INSERT_REFERRER>

The page that linked you here was: <?php InsertReferrer(); ?>.

InsertReferrer()

<?php //----------------------------------------------------- // InsertReferrer() // - - - - - - - // Print the URL of the referring page. //----------------------------------------------------- function InsertReferrer() { print $GLOBALS[HTTP_REFERER]; } function InsertReferer() { return InsertReferrer(); } ?>

<SHOW_REFERRER referrer1 referrer2 ...>

<?php if( ShowReferrer() ) { ?>

  The page <?php InsertReferrer(); ?> referrers to this page.

<?php } ?>

ShowReferrer()

<?php //----------------------------------------------------- // ShowReferrer($referrers) // - - - - - - - - - - - - // Returns true if any of the elements in $referrers // are part of the referring page. // // $referrers - a string containing partial path names // seperated by spaces: // "referrer1 referrer2 ..." //----------------------------------------------------- function ShowReferrer( $referrers = 0 ) { if( empty($referrers) ) return !empty($GLOBALS[HTTP_REFERER]); if( !is_array($referrers) ) $referrers = explode(" ",trim($referrers)); while( $referrer = each($referrers) ) { $r = trim($referrer[value]); if( strlen($r) > 0 ) if( stristr($GLOBALS[HTTP_REFERER],$r) ) return true; } return false; } function ShowReferer($r = 0) { return ShowReferrer($r); } ?>

<HIDE_REFERRER referrer1 referrer2 ...>

<?php if( HideReferrer() ) { ?>

  This page was accessed without a referrer.

<?php } ?>

HideReferrer( referrers )

<?php //----------------------------------------------------- // HideReferrer($referrers) // - - - - - - - - - - - - // Returns false if any of the elements in $referrers // are part of the referring page. // // $referrers - a string containing partial path names // seperated by spaces: // "referrer1 referrer2 ..." //----------------------------------------------------- function HideReferrer( $referrers ) { return !ShowReferrer($referrers); } function HideReferer($r = 0) { return HideReferrer($r); } ?>

<INSERT_THISURL>

This page is: <?php InsertThisURL(); ?>.

InsertThisURL()

<?php //----------------------------------------------------- // InsertThisURL() // - - - - - - - - // Print the URL of this page. //----------------------------------------------------- function InsertThisURL() { print $GLOBALS[SCRIPT_NAME]; } ?>

<SHOW_THISURL url1 url2 ...>

<?php if( ShowThisURL("/cgi-bin/") ) { ?>

  This page is in the cgi-bin folder.

<?php } ?>

ShowReferrer()

<?php //----------------------------------------------------- // ShowThisURL($urls) // - - - - - - - - - // Returns true if any of the elements in $urls // are part of this page's URL. // // $urls - a string containing partial url paths // seperated by spaces: "url1 url2 ..." //----------------------------------------------------- function ShowThisURL( $urls ) { if( !is_array($urls) ) $urls = explode(" ",trim($urls)); while( $url = each($urls) ) { $u = trim($url[value]); if( strlen($u) > 0 ) if( stristr($GLOBALS[SCRIPT_NAME],$u) ) return true; } return false; } ?>

<HIDE_THISURL url1 url2 ...>

<?php if( HideThisURL("/cgi-bin/") ) { ?>

  This page is not in the cgi-bin folder.

<?php } ?>

HideThisURL( urls )

<?php //----------------------------------------------------- // HideThisURL($urls) // - - - - - - - - - // Returns false if any of the elements in $urls // are part of this page's URL. // // $urls - a string containing partial url paths // seperated by spaces: "url1 url2 ..." //----------------------------------------------------- function HideThisURL( $urls ) { return !ShowThisURL($urls); } ?>

<INSERT_PATH>

This page is: <?php InsertPath(); ?>.

InsertPath()

<?php //----------------------------------------------------- // InsertPath() // - - - - - - // Print the path appended to the URL. The path is the // text following $ but before ? in the URL request. // // See
GetPath(). //----------------------------------------------------- function InsertPath() { print GetPath(); } ?>

GetPath()

<?php //----------------------------------------------------- // GetPath() // - - - - - // Returns a string containing the path. The path is // the text following $ but before ? in the request. //----------------------------------------------------- function GetPath() { strtok($REQUEST_URI,"$"); return stripslashes(rawurldecode(strtok("?"))); } ?>

<SHOW_PATH path1 path2 ...>

<?php if( ShowPath("step1") || ShowPath("") ) { ?>

  This is displayed for step 1 or when the page is accessed
  with no path specified.
  <A href="<?php InsertThisURL(); ?>$step2">Go on to step2.</A>

<?php } ?>
<?php if( ShowPath("step2") ) { ?>

  This is displayed for step 2.

<?php } ?>

ShowPath()

<?php //----------------------------------------------------- // ShowPath($paths) // - - - - - - - - // Returns true if any of the elements in $paths // are part of the path for this page. // // $paths - a string containing text phrases seperated // by spaces: "path1 path2 ..." // // See:
GetPath(). //----------------------------------------------------- function ShowPath( $paths = 0 ) { if( empty($paths) ) return empty(GetPath()); if( !is_array($paths) ) $paths = explode(" ",trim($paths)); while( $path = each($paths) ) { $p = trim($path[value]); if( strlen($p) > 0 ) if( stristr(GetPath(),$p) ) return true; } return false; } ?>

<HIDE_PATH path1 path2 ...>

<?php if( HidePath("step2") ) { ?>

  Don't show this for step 2.

<?php } ?>

HidePath()

<?php //----------------------------------------------------- // HidePath($paths) // - - - - - - - - // Returns true if any of the elements in $paths // are part of the path for this page. // // $paths - a string containing text phrases seperated // by spaces: "path1 path2 ..." // // See:
ShowPath(). //----------------------------------------------------- function HidePath( $paths = 0 ) { return !ShowPath($paths); } ?>

<INSERT_SEARCH>

Search this page for <?php InsertSearch(); ?>.

InsertSearch()

<?php //----------------------------------------------------- // InsertSearch() // - - - - - - // Print the search appended to the URL. The search is // the text following ? in the URL request. // // See
GetSearch(). //----------------------------------------------------- function InsertSearch() { print GetSearch(); } ?>

GetSearch()

<?php //----------------------------------------------------- // GetSearch() // - - - - - // Returns the search appended to the URL. The search // is the text following ? in the URL request. //----------------------------------------------------- function GetSearch() { return strtr(stripSlashes(rawurldecode($GLOBALS[QUERY_STRING])),"+"," "); } ?>

<SHOW_SEARCH search1 search2 ...>

<?php if( ShowSearch("checkbox=yes") || empty(GetPath()) ) { ?>

  The checkbox was selected on the referring page.

<?php } ?>

ShowSearch( search )

<?php //----------------------------------------------------- // ShowSearch($search) // - - - - - - - - - - // Returns true if any of the elements in $search are // part of the search for this page. // // $search - a string containing text phrases seperated // by spaces: "search1 search2 ..." // // See:
GetSearch(). //----------------------------------------------------- function ShowSearch( $search = 0 ) { if( empty($search) ) return empty(GetSearch); if( !is_array($search) ) $search = explode(" ",trim($search)); while( $theSearch = each($search) ) { $s = trim($theSearch[value]); if( strlen($s) > 0 ) if( stristr(GetSearch(),$s) ) return true; } return false; } ?>

<HIDE_SEARCH search1 search2 ...>

<?php if( HideSearch("yes ok") ) { ?>

  Nothing was marked as yes of ok.

<?php } ?>

HideSearch( search )

<?php //----------------------------------------------------- // HideSearch($search) // - - - - - - - - - - // Returns false if any of the elements in $search are // part of the search for this page. // // $search - a string containing text phrases seperated // by spaces: "search1 search2 ..." // // See:
ShowSearch(). //----------------------------------------------------- function HideSearch( $search = 0 ) { return !ShowSearch($search); } ?>