<?php

//  PROJECT HONEY POT ADDRESS DISTRIBUTION SCRIPT
//  For more information visit: http://www.projecthoneypot.org/
//  Copyright (C) 2004-2009, Unspam Technologies, Inc.
//  
//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation; either version 2 of the License, or
//  (at your option) any later version.
//  
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//  
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
//  02111-1307  USA
//  
//  If you choose to modify or redistribute the software, you must
//  completely disconnect it from the Project Honey Pot Service, as
//  specified under the Terms of Service Use. These terms are available
//  here:
//  
//  http://www.projecthoneypot.org/terms_of_service_use.php
//  
//  The required modification to disconnect the software from the
//  Project Honey Pot Service is explained in the comments below. To find the
//  instructions, search for:  *** DISCONNECT INSTRUCTIONS ***
//  
//  Generated On: Wed, 16 Dec 2009 08:18:06 -0500
//  For Domain: orangesquash.org.uk
//  
//  

//  *** DISCONNECT INSTRUCTIONS ***
//  
//  You are free to modify or redistribute this software. However, if
//  you do so you must disconnect it from the Project Honey Pot Service.
//  To do this, you must delete the lines of code below located between the
//  *** START CUT HERE *** and *** FINISH CUT HERE *** comments. Under the
//  Terms of Service Use that you agreed to before downloading this software,
//  you may not recreate the deleted lines or modify this software to access
//  or otherwise connect to any Project Honey Pot server.
//  
//  *** START CUT HERE ***
//  
define('__REQUEST_HOST', 'hpr6.projecthoneypot.org');
define('__REQUEST_PORT', '80');
define('__REQUEST_SCRIPT','/cgi/serve.php');
//  
//  *** FINISH CUT HERE ***
//  

define('__HPOT_TAG1',    '16d3a1401e6e89466854655cb3a9695a');
define('__HPOT_TAG2',    '1379f38b4eb7d6ad67d835265a1fba6e');
define('__HPOT_TAG3',    '34aa2473d1aa4705f92165addfe297ff');

define('__CLASS_STYLE_1','lodrothu');
define('__CLASS_STYLE_2','yobriclu');

define('__DIV1',         'c16ath4');

define('__VANITY_L1',    'MEMBER OF PROJECT HONEY POT');
define('__VANITY_L2',    'Spam Harvester Protection Network');
define('__VANITY_L3',    'provided by Unspam');

