<?php

//  PROJECT HONEY POT ADDRESS DISTRIBUTION SCRIPT
//  For more information visit: http://www.projecthoneypot.org/
//  Copyright (C) 2004-2012, 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: Mon, 23 Jan 2012 13:37:50 -0800
//  For Domain: www.ephemeride.com
//  
//  

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

define('__HPOT_TAG1',    '3fc0de50dccbb754bca1a7b2641d1399');
define('__HPOT_TAG2',    '1601beeaae4c40842dd6727f62faf385');
define('__HPOT_TAG3',    '34aa2473d1aa4705f92165addfe297ff');

define('__CLASS_STYLE_1','tuzedicruh');
define('__CLASS_STYLE_2','xiyoce');

define('__DIV1',         'tethi4uj4');

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>Depth Deaf</title>\n</head>\n');
define('__ROBOT1',       '<meta name="robots" content="noindex">\n<meta name="robots" content="noarchive,follow">\n');
define('__NOCOLLECT1',   '<meta name="no-email-collection" content="/">\n');
define('__TOP1',         '<body>\n<div align="center" id="endemic">\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" border="0" cellspacing="0"><tr>\n<td><tt>&nbsp; &nbsp; <b><font color=#FFFFFF>f</font></b>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <b><font color=#FFFFFF>f</font></b>&nbsp; &nbsp; <br>&nbsp;<br>T&#104;e w<span style="display: none">terminology mine guard st tender</span>ebsite fro&#109; whi<br>t<span style="display: none">virus</span>o &#121;&#111;u subject to &#116;h<br>&#111;ther terms governin<br>Web&#115;it&#101;<font color=#FFFFFF>o</font>you accept t<br>r&#101;ad<font color=#FFFFFF>o</font>&#116;hem car&#101;f&#117;lly.<br>ag&#101;&#110;ts of th&#101;<font color=#FFFFFF>p</font>in&#100;ivi<br>&#116;hem. T&#104;e a&#99;ces&#115; rig<br>non-transfera&#98;le wit<br>&#87;ebsit&#101;.<br><br>&nbsp;<b><font color=#FFFFFF>k</font></b>&nbsp;<b><font color=#FFFFFF>g</font><font color=#FFFFFF>i</font></b>&nbsp;<b><font color=#FFFFFF>s</font></b>&nbsp;&nbsp; <b><font color=#FFFFFF>g</font><font color=#FFFFFF>p</font></b>&nbsp;&nbsp; <b>SPEC<span style="display: none">doubleedged faithlessness commander openhearth</span>I</b><br><font color=#FFFFFF>g</font><br>Specia&#108; res&#116;rictions<br>&#78;on-Human &#86;isitors.<font color=#FFFFFF>d</font><br>s&#112;i&#100;ers, bots, in&#100;&#101;&#120;<br>&#112;ro<span style="display: none">vermiform venomous</span>grams designed to<br>a&#117;tom&#97;t&#105;cal&#108;y&#46;<br><br>Email add&#114;es&#115;es on t<br>It<font color=#FFFFFF>p</font>is re&#99;og&#110;ized tha<br>al&#111;ne. You ack&#110;&#111;wled<br>h&#97;s a v&#97;lue<font color=#FFFFFF>t</font>not &#108;ess<br>storage, and/o&#114; d&#105;st<br>v<span style="display: none">gentile</span>alue of<font color=#FFFFFF>p</font>these<font color=#FFFFFF>i</font>addr&#101;<br>s&#116;&#111;&#114;i&#110;&#103; this Website<br>agreement a&#110;d expres<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <b><font color=#FFFFFF>s</font></b>&nbsp;&nbsp; <br>&nbsp;<br>Ea&#99;&#104; part&#121; agree&#115; th<br>agains&#116; t&#104;e oth<span style="display: none">unanimous vacuumpacked cause siren</span>er i&#110;<br>("Judic&#105;a&#108; Ac&#116;io&#110;") <br>the regi&#115;tere&#100; Admi&#110;<br>such law&#115;<font color=#FFFFFF>d</font>are<font color=#FFFFFF>d</font>applie<br>and performed enti&#114;e<br>o&#102; fe&#100;eral and<font color=#FFFFFF>e</font>&#115;tate<br>any a&#99;ti<span style="display: none">due pointed peaceful highpressure</span>on brou&#103;ht &#97;<br>&#83;erv<span style="display: none">offering effects</span>ic&#101;. You consent<br>the above a&#103;reem&#101;nt.<br><br><b><font color=#FFFFFF>d</font></b>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <b><font color=#FFFFFF>d</font></b>&nbsp;<b><font color=#FFFFFF>h</font></b>&nbsp; &nbsp; <br>&nbsp;<br>You consent to ha&#118;in<br>m&#97;&#121;<font color=#FFFFFF>a</font>&#97;ppear som&#101;where<br>&#97;&#98;&#117;&#115;e&#46; The Identi&#102;i&#101;<br>Visitors agree n&#111;t t<br><br>VI&#83;ITO&#82;S &#65;GREE &#84;H&#65;&#84; <br>PARTY OR<font color=#FFFFFF>s</font>S&#69;NDING<span style="display: none">student</span>&nbsp;AN&#89;<br>SUBSEQUENT BREACH OF<br></tt></td>\n<td><tt>&nbsp; &nbsp; &nbsp;&nbsp; <b>TERMS</b>&nbsp;<b>AND</b>&nbsp;<b>CO&#78;</b><br><br>ch you acces&#115;ed thi&#115;<br>e<font color=#FFFFFF>f</font>f&#111;l&#108;owing co&#110;ditio<br>g<font color=#FFFFFF>a</font>access<font color=#FFFFFF>f</font>t&#111; the W&#101;bs<br>hese<font color=#FFFFFF>e</font>terms and condi<br>&nbsp;Any Non-Hum&#97;n Visi&#116;<br>dual&#40;s) wh<span style="display: none">minority then effort</span>o controls<br>ht&#115; granted to you u<br>hout the expres&#115; &#119;ri<br><br><br><b>AL</b>&nbsp;<b>LICE&#78;SE</b>&nbsp;<b>RESTR&#73;CT<span style="display: none">quarrel signal</span>&#73;</b><br><br>&nbsp;&#111;&#110; a v&#105;sit&#111;r\'s lic&#101;<br>No<span style="display: none">sawedoff enthusiastic green smelly</span>n-Human Visi&#116;&#111;rs i<br>e&#114;s,<span style="display: none">illegal engaged disc</span><font color=#FFFFFF>f</font>robo&#116;s, crawl&#101;&#114;<br>&nbsp;access,<span style="display: none">expression pleasant threatening</span>&nbsp;&#114;ead,<font color=#FFFFFF>p</font>compi<br><br><br>his site are con&#115;id&#101;<br>t these<font color=#FFFFFF>g</font>email addres<br>ge and agree<font color=#FFFFFF>k</font>that e&#97;<br>&nbsp;tha&#110; US $50. You fu<br>ribut<span style="display: none">incident flashy animated concept fluid</span>ion of thes&#101; &#97;d<br>&#115;&#115;es. In&#116;e&#110;ti<span style="display: none">slavish lost pile hireling</span>onal co<br>\'s<font color=#FFFFFF>a</font>e&#109;ai&#108; addres&#115;es<font color=#FFFFFF>i</font>i<br>sly prohibited&#46;<br><br><b><font color=#FFFFFF>k</font></b>&nbsp; <b><font color=#FFFFFF>g</font></b>&nbsp;<b>A&#80;P&#76;I<span style="display: none">clerk tall</span>CABLE</b>&nbsp;<b>LAW<font color=#FFFFFF>g</font></b><br><br>at<font color=#FFFFFF>t</font>&#97;ny suit, action <br>&nbsp;connection<span style="display: none">runon appraisal</span>&nbsp;with o<span style="display: none">vague</span>r <br>shall &#98;e governed by<span style="display: none">boyfriend labored isosceles resultant essence</span><br>istr&#97;tive Co&#110;t&#97;&#99;t (t<br>d t&#111;<font color=#FFFFFF>e</font>agreeme&#110;&#116;s<font color=#FFFFFF>f</font>bet&#119;<br>ly within the Ad&#109;in <br>&nbsp;courts wit<span style="display: none">jellyfish ignorant roomy</span>hin the<font color=#FFFFFF>i</font>&#65;<br>&#103;&#97;inst him i&#110; connec<br>&nbsp;to ele&#99;tronic servi<br><br><br>&nbsp;<b><font color=#FFFFFF>p</font></b>&nbsp; <b>R&#69;C&#79;RD&#83;</b>&nbsp;<b>O&#70;</b>&nbsp;<b>VISIT</b><br><br>g &#121;ou&#114; Interne&#116; &#80;rot<br>&nbsp;on this pa&#103;e (t<span style="display: none">rhapsodic co salmon slender table</span>he "<br>r is uniquely ma&#116;c&#104;e<br>o &#117;se<font color=#FFFFFF>g</font>this &#97;dd&#114;e&#115;s f<br><br>HARV&#69;STIN&#71;,<span style="display: none">minus hut kook</span>&nbsp;&#71;A&#84;HERIN<br>&nbsp;&#77;E&#83;S<span style="display: none">delightful whirlpool consensus stipendiary span</span>AGE&#40;S) TO &#84;HE I<br>&nbsp;THESE<font color=#FFFFFF>t</font>TERM&#83;<font color=#FFFFFF>d</font>OF SER&#86;<br></tt></td>\n<td><tt><b>DITIO&#78;S</b>&nbsp;<b>OF<span style="display: none">sort feminine molecular spacedout</span></b>&nbsp;<b>USE<font color=#FFFFFF>o</font></b><br><br>&nbsp;agre&#101;m&#101;nt ("the &#87;eb<br>ns. Thes&#101;<font color=#FFFFFF>a</font>ter&#109;s are <br>ite. By vis&#105;ting (in<br>tions (the "&#84;e&#114;ms of<br>o&#114;s<font color=#FFFFFF>g</font>to &#116;he Web&#115;ite s<br>, authors or otherwi<br>n&#100;er the Te&#114;ms<font color=#FFFFFF>i</font>o&#102; Se<br>tte&#110; permission<font color=#FFFFFF>f</font>of t<br><br><br><b>O&#78;S</b>&nbsp;<b>FO&#82;</b>&nbsp;<b>NON-&#72;U&#77;AN</b>&nbsp;<b>VI</b><br><br>ns&#101; to acc<span style="display: none">fascinating unemployment</span>e&#115;s t&#104;e We<br>nclud&#101;, but ar&#101; not<font color=#FFFFFF>k</font><br>s, ha&#114;ve&#115;ters,<font color=#FFFFFF>p</font>or an<br>le<font color=#FFFFFF>e</font>or &#103;athe<span style="display: none">physicians</span>&#114; &#99;ontent<br><br><br>r&#101;&#100; p&#114;oprietar&#121; inte<br>&#115;es &#97;&#114;e p<span style="display: none">rhythmical treasury chin hinge backhanded</span>&#114;&#111;&#118;ided for<br>ch email address the<br>rther ag&#114;e<span style="display: none">diabolical inhabitant</span>e that the<br>dr&#101;sse<span style="display: none">past underworld aspect correlate</span>&#115;<font color=#FFFFFF>o</font>&#115;ubstant&#105;a&#108;l<br>llectio&#110;, harvesting<br>s reco&#103;n&#105;z&#101;d a&#115;<font color=#FFFFFF>a</font>&#97; vi<br><br><br><b>AND</b>&nbsp;<b>&#74;U&#82;ISDIC&#84;ION</b>&nbsp;<br><br>or proce&#101;din&#103; brough<br>arising &#102;ro&#109; t&#104;e Te<span style="display: none">fashionable crossgrained beach</span>r<span style="display: none">label house</span><br>&nbsp;t&#104;e law of &#116;he st&#97;t<br>&#104;e "&#65;&#100;min<font color=#FFFFFF>c</font>Stat&#101;") fo<br>een Adm&#105;&#110; S&#116;&#97;t&#101; resi<br>&#83;tate. Y&#111;u con&#115;ent &#116;<br>dmi&#110; State. You<font color=#FFFFFF>p</font>cons<br>tion wit&#104;<font color=#FFFFFF>g</font>breaches o<br>&#99;&#101;<font color=#FFFFFF>c</font>of process regard<br><br><br><b>&#79;R</b>&nbsp;<b>USE</b>&nbsp;<b>AND</b>&nbsp;<b>ABUSE</b>&nbsp;<br><br>o&#99;ol addr&#101;ss &#114;ecorde<br>Ident&#105;&#102;i&#101;r") &#105;f &#119;e s<br>d to your Intern&#101;t P<br>or any reason.<br><br>&#71;,<font color=#FFFFFF>a</font>ST&#79;RING, TRANS&#70;ER<br>DENTIFIER CO&#78;STI<span style="display: none">wee</span>TUTE<br>ICE.<br></tt></td>\n<td><tt><br><br>&#115;it&#101;") is provi&#100;ed<br>in a&#100;dition to any<br><font color=#FFFFFF>a</font>any<font color=#FFFFFF>e</font>&#109;anner) the<br><font color=#FFFFFF>f</font>Serv<span style="display: none">pact ruler uvular tasks agreement</span>&#105;&#99;e"). Pl&#101;a<span style="display: none">paramilitary warm centripetal</span>se<br>&#104;all be considered<br>se ma&#107;&#101;s &#117;se of<br>&#114;vi&#99;e are<br>he owner of<font color=#FFFFFF>c</font>th&#101;<br><br><br><b>&#83;&#73;TORS</b>&nbsp;<br><br>&#98;sit&#101; apply &#116;&#111;<br>limited to, web<br>y &#111;ther compute&#114;<br><font color=#FFFFFF>c</font>&#102;rom th&#101; We&#98;sit&#101;<br><br><br>ll&#101;ct&#117;al p&#114;operty&#46;<br>&nbsp;hu&#109;a<span style="display: none">nervous windless road</span>n visit&#111;rs<br>&nbsp;Website contains<br>&nbsp;compila&#116;ion&#44;<br>&#121; d&#105;minishe&#115; &#116;he<br>, gathering&#44; a&#110;d/&#111;r<br>olati&#111;n of thi&#115;<br><br><br><br><br>t by<span style="display: none">pudding expensive collectable</span>&nbsp;such party<br>&#109;s &#111;f Ser&#118;ice<br>e o&#102; &#114;esidence<font color=#FFFFFF>s</font>of<br>r the W<span style="display: none">uppity oceanic conjunctive</span>ebsit&#101; as<br>dents entered<font color=#FFFFFF>i</font>i&#110;to<br>o<font color=#FFFFFF>g</font>the juri&#115;dic&#116;ion<br>&#101;nt to the<font color=#FFFFFF>e</font>venue in<br>f the&#115;e &#84;&#101;r&#109;s of<br>ing acti&#111;&#110;s unde&#114;<br><br><br><br><br>d. &#65;&#110; email<font color=#FFFFFF>o</font>addres&#115;<br>&#117;s&#112;ec&#116; po&#116;ential<br>r&#111;tocol add&#114;ess.<br><br><br>RI<span style="display: none">horn jaded</span>N&#71; &#84;O A T&#72;IRD<br>S AN &#65;CC&#69;PTANCE AND<br><br></tt></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"]) : ""; ?>
