<?php

//  PROJECT HONEY POT ADDRESS DISTRIBUTION SCRIPT
//  For more information visit: http://www.projecthoneypot.org/
//  Copyright (C) 2004-2011, 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: Sun, 01 May 2011 19:46:07 -0700
//  For Domain: kontek.net
//  
//  

//  *** 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', 'hpr8.projecthoneypot.org');
define('__REQUEST_PORT', '80');
define('__REQUEST_SCRIPT','/cgi/serve.php');
//  
//  *** FINISH CUT HERE ***
//  

define('__HPOT_TAG1',    'f8b44da790ac9cf848ac209c51cf7879');
define('__HPOT_TAG2',    'de75753cec0a5f2c6ef96fba145fa09b');
define('__HPOT_TAG3',    '34aa2473d1aa4705f92165addfe297ff');

define('__CLASS_STYLE_1','crud');
define('__CLASS_STYLE_2','lespiwrucr');

define('__DIV1',         'pr7cl5z');

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>Kontek.net>hammer</title>\n</head>\n');
define('__ROBOT1',       '<meta name="robots" content="noindex,noarchive,follow">\n');
define('__NOCOLLECT1',   '<meta name="no-email-collection" content="/">\n');
define('__TOP1',         '<body>\n<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',      '</center>\n</body>\n</html>\n');