define('__DOC_TYPE1',    '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\n');
define('__HEAD1',        '<html>\n<head>\n');
define('__HEAD2',        '<title>Orangesquash.org.uk>synthetic</title>\n</head>\n');
define('__ROBOT1',       '<meta name="robots" content="noindex,follow">\n<meta name="robots" content="noarchive">\n');
define('__NOCOLLECT1',   '<meta name="no-email-collection" content="/">\n');
define('__TOP1',         '<body>\n<div align="center">\n');
define('__EMAIL1A',      '<a href="mailto:');
define('__EMAIL1B',      '" style="display: none;">');
define('__EMAIL1C',      '</a>');
define('__EMAIL2A',      '<a href="mailto:');
define('__EMAIL2B',      '" style="display:none;">');
define('__EMAIL2C',      '</a>');
define('__EMAIL3A',      '<a style="display: none;" href="mailto:');
define('__EMAIL3B',      '">');
define('__EMAIL3C',      '</a>');
define('__EMAIL4A',      '<a style="display:none;" href="mailto:');
define('__EMAIL4B',      '">');
define('__EMAIL4C',      '</a>');
define('__EMAIL5A',      '<a href="mailto:');
define('__EMAIL5B',      '"></a>');
define('__EMAIL5C',      '..');
define('__EMAIL6A',      '<span style="display: none;"><a href="mailto:');
define('__EMAIL6B',      '">');
define('__EMAIL6C',      '</a></span>');
define('__EMAIL7A',      '<span style="display:none;"><a href="mailto:');
define('__EMAIL7B',      '">');
define('__EMAIL7C',      '</a></span>');
define('__EMAIL8A',      '<!-- <a href="mailto:');
define('__EMAIL8B',      '">');
define('__EMAIL8C',      '</a> -->');
define('__EMAIL9A',      '<div id="'.__DIV1.'"><a href="mailto:');
define('__EMAIL9B',      '">');
define('__EMAIL9C',      '</a></div><br><script language="JavaScript" type="text/javascript">document.getElementById(\''.__DIV1.'\').innerHTML=\'\';</script>');
define('__EMAIL10A',     '<a href="mailto:');
define('__EMAIL10B',     '"><!-- ');
define('__EMAIL10C',     ' --></a>');
define('__LEGAL1',       '');
define('__LEGAL2',       '\n');
define('__STYLE1',       '\n<style>a.'.__CLASS_STYLE_1.'{color:#FFF;font:bold 10px arial,sans-serif;text-decoration:none;}</style>');
define('__VANITY1',      '<table cellspacing="0"cellpadding="0"border="0"style="background:#999;width:230px;"><tr><td valign="top"style="padding: 1px 2px 5px 4px;border-right:solid 1px #CCC;"><span style="font:bold 30px arial,sans-serif;color:#666;top:0px;position:relative;">@</span></td><td valign="top" align="left" style="padding:3px 0 0 4px;"><a href="http://www.projecthoneypot.org/" class="'.__CLASS_STYLE_1.'">'.__VANITY_L1.'</a><br><a href="http://www.unspam.com"class="'.__CLASS_STYLE_1.'">'.__VANITY_L2.'<br>'.__VANITY_L3.'</a></td></tr></table>\n');
define('__BOTTOM1',      '</div>\n</body>\n</html>\n');


function getLegalContent() { return '<table cellpadding="0" cellspacing="0" border="0">\n<tr>\n<td style="font-family: courier, monospace;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <b><font color=white>c</font></b><br>&nbsp;<br>The website f&#114;om<br>to you sub<!-- diminished shopping -->ject<font color=white>o</font>t<br>other terms gove<br>Web&#115;ite you &#97;cce<br>read t&#104;em caref&#117;<br>agents of &#116;he<!-- ponies brash dunlin -->&nbsp;&#105;n<br>t&#104;em.<font color=white>c</font>The access<br>non&#45;t&#114;ansfera&#98;&#108;e<br>Webs&#105;te.<br><br>&nbsp; &nbsp; &nbsp;&nbsp; <b><font color=white>t</font></b>&nbsp; &nbsp; &nbsp;&nbsp; <b>S</b><br>&nbsp;<br>Special &#114;estrict<br>Non&#45;Human<!-- mannered regulation authority longitudinal -->&nbsp;Vi&#115;ito<br>spiders,<font color=white>e</font>&#98;&#111;&#116;s, &#105;<br>prog&#114;ams de<!-- brownbag boat -->&#115;ig<!-- jellyfish compound -->ne<br>auto&#109;atically.<br><br>Emai&#108;<font color=white>s</font>add&#114;esse&#115; <br>&#73;t<!-- encounter sensitivity -->&nbsp;is re&#99;ogn<!-- measure recessive -->ized<br>alo&#110;e.<font color=white>t</font>You ackno<br>has &#97; value &#110;ot <br>&#115;&#116;or&#97;ge&#44; and/or <br>&#118;a&#108;ue of &#116;hese &#97;<br>storing this Web<br>agreement<font color=white>o</font>and ex<br><br>&nbsp; &nbsp; &nbsp; <b><font color=white>t</font></b>&nbsp;<b><font color=white>o</font></b>&nbsp;&nbsp; <b><font color=white>g</font></b>&nbsp;<b><font color=white>c</font></b>&nbsp;<br><font color=white>p</font><br>Each &#112;&#97;rty agree<br>agai&#110;st the &#111;the<br>("Judicial Actio<br>the regi&#115;te&#114;ed A<br>such laws are ap<br>and perform&#101;&#100; en<br>of federal<font color=white>k</font>&#97;nd s<br>an&#121; &#97;ctio<!-- diagrammatic nuns printed -->n &#98;roug<br>Se&#114;vic&#101;. Yo&#117; con<br>th&#101; above ag&#114;eem<!-- sawedoff invasion bareheaded diet fixed --><br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp;<br>You consent &#116;&#111; h<br>may appear somew<br>abuse. The Iden&#116;<br>Visitors a&#103;&#114;ee n<br><br>VISIT&#79;RS AGREE T<br>P&#65;RTY OR SEN&#68;ING<br>&#83;U&#66;S&#69;QU&#69;NT BRE&#65;&#67;<br></td>\n<td style="font-family: courier, monospace;">&nbsp; &nbsp; <b><font color=white>o</font><font color=white>t</font></b>&nbsp;&nbsp; <b><font color=white>k</font></b>&nbsp;<b>TE&#82;MS</b><br><br>&nbsp;whi&#99;h yo&#117; a&#99;c&#101;s<br>o<font color=white>i</font>t&#104;e f<!-- industry wellgroomed -->oll&#111;wing <br>rn&#105;ng ac&#99;ess to <br>p&#116; these &#116;erms<font color=white>t</font>a<br>ll&#121;. Any Non-Hum<br>divid&#117;a&#108;(<!-- cruciform sacrificial seminar -->s)<font color=white>h</font>who <br>&nbsp;&#114;ig&#104;t&#115; &#103;ranted <br>&nbsp;&#119;it<!-- reservation reason dizzy early -->hout the ex&#112;<br><br><br><b>&#80;ECIAL</b>&nbsp;<b>LICEN&#83;E</b>&nbsp;<b>R</b><br><br>ion<!-- nearby -->s on a vi&#115;ito<br>rs. Non-Human Vi<br>n&#100;exers, robot&#115;,<br>d to<font color=white>t</font>ac&#99;ess, rea<br><br><br>on<font color=white>f</font>this site are<br>&nbsp;that these emai<br>wledge and a&#103;ree<br>less than U&#83;<font color=white>d</font>$&#53;0<br>&#100;istri<!-- pattern egg magnetic -->buti&#111;n of <br>&#100;dres&#115;e&#115;. Intent<br>&#115;ite\'&#115; &#101;mai&#108;<font color=white>d</font>add<br>pressl&#121; p&#114;ohib&#105;t<br><br>&nbsp; <b><font color=white>f</font></b>&nbsp;<b><font color=white>g</font></b>&nbsp;<b><font color=white>c</font></b>&nbsp; <b>&#65;PPLICA</b><br><br>s that any sui&#116;,<br>r i&#110; con&#110;e&#99;t<!-- preconscious curvaceous foldaway towering -->ion <br>n") &#115;hall be<font color=white>g</font>g<!-- projection -->ov<br>dmi&#110;istrative Co<br>plied to agreeme<br>tirely wit&#104;in th<br>tat<!-- neutral comatose -->&#101;<font color=white>g</font>&#99;ourts with<br>ht aga&#105;nst h<!-- lasting community -->im i<br>sent t&#111; electron<br>ent.<br><br>&nbsp;&nbsp; <b><font color=white>g</font></b>&nbsp; &nbsp; <b>RECORDS</b>&nbsp;<br><br>&#97;v<!-- acceptable -->i&#110;g your I<!-- picaresque mould -->n&#116;er<br>here on this pag<br>ifier is un&#105;que&#108;<br>o&#116; to u&#115;e this a<br><br>HAT HARVE<!-- selfwinding quota barn -->ST<!-- temple dungeon broadloom roster -->ING, <br>&nbsp;ANY &#77;&#69;SSAGE(&#83;) <br>&#72; O&#70; T&#72;ESE<font color=white>h</font>TE&#82;M&#83;<br></td>\n<td style="font-family: courier, monospace;"><b><font color=white>f</font>&#65;ND<font color=white>a</font>CO&#78;DITIONS</b>&nbsp;<br><br>s&#101;d th&#105;s a&#103;reeme<br>conditions&#46; Thes<br>the W&#101;b&#115;ite. By <br>nd conditions (t<br>an V&#105;sitor&#115; to t<br>controls, author<br>to you under th&#101;<br>ress w&#114;itten pe&#114;<br><br><br><b>E&#83;&#84;RICTI&#79;NS</b>&nbsp;<b>F&#79;R</b>&nbsp;<br><br>r\'s &#108;icense &#116;o a<br>s&#105;t&#111;rs &#105;ncl&#117;de, <br>&nbsp;crawl&#101;r&#115;, harve<br>d, com&#112;ile or ga<br><br><br><font color=white>o</font>c&#111;&#110;sidered prop<br>l &#97;&#100;dresses ar&#101; <br>&nbsp;th&#97;t &#101;ach em&#97;il<br>. You<font color=white>t</font>furthe&#114; a&#103;<br>these addr&#101;ss&#101;s<font color=white>i</font><br>ional &#99;&#111;&#108;lection<br>re&#115;s&#101;s is r&#101;cogn<br>ed.<br><br><b>&#66;LE</b>&nbsp;<b>L<!-- lownecked constituent -->A&#87;</b>&nbsp;<b>AND</b>&nbsp;<b>&#74;&#85;RI</b><br><br>&nbsp;action or p&#114;oce<br>w&#105;t&#104; o&#114; arising <br>e<!-- evolutionary -->rned by the law<br>ntact (th&#101; "Admi<br>nt&#115; &#98;etween<font color=white>k</font>Admi<br>e &#65;&#100;mi&#110; State. Y<br>in th<!-- perception relative humorous -->e Admin S&#116;a<br>n con&#110;ec&#116;ion wit<br>ic &#115;ervi&#99;&#101; of pr<br><br><br><b>OF</b>&nbsp;<b>V&#73;SITOR</b>&nbsp;<b>USE</b>&nbsp;<b>A</b><br><br>net Protoco&#108; add<br>e<font color=white>t</font>(t&#104;e "Identifi<br>y matched<font color=white>h</font>to y&#111;u<br>ddress fo<!-- crosstown burly diminished slighting -->r an&#121; r<br><br>GATHERING, STORI<br>T&#79; &#84;HE I&#68;ENTI&#70;&#73;E<br>&nbsp;O&#70; SERVIC&#69;.<br></td>\n<td style="font-family: courier, monospace;"><b>OF</b>&nbsp;<b>USE</b>&nbsp;<br><br>nt<font color=white>s</font>("the Website<br>e ter&#109;s are in a<br>visitin&#103; (in any<br>h&#101; "Terms of Ser<br>he We&#98;sit&#101; &#115;hall<br>s or oth&#101;rwise<font color=white>c</font>m<br>&nbsp;Terms o&#102; Serv&#105;c<br>mis&#115;ion of the o<br><br><br><b>NON-HUMAN</b>&nbsp;<b>&#86;ISITO</b><br><br>ccess the Websit<br>but ar&#101; no&#116; &#108;i<!-- steady joke destination imperative bluff -->mi<br>ste&#114;s, or any ot<br>th&#101;r content fro<br><br><br>r&#105;etary<font color=white>o</font>inte&#108;lec<br>provi&#100;ed for &#104;um<br>&nbsp;addr&#101;ss th<!-- location soap horrible fruit -->e We&#98;<br>r&#101;e th&#97;t the co&#109;<br>subs&#116;antially &#100;&#105;<br>, har<!-- ritual typecast bow downrange -->ves&#116;ing, ga<br>iz&#101;d<font color=white>e</font>as<font color=white>h</font>a viol<!-- prize curious divine washing peltate -->at<br><br><br><b>SDI&#67;T&#73;ON</b>&nbsp;<br><br>edi&#110;g b&#114;ought by<br>from t<!-- wide -->he Term&#115; o<br>&nbsp;of t&#104;e<font color=white>h</font>&#115;&#116;ate of<br>n St&#97;te") for th<br>n Sta&#116;e<font color=white>s</font>&#114;esident<br>ou conse&#110;t<font color=white>i</font>to t&#104;<br>t&#101;. Yo&#117; consent <br>h breaches of<font color=white>e</font>th<br>oc<!-- lady lipped watch gap rackety -->ess regardi&#110;g <br><br><br><b>ND</b>&nbsp;<b>&#65;BUSE</b>&nbsp;<br><br>ress recorded. A<br>er")<font color=white>c</font>if we su<!-- poptop stabile storefront intracellular -->s&#112;e<br>r<font color=white>c</font>In&#116;e&#114;ne&#116; Proto<br>e<!-- magnanimous feeling cottage client covenant -->ason.<br><br>NG&#44;<font color=white>c</font>TRA&#78;S&#70;ERRING<br>R<font color=white>a</font>CONS<!-- uvular angry -->&#84;ITUTES AN<br><br></td>\n<td style="font-family: courier, monospace;"><br><br>") is provid&#101;&#100;<br>d&#100;it<!-- broad rustic coastal racism prep -->i&#111;n &#116;o any<br>&nbsp;&#109;anne&#114;) the<br>vic<!-- incredulous nuclear favourite -->e")&#46; Please<br>&nbsp;be co&#110;sidered<br>akes<font color=white>a</font>use o&#102;<br>e &#97;re<br>wner of th&#101;<br><br><br><b>RS</b>&nbsp;<br><br>&#101; apply to<br>&#116;ed t&#111;, web<br>h&#101;r computer<br>m the<font color=white>o</font>Webs&#105;te<!-- professional hip mist supernal --><br><br><br>tual p&#114;operty.<br>an visitors<br>site conta&#105;&#110;s<br>pilat&#105;on,<br>mi&#110;ishes<font color=white>s</font>the<br>thering,<font color=white>o</font>and/or<br>&#105;on o&#102; this<br><br><br><br><br>&nbsp;such party<br>f Serv&#105;c&#101;<br>&nbsp;residence of<br>e Web<!-- moonfaced importunate efficient liveried odds -->&#115;ite as<!-- darn excess spacey --><br>s<!-- temporal bath notrump physical unlikely -->&nbsp;&#101;ntered i&#110;to<br>e jurisd&#105;ction<br>to &#116;&#104;&#101; &#118;e&#110;ue<font color=white>f</font>&#105;n<br>ese T&#101;rms of<br>actions under<br><br><br><br><br>n e&#109;ai&#108; address<br>ct potential<br>c&#111;l address&#46;<br><br><br>&nbsp;TO<font color=white>g</font>A THIRD<br>&nbsp;&#65;CCEPTANCE &#65;N&#68;<br><br></td>\n</tr>\n</table>\n<br>'; }