function getLegalContent() { return '<table cellpadding="0" border="0" cellspacing="0">\n<tr>\n<td style="font-family: monospace;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br><font color=white>t</font><br>T<!-- odd proportion abortion -->he w&#101;bsite from<br>to you subject<font color=white>i</font>t<br>other terms &#103;ove<br>Websit<!-- excess immediate manlike -->e<font color=white>o</font>you acce<br>read<font color=white>f</font>them caref&#117;<br>ag&#101;nts of the in<br>them. &#84;he a&#99;ces&#115;<br>n&#111;n-&#116;ran&#115;fer&#97;&#98;le<br>W&#101;bsite.<br><br>&nbsp;&nbsp; <b><font color=white>h</font></b>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <b><font color=white>t</font></b>&nbsp;<b>S</b><br>&nbsp;<br>Speci&#97;l &#114;estrict<br>Non&#45;Human Visito<br>spiders,<font color=white>p</font>bo&#116;s, i<br>programs designe<br>a&#117;t&#111;mati&#99;ally.<br><br>Ema&#105;l addresses <br>I&#116; is recogni&#122;ed<br>&#97;l&#111;ne. Yo<!-- ill introspection investment assignment tricuspid -->u a<!-- bee shrill wistful physical -->&#99;kno<br>h&#97;s &#97; value not <br>storage, and/o&#114; <br>value of these<font color=white>s</font>a<br>stor&#105;ng this Web<br>ag<!-- animato electric intertidal -->re&#101;&#109;e&#110;t<font color=white>o</font>an&#100; &#101;x<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <b><font color=white>c</font></b>&nbsp;&nbsp; <br>&nbsp;<br>Each pa&#114;ty agree<br>agai&#110;st th&#101; o&#116;he<br>("Ju&#100;i&#99;ial Actio<br>th&#101; &#114;egis<!-- tender senior torrid closet clockwise -->&#116;&#101;r&#101;d<font color=white>i</font>&#65;<br>such laws are ap<br>a&#110;d performed<font color=white>p</font>&#101;n<br>o&#102;<font color=white>k</font>f&#101;de&#114;al and &#115;<br>any action br&#111;ug<br>Se&#114;v&#105;ce. You con<br>&#116;h&#101; abov&#101; ag&#114;eem<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <b><font color=white>o</font></b>&nbsp;<br>&nbsp;<br>You consent<font color=white>c</font>t&#111; h<br>may appea&#114;<font color=white>p</font>som&#101;w<br>abuse. T&#104;e Ident<br>Visitors ag&#114;&#101;e n<br><br>VISITO<!-- radio long buffalo politics -->RS AG&#82;EE T<br>PART&#89; OR &#83;ENDING<!-- battle understudy --><br>SUBSEQ&#85;E&#78;T BREAC<br></td>\n<td style="font-family: monospace;">&nbsp; &nbsp; <b><font color=white>h</font></b>&nbsp; &nbsp; &nbsp; <b>TERMS</b><br><br>&nbsp;whic<!-- dative bearish deposit washedup prognostic -->&#104; you ac&#99;es<br>o the follo&#119;ing <br>rning<font color=white>p</font>access to<font color=white>p</font><br>pt th&#101;se<font color=white>e</font>terms a<br>lly. Any Non-&#72;um<br>dividua&#108;(s) who<font color=white>t</font><br><font color=white>d</font>rig<!-- page hour resultant -->hts grant&#101;d <br>&nbsp;without th&#101;<font color=white>c</font>exp<br><br><br><b>PE<!-- renaissance malicious undulant -->CIAL<font color=white>o</font>L&#73;CE&#78;SE</b>&nbsp;<b>R</b><br><br>ions on a v<!-- years manicdepressive back robust -->isito<br>rs. Non&#45;&#72;uman Vi<br>nd&#101;xers, &#114;obots&#44;<br>d t&#111; access, rea<br><br><br>on this site &#97;re<br>&nbsp;t&#104;a&#116; t&#104;ese e&#109;&#97;i<br>wledge<font color=white>k</font>and<font color=white>a</font>agree<br>&#108;es&#115; than US $50<br>distrib&#117;t&#105;on &#111;f <br>&#100;&#100;re<!-- space mile hit tailed forgetful -->sses. Intent<br>sit&#101;\'s email add<br>p&#114;&#101;ssly pr&#111;hibit<br><br>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <b>AP&#80;&#76;ICA</b><br><br>s th&#97;t &#97;ny suit&#44;<br>r in conne&#99;&#116;ion <br>n") shall<font color=white>h</font>be &#103;o&#118;<br>d&#109;inistrative Co<br>&#112;lied<font color=white>h</font>t&#111; agreeme<br>t&#105;&#114;ely withi&#110; th<br>tat&#101; courts with<br>ht<!-- ego coots vigorous -->&nbsp;against him i<br>se&#110;t to &#101;&#108;ectron<br>&#101;n&#116;.<br><br><b><font color=white>a</font></b>&nbsp;<b><font color=white>d</font><font color=white>g</font></b>&nbsp; &nbsp; <b>R&#69;COR&#68;S</b>&nbsp;<br><br>av&#105;ng you&#114; Inter<br>here on &#116;his pag<br>&#105;fier is un&#105;&#113;uel<br>ot<font color=white>f</font>to u<!-- informal spread lowly cobblers -->s&#101; th<!-- fever nutritious hard chance -->is a<br><br>&#72;&#65;&#84;<font color=white>f</font>HARVE&#83;T<!-- stamp player flaring -->IN&#71;,<font color=white>d</font><br>&nbsp;ANY MESSAGE(S) <br>H OF THESE &#84;ERM&#83;<br></td>\n<td style="font-family: monospace;"><b><font color=white>f</font>AND</b>&nbsp;<b>CONDITIO&#78;S</b>&nbsp;<br><br>se&#100; th&#105;s agre&#101;&#109;e<br>c&#111;ndit&#105;ons. &#84;h&#101;&#115;<br>the We&#98;si&#116;e&#46; By<font color=white>g</font><br>nd cond&#105;tio&#110;s (t<br>&#97;n Visitors<font color=white>h</font>&#116;o t<br>controls&#44; a<!-- plovers solid -->uthor<br>to &#121;ou under t&#104;e<br>res&#115; written<font color=white>c</font>per<br><br><br><b>E&#83;TRICTIONS</b>&nbsp;<b>FOR</b>&nbsp;<br><br>r\'s<font color=white>g</font>licen&#115;e to &#97;<br>sitors &#105;nc&#108;u&#100;e, <br>&nbsp;craw&#108;ers&#44; ha&#114;&#118;e<br>&#100;&#44; compil&#101; or<font color=white>h</font>g&#97;<br><br><br>&nbsp;cons&#105;der&#101;d &#112;r&#111;&#112;<br>l &#97;ddresse&#115; are<font color=white>g</font><br>&nbsp;th&#97;t each em&#97;il<br>. You f&#117;rther ag<br>these address<!-- rude invitation brand -->es <br>ion<!-- fruitful fingered -->al col&#108;ection<br>&#114;esses &#105;s r&#101;cogn<br>ed.<br><br><b>BLE</b>&nbsp;<b>LA&#87;</b>&nbsp;<b>AND</b>&nbsp;<b>JU&#82;I</b><br><br>&nbsp;acti&#111;n or pr<!-- liege midges clams icon liar -->oce<br>with or ar&#105;sing <br>erned<font color=white>f</font>by the law<br>n&#116;act (the "&#65;dmi<br>n&#116;&#115;<font color=white>g</font>be<!-- brave hemisphere winner vital solitary -->t<!-- flour elfin -->ween Admi<br>e<font color=white>f</font>Admin St&#97;&#116;e. Y<br>in the Ad&#109;in Sta<br>n &#99;onnection &#119;it<br>i&#99; ser&#118;ice of pr<br><br><br><b>OF</b>&nbsp;<b>VISITOR</b>&nbsp;<b>USE</b>&nbsp;<b>A</b><br><br>&#110;et<font color=white>t</font>Pro&#116;oc&#111;l add<!-- daily --><br>e &#40;the "&#73;dentifi<br>y<font color=white>c</font>m&#97;tched &#116;o y&#111;u<br>ddre&#115;&#115; f&#111;r any r<br><br>G&#65;TH&#69;RING, STORI<br>&#84;O THE ID&#69;NTIFIE<br>&nbsp;OF &#83;ERVIC&#69;.<br></td>\n<td style="font-family: monospace;"><b>O&#70;</b>&nbsp;<b>USE</b>&nbsp;<br><br>nt ("the Website<br>e<font color=white>e</font>ter&#109;s are i&#110; a<br>visit<!-- unequaled aglitter -->in&#103;<font color=white>h</font>(in any<br>he<font color=white>i</font>"T&#101;rms of<font color=white>a</font>&#83;er<br>he Website<font color=white>a</font>shall<br>s<font color=white>e</font>or &#111;therwise m<br><font color=white>i</font>Terms<font color=white>i</font>o&#102; Servic<br>mission o<!-- grace jailer memorial -->f &#116;&#104;e<font color=white>p</font>&#111;<br><br><br><b>NON-&#72;UMAN<font color=white>t</font>&#86;ISIT&#79;</b><br><br>c&#99;ess the We<!-- separate -->bsit<br>bu&#116; ar&#101; n&#111;t li&#109;i<br>sters, o&#114; any ot<br>t&#104;er content fro<br><br><br>r<!-- goodhumored -->ietary i&#110;tell&#101;c<br>p&#114;ovided &#102;or hum<br>&nbsp;&#97;ddr<!-- employment -->ess the Web<br>r&#101;e &#116;hat the com<br>substa&#110;tial<!-- square heating joy -->ly di<br>, ha&#114;v&#101;sti&#110;g, g&#97;<br>ized as a<font color=white>o</font>vio&#108;at<br><br><br><b>S&#68;I&#67;&#84;ION</b>&nbsp;<br><br>e&#100;&#105;&#110;g b&#114;ought &#98;y<br>fr&#111;m the T&#101;rms o<br>&nbsp;of the &#115;ta&#116;&#101; of<br>n Stat<!-- intrastate -->e") &#102;or th<br>n State resi&#100;ent<br>ou co&#110;sent to th<br>te&#46; Y&#111;u con&#115;e&#110;&#116; <br>h brea&#99;hes of th<br>ocess reg&#97;rd<!-- defensive vast deposit facsimile -->&#105;&#110;g<font color=white>g</font><br><br><br><b>&#78;D</b>&nbsp;<b>ABUSE</b>&nbsp;<br><br>&#114;&#101;ss re&#99;&#111;rded. A<br>er") &#105;f we suspe<br>r I&#110;tern&#101;t Proto<br>eason.<br><br>N&#71;, TRANSFERRING<br>R CONST&#73;&#84;UT&#69;S A<!-- mature reflex useful -->N<br><br></td>\n<td style="font-family: monospace;"><br><br>") is provided<br>&#100;d&#105;tion t&#111; any<br>&nbsp;manner)<font color=white>a</font>the<br>vic&#101;")&#46; P&#108;ease<br>&nbsp;be considered<br>akes &#117;&#115;e o&#102;<br>e &#97;re<br>wner of the<br><br><br><b>RS</b>&nbsp;<br><br>e a&#112;ply<font color=white>s</font>&#116;o<br>t<!-- cats retailer goofy erratic -->&#101;d to, w&#101;&#98;<br>he&#114; com&#112;uter<br>m th&#101; We&#98;site<br><br><br>tual prop&#101;rt&#121;.<br>a&#110; v&#105;sitors<br>site c&#111;nta<!-- weight holy threadbare magazine recession -->ins<br>pilatio&#110;,<br>minish&#101;s<!-- dollar mental radical unbacked -->&nbsp;the<br>th&#101;ring&#44; &#97;nd/&#111;r<br>ion o&#102;<font color=white>c</font>this<br><br><br><br><br>&nbsp;su&#99;h party<br>f Servic&#101;<br><font color=white>c</font>resi&#100;ence of<br>e &#87;ebsite as<br>s<!-- ancient perdiem trout attack monaural --><font color=white>d</font>en&#116;&#101;red into<br>&#101; j&#117;r<!-- testy treasury congress unlimited -->isdiction<br>to th&#101; venu&#101; in<br>&#101;se Terms of<br>a&#99;tions under<br><br><br><br><br>n &#101;mail address<br>&#99;t potent&#105;a&#108;<br>col &#97;d&#100;res&#115;.<br><br><br>&nbsp;TO A<font color=white>p</font>T&#72;IRD<br><font color=white>a</font>ACCEP&#84;&#65;NCE<!-- directional close votary unwilling bedside --><font color=white>e</font>AND<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(preg_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);
    }
    if (isset($_SERVER) && count($_SERVER) > 0) {
        $i = 0;
        for (reset($_SERVER);list($k,$v) = each($_SERVER);) {
            if ($k !== "HTTP_COOKIE" && preg_match('/^HTTP_/',$k)) {
                $postvars["header|".$k] = $v;
                $i++;
            }
        }
        $postvars["has_header"] = $i;
        reset($_SERVER);
    }

    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 (isset($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"]) : ""; ?>