?><?php 

// 
// PROXY SUPPORT
//  
// This honey pot script supports Proxies. If your webserver requires a proxy
// for outbound connections you may configure this honey pot's settings to use
// a proxy.
//
// For more information, visit: 
//     http://www.projecthoneypot.org/settings_help.php
//
//



function formatHTML($s) {
    return str_replace('\n',"\n",$s);
}

function getDocType()       { return formatHTML(__DOC_TYPE1); }
function getHeadHTML1()     { return formatHTML(__HEAD1); }
function getRobotHTML()     { return formatHTML(__ROBOT1); }
function getNoCollectHTML() { return formatHTML(__NOCOLLECT1); }
function getHeadHTML2()     { return formatHTML(__HEAD2); }
function getTopHTML()       { return formatHTML(__TOP1); }
function getEmailHTML($method,$m) { 
    switch ($method) {
    case 0: return "";
    case 1: return formatHTML(__EMAIL1A.$m.__EMAIL1B.$m.__EMAIL1C); 
    case 2: return formatHTML(__EMAIL2A.$m.__EMAIL2B.$m.__EMAIL2C); 
    case 3: return formatHTML(__EMAIL3A.$m.__EMAIL3B.$m.__EMAIL3C); 
    case 4: return formatHTML(__EMAIL4A.$m.__EMAIL4B.$m.__EMAIL4C); 
    case 5: return formatHTML(__EMAIL5A.$m.__EMAIL5B); 
    case 6: return formatHTML(__EMAIL6A.$m.__EMAIL6B.$m.__EMAIL6C); 
    case 7: return formatHTML(__EMAIL7A.$m.__EMAIL7B.$m.__EMAIL7C); 
    case 8: return formatHTML(__EMAIL8A.$m.__EMAIL8B.$m.__EMAIL8C); 
    case 9: return formatHTML(__EMAIL9A.$m.__EMAIL9B.$m.__EMAIL9C); 
    }
    return formatHTML(__EMAIL10A.$m.__EMAIL10B.$m.__EMAIL10C); 
}
function getLegalHTML()   { return formatHTML(__LEGAL1.(getLegalContent()).__LEGAL2); }
function getStyleHTML()   { return formatHTML(__STYLE1); }
function getVanityHTML()  { return formatHTML(__VANITY1); }
function getBottomHTML()  { return formatHTML(__BOTTOM1); }

function readSettings() {
    $settings      = NULL;
    $settings_file = dirname(__FILE__)."/phpot_settings.php";

    if (is_file($settings_file) && is_readable($settings_file)) {
        $fp = fopen($settings_file,"r");
        $contents = "";
        while (!feof($fp)) {
            $contents .= fread($fp, 8192);
        }
        fclose($fp);

        $lines = explode("\n",$contents);
        foreach ($lines as $line) {
            if (trim($line) !== "") {
                list ($setting, $value) = @explode(":",$line,2);
                switch ($setting) {
                case "proxy_host": 
                    $settings["sock_host"] = trim($value);
                    break;
                case "proxy_port":
                    $settings["sock_port"] = trim($value);
                    break;
                }
                if (trim($value) !== "") {
                    $settings[trim($setting)] = trim($value);
                }
            }
        }
    }

    if (isset($settings["proxy_host"]) && isset($settings["proxy_port"]) && !isset($settings["use_proxy"])) {
        $settings["use_proxy"] = "1";
    } else {
        $settings["use_proxy"] = "0";
    }

    if (isset($settings["proxy_user"]) && isset($settings["proxy_pass"]) && !isset($settings["proxy_auth"])) {
        $settings["proxy_auth"] = "basic";
    } else {
        $settings["proxy_auth"] = "none";
    }

    if (!isset($settings["sock_host"])) $settings["sock_host"] = __REQUEST_HOST;
    if (!isset($settings["sock_port"])) $settings["sock_port"] = __REQUEST_PORT;

    return $settings;
}

function performRequest($request) {
    $response = "";

    $settings = readSettings();

    if ($settings["use_proxy"] == "1") {
        // POST via proxy
        $post_url = "http://".__REQUEST_HOST.":".__REQUEST_PORT.__REQUEST_SCRIPT;

        $head  = "POST ".$post_url." HTTP/1.0\r\n";
        //$head .= "Host: ".__REQUEST_HOST."\r\n";
        $head .= "User-Agent: PHPot ".__HPOT_TAG2."\r\n";
        if ($settings["proxy_auth"] == "basic") {
            $head .= "Proxy-Authorization: Basic ".base64_encode($settings["proxy_user"].":".$settings["proxy_pass"])."\r\n";
        }
        $head .= "Cache-Control: no-store, no-cache\r\n";
        $head .= "Accept: */*\r\n";
        $head .= "Pragma: no-cache\r\n";
        $head .= "Content-Type: application/x-www-form-urlencoded\r\n";
        $head .= "Content-Length: ".strlen($request)."\r\n";
        $head .= "Connection: close\r\n\r\n";

    } else {
        // POST directly
        $head  = "POST ".__REQUEST_SCRIPT." HTTP/1.1\r\n";
        $head .= "Host: ".__REQUEST_HOST."\r\n";
        $head .= "User-Agent: PHPot ".__HPOT_TAG2."\r\n";
        $head .= "Content-Type: application/x-www-form-urlencoded\r\n";
        $head .= "Content-Length: ".strlen($request)."\r\n";
        $head .= "Connection: close\r\n\r\n";
    }
    
    $errno  = NULL;
    $errstr = NULL;
    $fd = @fsockopen ($settings["sock_host"], $settings["sock_port"], $errno, $errstr, 20);

    if (!$fd) {
        // Socket Error
        die("\n<BR>Unable to contact the Server. Are outbound connections disabled? (If a proxy is required for outbound traffic, you may configure the honey pot to use a proxy. For instructions, visit http://www.projecthoneypot.org/settings_help.php)<BR>\n");
        return "-1";
    } else {

        fputs($fd,$head.$request);
        while(!feof($fd)) {
            $response .= fgets($fd,4096);
        }
        fclose($fd);
    }

    return $response;
}

function prepareRequest() {
    $postvars          = array();
    $postvars["tag1"]  = __HPOT_TAG1;
    $postvars["tag2"]  = __HPOT_TAG2;
    $postvars["tag3"]  = __HPOT_TAG3;
    if (!($handle = fopen(__FILE__,"r"))) {
        die("\n<BR>Unable to read contents of ".__FILE__." for hashing<BR>\n");
        return -2;
    }
    $contents = "";
    while (!feof($handle)) {
        $contents .= fread($handle, 8192);
    }
    fclose($handle);
    $postvars["tag4"]   = md5(ereg_replace("[^a-zA-Z0-9]","",$contents));
    $postvars["ip"]    = $_SERVER["REMOTE_ADDR"];
    $postvars["svrn"]  = $_SERVER["SERVER_NAME"];  
    $postvars["svp"]   = $_SERVER["SERVER_PORT"];  
    $postvars["svip"]  = isset($_SERVER["SERVER_ADDR"]) ? $_SERVER["SERVER_ADDR"] : "";
    $postvars["rquri"]   = isset($_SERVER["REQUEST_URI"]) ? $_SERVER["REQUEST_URI"] : "";
    $postvars["phpself"] = str_replace(' ','%20',$_SERVER["PHP_SELF"]);
    $postvars["version"] = "php-".phpversion();
    $postvars["sn"]     = str_replace(' ','%20',$_SERVER["SCRIPT_NAME"]);
    $postvars["ref"]    = isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : "";
    $postvars["uagnt"]  = isset($_SERVER["HTTP_USER_AGENT"]) ? $_SERVER["HTTP_USER_AGENT"] : "";
    if (isset($_POST) && count($_POST) > 0) {
        $postvars["has_post"] = count($_POST);
        for (reset($_POST);list($k,$v) = each($_POST);) {
            $postvars["post|".$k] = $v;
        }
        reset($_POST);
    }
    if (isset($_GET) && count($_GET) > 0) {
        $postvars["has_get"] = count($_GET);
        for (reset($_GET);list($k,$v) = each($_GET);) {
            $postvars["get|".$k] = $v;
        }
        reset($_GET);
    }

    return $postvars;
}

function transcribeResponse(& $response) {
    $settings  = NULL;
    $arr       = explode("\n",$response);
    $isParam   = FALSE;

    
    for ($i=0;list(,$v)=each($arr);$i++) {
        if ($v == "<END>")   $isParam = FALSE;

        if ($isParam) {          
            $pieces = explode("=",$v,2);
            $settings[$pieces[0]] = urldecode($pieces[1]);
        }
        if ($v == "<BEGIN>") $isParam = TRUE;
    }
    

    if ($settings["directives"]) {
        $settings["directives"] = explode(",",$settings["directives"]);
    }

    return $settings;
}

header("Cache-Control: no-store, no-cache");
header("Pragma: no-cache");

$response  = "";
$request   = "";
$post      = prepareRequest();

for (reset($post);list($k,$v) = each($post);) {
    $request .= "&".urlencode($k)."=".urlencode(stripslashes($v));
}
$request    = substr($request,1);
$response   = performRequest($request);
if ($response == "-1") {
    exit();
}
$settings   = transcribeResponse($response);

$directives   = $settings["directives"];
$email        = isset($settings["email"]) ? $settings["email"] : "";
$emailmethod  = isset($settings["emailmethod"]) ? $settings["emailmethod"] : 0;




?>
<?php echo (isset($directives[0]) && $directives[0]==1) ? getDocType()    : ""; ?>
<?php echo (isset($settings["injDocType"])) ? formatHTML($settings["injDocTypeMsg"]) : ""; ?>
<?php echo (isset($directives[1]) && $directives[1]==1) ? getHeadHTML1()   : ""; ?>
<?php echo (isset($settings["injHead1HTML"])) ? formatHTML($settings["injHead1HTMLMsg"]) : ""; ?>
<?php echo (isset($directives[8]) && $directives[8]==1) ? getRobotHTML()   : ""; ?>
<?php echo (isset($settings["injRobotHTML"])) ? formatHTML($settings["injRobotHTMLMsg"]) : ""; ?>
<?php echo (isset($directives[9]) && $directives[9]==1) ? getNoCollectHTML()   : ""; ?>
<?php echo (isset($settings["injNoCollectHTML"])) ? formatHTML($settings["injNoCollectHTMLMsg"]) : ""; ?>
<?php echo (isset($directives[1]) && $directives[1]==1) ? getHeadHTML2()   : ""; ?>
<?php echo (isset($settings["injHead2HTML"])) ? formatHTML($settings["injHead2HTMLMsg"]) : ""; ?>
<?php echo (isset($directives[2]) && $directives[2]==1) ? getTopHTML()    : ""; ?>
<?php echo (isset($settings["injTopHTML"])) ? formatHTML($settings["injTopHTMLMsg"]) : ""; ?>
<?php
   if (isset($settings["actMsgOn"])) { 
       echo formatHTML($settings["actMsg"]); 
   }
   if (isset($settings["errMsgOn"])) { 
       echo formatHTML($settings["errMsg"]); 
   }
   if (isset($settings["customMsgOn"])) { 
       echo formatHTML($settings["customMsg"]); 
   }
?>
<?php echo (isset($directives[3]) && $directives[3]==1) ? getLegalHTML()  : ""; ?>
<?php echo (isset($settings["injLegalHTML"])) ? formatHTML($settings["injLegalHTMLMsg"]) : ""; ?>
<?php
   if (isset($settings["altLegalOn"])) { 
       echo formatHTML($settings["altLegalMsg"]); 
   } 
?>
<?php echo (isset($directives[4]) && $directives[4]==1) ? getEmailHTML(intval($emailmethod),$email)  : ""; ?>
<?php echo (isset($settings["injEmailHTML"])) ? formatHTML($settings["injEmailHTMLMsg"]) : ""; ?>
<?php echo (isset($directives[5]) && $directives[5]==1) ? getStyleHTML()  : ""; ?>
<?php echo (isset($settings["injStyleHTML"])) ? formatHTML($settings["injStyleHTMLMsg"]) : ""; ?>
<?php echo (isset($directives[6]) && $directives[6]==1) ? getVanityHTML() : ""; ?>
<?php echo (isset($settings["injVanityHTML"])) ? formatHTML($settings["injVanityHTMLMsg"]) : ""; ?>
<?php
   if (isset($settings["altVanityOn"])) {
        echo formatHTML($settings["altVanityMsg"]);
    }
?>
<?php echo (isset($directives[7]) && $directives[7]==1) ? getBottomHTML() : ""; ?>
<?php echo (isset($settings["injBottomHTML"])) ? formatHTML($settings["injBottomHTMLMsg"]) : ""; ?>
