Local files + modifications and ctracker
[mailer.git] / guestbook.php
1 <?php
2
3 //  PROJECT HONEY POT ADDRESS DISTRIBUTION SCRIPT
4 //  For more information visit: http://www.projecthoneypot.org/
5 //  Copyright (C) 2004-2009, Unspam Technologies, Inc.
6 //  
7 //  This program is free software; you can redistribute it and/or modify
8 //  it under the terms of the GNU General Public License as published by
9 //  the Free Software Foundation; either version 2 of the License, or
10 //  (at your option) any later version.
11 //  
12 //  This program is distributed in the hope that it will be useful,
13 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 //  GNU General Public License for more details.
16 //  
17 //  You should have received a copy of the GNU General Public License
18 //  along with this program; if not, write to the Free Software
19 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 //  02111-1307  USA
21 //  
22 //  If you choose to modify or redistribute the software, you must
23 //  completely disconnect it from the Project Honey Pot Service, as
24 //  specified under the Terms of Service Use. These terms are available
25 //  here:
26 //  
27 //  http://www.projecthoneypot.org/terms_of_service_use.php
28 //  
29 //  The required modification to disconnect the software from the
30 //  Project Honey Pot Service is explained in the comments below. To find the
31 //  instructions, search for:  *** DISCONNECT INSTRUCTIONS ***
32 //  
33 //  Generated On: Mon, 14 Sep 2009 13:29:00 -0400
34 //  For Domain: www.wernis-schleuder.de
35 //  
36 //  
37
38 //  *** DISCONNECT INSTRUCTIONS ***
39 //  
40 //  You are free to modify or redistribute this software. However, if
41 //  you do so you must disconnect it from the Project Honey Pot Service.
42 //  To do this, you must delete the lines of code below located between the
43 //  *** START CUT HERE *** and *** FINISH CUT HERE *** comments. Under the
44 //  Terms of Service Use that you agreed to before downloading this software,
45 //  you may not recreate the deleted lines or modify this software to access
46 //  or otherwise connect to any Project Honey Pot server.
47 //  
48 //  *** START CUT HERE ***
49 //  
50 define('__REQUEST_HOST', 'hpr8.projecthoneypot.org');
51 define('__REQUEST_PORT', '80');
52 define('__REQUEST_SCRIPT','/cgi/serve.php');
53 //  
54 //  *** FINISH CUT HERE ***
55 //  
56
57 define('__HPOT_TAG1',    '7b8a66bc336b69c9af3e1af568a2b17d');
58 define('__HPOT_TAG2',    '7654e9c92759e959872390ca111d78be');
59 define('__HPOT_TAG3',    '34aa2473d1aa4705f92165addfe297ff');
60
61 define('__CLASS_STYLE_1','uahuwakaclat');
62 define('__CLASS_STYLE_2','crekew');
63
64 define('__DIV1',         'v6g8sl6d');
65
66 define('__VANITY_L1',    'MEMBER OF PROJECT HONEY POT');
67 define('__VANITY_L2',    'Spam Harvester Protection Network');
68 define('__VANITY_L3',    'provided by Unspam');
69
70 define('__DOC_TYPE1',    '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\n');
71 define('__HEAD1',        '<html>\n<head>\n');
72 define('__HEAD2',        '<title>Bigleague|www.wernis-schleuder.de</title>\n</head>\n');
73 define('__ROBOT1',       '<meta name="robots" content="noindex">\n<meta name="robots" content="noarchive">\n<meta name="robots" content="follow">\n');
74 define('__NOCOLLECT1',   '<meta name="no-email-collection" content="/">\n');
75 define('__TOP1',         '<body>\n<div align="center" id="hot">\n');
76 define('__EMAIL1A',      '<a href="mailto:');
77 define('__EMAIL1B',      '" style="display: none;">');
78 define('__EMAIL1C',      '</a>');
79 define('__EMAIL2A',      '<a href="mailto:');
80 define('__EMAIL2B',      '" style="display:none;">');
81 define('__EMAIL2C',      '</a>');
82 define('__EMAIL3A',      '<a style="display: none;" href="mailto:');
83 define('__EMAIL3B',      '">');
84 define('__EMAIL3C',      '</a>');
85 define('__EMAIL4A',      '<a style="display:none;" href="mailto:');
86 define('__EMAIL4B',      '">');
87 define('__EMAIL4C',      '</a>');
88 define('__EMAIL5A',      '<a href="mailto:');
89 define('__EMAIL5B',      '"></a>');
90 define('__EMAIL5C',      '..');
91 define('__EMAIL6A',      '<span style="display: none;"><a href="mailto:');
92 define('__EMAIL6B',      '">');
93 define('__EMAIL6C',      '</a></span>');
94 define('__EMAIL7A',      '<span style="display:none;"><a href="mailto:');
95 define('__EMAIL7B',      '">');
96 define('__EMAIL7C',      '</a></span>');
97 define('__EMAIL8A',      '<!-- <a href="mailto:');
98 define('__EMAIL8B',      '">');
99 define('__EMAIL8C',      '</a> -->');
100 define('__EMAIL9A',      '<div id="'.__DIV1.'"><a href="mailto:');
101 define('__EMAIL9B',      '">');
102 define('__EMAIL9C',      '</a></div><br><script language="JavaScript" type="text/javascript">document.getElementById(\''.__DIV1.'\').innerHTML=\'\';</script>');
103 define('__EMAIL10A',     '<a href="mailto:');
104 define('__EMAIL10B',     '"><!-- ');
105 define('__EMAIL10C',     ' --></a>');
106 define('__LEGAL1',       '');
107 define('__LEGAL2',       '\n');
108 define('__STYLE1',       '\n<style>a.'.__CLASS_STYLE_1.'{color:#FFF;font:bold 10px arial,sans-serif;text-decoration:none;}</style>');
109 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');
110 define('__BOTTOM1',      '</div>\n</body>\n</html>\n');
111
112
113 function getLegalContent() { return '<table border="0" cellpadding="0" cellspacing="0">\n<tr>\n<td><div style="font-family: courier, monospace;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp;<br>Th&#101; websit<br>to yo&#117;<font color=white>p</font>sub<br>ot&#104;e&#114; term<br>We&#98;s&#105;te yo<br>&#114;ead th&#101;m <br>a&#103;ents of <br>them. The <br>non-&#116;r&#97;nsf<br>&#87;ebsit&#101;.<!-- backup --><br><br><b><font color=white>f</font></b>&nbsp; &nbsp; <b><font color=white>s</font></b>&nbsp; &nbsp; <br>&nbsp;<br>&#83;pecial re<br>N&#111;n-Human <br>&#115;piders, b<br>&#112;rogram&#115; d<br>au&#116;&#111;matica<br><br>Emai&#108; addr<br>It is reco<br>alone. You<br>has &#97; valu<br>st&#111;rage, a<br>value<font color=white>p</font>of t<br>stori&#110;g th<br>ag&#114;eem&#101;nt <br><br>&nbsp; &nbsp; &nbsp; &nbsp; <b><font color=white>a</font></b>&nbsp;<br><font color=white>t</font><br>Each<font color=white>h</font>pa<!-- able -->rty<br>a&#103;a&#105;nst th<br>("Judici<!-- egg pestilential -->al<br>the r&#101;gist<br>such laws <br>and pe&#114;for<br>o&#102; federal<br>an<!-- abbey decisive edentate mortgage hydrous -->y actio&#110;<br>Serv&#105;ce.<!-- power mr -->&nbsp;Y<br>th&#101; above<font color=white>t</font><br><br>&nbsp;&nbsp; <b><font color=white>d</font></b>&nbsp;<b><font color=white>h</font></b>&nbsp; &nbsp; <br>&nbsp;<br>You consen<br>may<font color=white>g</font>appear<br>abuse. The<br>Visitor<!-- tradein godly -->&#115; a<br><br>VISITORS A<br>PARTY OR &#83;<br>SUBSEQUEN&#84;<br></div></td>\n<td><div style="font-family: courier, monospace;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br><br>e from whi<br>ject<font color=white>o</font>to th<br>s<font color=white>g</font>&#103;&#111;&#118;ern<!-- dress lace -->in<br>u accept t<br>&#99;&#97;&#114;efully.<br>the indiv&#105;<br>access rig<br>e&#114;able wit<br><br><br>&nbsp; &nbsp;&nbsp; <b>&#83;PECI</b><br><br>strictions<br>Visitor&#115;. <br>ots,<!-- tumour study marked -->&nbsp;index<br>esi&#103;ned to<!-- pause --><br>lly<!-- maid biography greenhouse percent miscreant -->&#46;<br><br>esses on t<br>gnize&#100; t<!-- moot worship suitable upstart decadent -->ha<br>&nbsp;acknowled<br>e<font color=white>c</font>not les&#115;<br>&#110;d/or dist<br>hese addre<br>is &#87;eb&#115;ite<br>an&#100; ex&#112;res<br><br>&nbsp; &nbsp; <b><font color=white>p</font></b>&nbsp; &nbsp;&nbsp; <br><br>&nbsp;ag&#114;&#101;es th<br>e other i&#110;<br><font color=white>a</font>Ac&#116;io&#110;") <br>&#101;red Adm&#105;n<br>&#97;r&#101; appli&#101;<br>med entire<br>&nbsp;and<font color=white>o</font>st<!-- speed women diesel -->ate<br>&nbsp;broug&#104;t a<br>o<!-- gem cutting ceiling webby -->&#117;<font color=white>o</font>c&#111;ns&#101;nt<br>agreeme&#110;t.<br><br><b><font color=white>t</font></b>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <br><br>&#116; to havin<br>&nbsp;so&#109;&#101;w&#104;&#101;re<br>&nbsp;Identif&#105;e<br>gre<!-- investor silly blank -->e not t<br><br>GREE THAT <br>ENDING<font color=white>o</font>ANY<br>&nbsp;B&#82;EAC&#72; O&#70;<br></div></td>\n<td><div style="font-family: courier, monospace;">&nbsp; &nbsp;&nbsp; <b><font color=white>e</font></b>&nbsp;<b>TER</b><br><br>ch you &#97;cc<br>e followin<br>g a<!-- venture motherly runon -->ccess<font color=white>h</font>t<br>h&#101;se terms<br>&nbsp;&#65;ny Non-H<br>dual(s) wh<br>hts g&#114;ante<br>&#104;out the e<br><br><br><b>AL</b>&nbsp;<b>&#76;I&#67;ENS&#69;</b><br><br>&nbsp;on a<font color=white>o</font>v&#105;si<br>&#78;on&#45;Hum&#97;n <br>er&#115;, robot<br>&nbsp;&#97;cces<!-- jagged -->s, &#114;<br><br><br>his<font color=white>g</font>site a<br>t thes&#101; em<br>&#103;e &#97;&#110;d agr<br>&nbsp;tha&#110; US $<br>ribu&#116;ion o<br>sses. I&#110;te<!-- knowledge pernicious --><br>\'&#115;<font color=white>s</font>email a<br>sly prohib<br><br><b><font color=white>p</font></b>&nbsp;<b><font color=white>a</font><font color=white>e</font></b>&nbsp;<b>APPLI</b><br><br>a&#116; any sui<br>&nbsp;connectio<br>shall &#98;e g<br>is&#116;rative <br>d to a&#103;ree<br>l<!-- commentator -->y<font color=white>c</font>w&#105;t&#104;&#105;n <br>&nbsp;courts wi<br>gainst him<br>&nbsp;&#116;o electr<br><br><br>&nbsp; &nbsp; <b>RECORD</b><br><br>g &#121;o&#117;r &#73;nt<br>&nbsp;on th&#105;s p<br>r i&#115; uniq&#117;<br>o use this<br><br>H&#65;RVE&#83;TING<br>&nbsp;MES&#83;&#65;GE(S<br>&nbsp;T&#72;ESE TER<br></div></td>\n<td><div style="font-family: courier, monospace;"><b>MS</b>&nbsp;<b>AND</b>&nbsp;<b>CON</b><br><br>essed th&#105;s<br>g c&#111;ndi&#116;io<br>o th&#101; Webs<br><font color=white>k</font>a&#110;d c<!-- confused traffic string -->ondi<br>&#117;ma&#110; Vi&#115;i&#116;<br>o &#99;on&#116;rols<br>d &#116;o you u<br>x&#112;ress wri<br><br><br>&nbsp;<b>R&#69;STRICTI</b><br><br>tor\'s<font color=white>a</font>li&#99;e<br>Visitors<font color=white>o</font>i<br>&#115;, craw&#108;er<br>ead, compi<br><br><br>re conside<br>a&#105;l<font color=white>o</font>addres<br>e&#101;<font color=white>h</font>that<font color=white>p</font>ea<br>50. Y&#111;&#117; fu<br>f these &#97;d<br>n&#116;ional co<br>&#100;&#100;&#114;ess&#101;&#115; i<br>i&#116;e&#100;&#46;<br><br><b>CABLE</b>&nbsp;<b>LAW</b>&nbsp;<br><br>t, &#97;&#99;tion <br>n with or <br>&#111;verned b&#121;<br>C&#111;n&#116;act (t<br>ment&#115; betw<br>th&#101; Ad&#109;in <br>thin the A<br>&nbsp;in<font color=white>g</font>connec<br>on&#105;c servi<br><br><br><b>S</b>&nbsp;<b>OF</b>&nbsp;<b>V&#73;SIT</b><br><br>ernet &#80;rot<br>&#97;ge<font color=white>d</font>(the "<br>ely matche<br>&nbsp;address<!-- pp selfappointed pontifical breakfast lightfingered -->&nbsp;f<br><br>, GATHERIN<br>) T&#79; THE I<br>MS OF &#83;&#69;&#82;V<br></div></td>\n<td><div style="font-family: courier, monospace;"><b>DITION<!-- rat psychopath -->S</b>&nbsp;<b>OF</b><br><br>&nbsp;&#97;g&#114;e&#101;me&#110;t<br>ns. These <br>ite. By vi<br>tions &#40;the<br>ors to the<br>, au&#116;h&#111;rs <br>nder the T<br>tten per&#109;i<br><br><br><b>ONS</b>&nbsp;<b>FOR</b>&nbsp;<b>NO</b><br><br>nse to acc<br>n&#99;lud&#101;, bu<br>&#115;,<!-- side raspy wasteful -->&nbsp;ha&#114;vest<br>le<!-- obtainable veery funny notion progressive -->&nbsp;or<font color=white>c</font>gath<br><br><br>&#114;&#101;d pr&#111;pr&#105;<br>ses are p&#114;<br>ch<font color=white>o</font>email a<br>rth&#101;r a&#103;re<br>d&#114;ess&#101;&#115; su<br>llection, <br>s &#114;e&#99;o&#103;&#110;i&#122;<br><br><br><b>AND</b>&nbsp;<b>J&#85;RISD</b><br><br>or procee&#100;<br>arising &#102;r<br>&nbsp;the law &#111;<br>he "Adm&#105;n <br>een Ad&#109;in<font color=white>p</font><br>State. You<br>dmin &#83;tate<br>ti&#111;&#110; w&#105;&#116;h <br>&#99;e of pro&#99;<br><br><br><b>OR</b>&nbsp;<b>USE</b>&nbsp;<b>AND</b><br><br>&#111;&#99;ol a&#100;dre<br>Identi<!-- limitation diehard rhinoceroses complete -->&#102;ier<br>d to your <br>or an&#121; &#114;ea<br><br>G, STORING<br>&#68;ENTIFIER <br>ICE&#46;<br></div></td>\n<td><div style="font-family: courier, monospace;">&nbsp;<b>US&#69;</b>&nbsp;<br><br>&nbsp;("the Web<br>terms are <br>&#115;iti&#110;g &#40;i&#110;<br>&nbsp;"Terms of<br>&nbsp;Web<!-- meaning superb wiry mask eatable -->si&#116;e s<br>or &#111;ther&#119;i<br>erms of Se<br>ssion<font color=white>g</font>of t<br><br><br><b>N-HUMAN</b>&nbsp;<b>VI</b><br><br>es&#115; the We<br>t are not <br>&#101;rs, or an<br>e&#114; co<!-- port -->nt&#101;nt<br><br><br>eta&#114;y &#105;nte<br>ov<!-- middle boundary -->ided for<br>&#100;dress the<br>e that the<br>bstantiall<br>harvesti&#110;g<br>&#101;d a&#115;<font color=white>i</font>a vi<br><br><br><b>ICTION<font color=white>f</font></b><br><br>i&#110;g bro&#117;g&#104;<br>om the Ter<br>f the st&#97;t<br>State"&#41;<font color=white>k</font>fo<br>S&#116;ate resi<br>&nbsp;&#99;onsent<font color=white>f</font>&#116;<br>. Yo&#117; con&#115;<br>&#98;reaches o<!-- commissioner key proceeding frail --><br>ess regard<br><br><br>&nbsp;<b>ABUS&#69;</b>&nbsp;<br><br>ss r<!-- redolent nasty supply -->ecorde<br>") if we s<br>Internet P<br>son<!-- madetoorder oaf playbyplay baboons homogeneous -->.<br><br>, &#84;RANSFER<br>CONS&#84;ITUT&#69;<br><br></div></td>\n<td><div style="font-family: courier, monospace;"><br><br>si<!-- trouble subdued partial finny -->te") is <br>in<font color=white>o</font>a&#100;ditio<br>&nbsp;any<font color=white>d</font>ma&#110;ne<br>&nbsp;Service")<br>hall b&#101; co<br>se makes u<br>&#114;vice are<br>he ow&#110;er o<br><br><br><b>S&#73;TORS</b>&nbsp;<br><br>bsite a&#112;p&#108;<br>limite&#100; to<br>y &#111;ther co<br>&nbsp;f&#114;&#111;m the <br><br><br>llec&#116;ual p<br>&nbsp;human vis<br>&nbsp;Websit<!-- host hares rahrah -->e c<br>&nbsp;compil&#97;ti<br>y dimi&#110;i&#115;h<br>, &#103;at&#104;eri&#110;<br>ola&#116;ion of<br><br><br><br><br>t by such <br>&#109;s &#111;f Ser&#118;<br>e of<font color=white>k</font>&#114;esi&#100;<br>r &#116;he Webs<br>&#100;ent<!-- distal predestination eurytopic cattish -->&#115; e&#110;te<br>o the juri<br>ent to the<br>f t&#104;ese Te<br>&#105;ng a&#99;tion<br><br><br><br><br>d. An emai<br>u&#115;pect po&#116;<br>ro&#116;ocol ad<br><br><br>&#82;&#73;NG TO A <br>S &#65;N AC&#67;&#69;P<br><br></div></td>\n<td><div style="font-family: courier, monospace;"><br><br>p&#114;ovid&#101;&#100;<br>n &#116;o an&#121;<br>r) the<br>.<font color=white>e</font>Pleas&#101;<br>nsidered<br>se of<br><br>f the<br><br><br><br><br>y to<br>,<font color=white>e</font>we&#98;<br>mp<!-- dietetic round -->uter<br>Web&#115;it&#101;<br><br><br>roperty.<br>itors<br>ont&#97;in&#115;<br>on,<br>es the<br>g, and/or<br>&nbsp;this<br><br><br><br><br>par&#116;y<br>&#105;&#99;e<br>ence of<br>ite a<!-- traveller abundant -->s<br>red int&#111;<br>sdiction<br>&nbsp;&#118;en&#117;&#101;<font color=white>e</font>in<br>rms of<br>s und&#101;r<br><br><br><br><br>l ad&#100;ress<br>entia&#108;<br>dre&#115;s.<br><br><br>&#84;HIRD<br>T&#65;NC<!-- okay sailor matter mighty -->E AND<br><br></div></td>\n</tr>\n</table>\n<br>'; }
114
115
116 ?><?php 
117
118 // 
119 // PROXY SUPPORT
120 //  
121 // This honey pot script supports Proxies. If your webserver requires a proxy
122 // for outbound connections you may configure this honey pot's settings to use
123 // a proxy.
124 //
125 // For more information, visit: 
126 //     http://www.projecthoneypot.org/settings_help.php
127 //
128 //
129
130
131
132 function formatHTML($s) {
133     return str_replace('\n',"\n",$s);
134 }
135
136 function getDocType()       { return formatHTML(__DOC_TYPE1); }
137 function getHeadHTML1()     { return formatHTML(__HEAD1); }
138 function getRobotHTML()     { return formatHTML(__ROBOT1); }
139 function getNoCollectHTML() { return formatHTML(__NOCOLLECT1); }
140 function getHeadHTML2()     { return formatHTML(__HEAD2); }
141 function getTopHTML()       { return formatHTML(__TOP1); }
142 function getEmailHTML($method,$m) { 
143     switch ($method) {
144     case 0: return "";
145     case 1: return formatHTML(__EMAIL1A.$m.__EMAIL1B.$m.__EMAIL1C); 
146     case 2: return formatHTML(__EMAIL2A.$m.__EMAIL2B.$m.__EMAIL2C); 
147     case 3: return formatHTML(__EMAIL3A.$m.__EMAIL3B.$m.__EMAIL3C); 
148     case 4: return formatHTML(__EMAIL4A.$m.__EMAIL4B.$m.__EMAIL4C); 
149     case 5: return formatHTML(__EMAIL5A.$m.__EMAIL5B); 
150     case 6: return formatHTML(__EMAIL6A.$m.__EMAIL6B.$m.__EMAIL6C); 
151     case 7: return formatHTML(__EMAIL7A.$m.__EMAIL7B.$m.__EMAIL7C); 
152     case 8: return formatHTML(__EMAIL8A.$m.__EMAIL8B.$m.__EMAIL8C); 
153     case 9: return formatHTML(__EMAIL9A.$m.__EMAIL9B.$m.__EMAIL9C); 
154     }
155     return formatHTML(__EMAIL10A.$m.__EMAIL10B.$m.__EMAIL10C); 
156 }
157 function getLegalHTML()   { return formatHTML(__LEGAL1.(getLegalContent()).__LEGAL2); }
158 function getStyleHTML()   { return formatHTML(__STYLE1); }
159 function getVanityHTML()  { return formatHTML(__VANITY1); }
160 function getBottomHTML()  { return formatHTML(__BOTTOM1); }
161
162 function readSettings() {
163     $settings      = NULL;
164     $settings_file = dirname(__FILE__)."/phpot_settings.php";
165
166     if (is_file($settings_file) && is_readable($settings_file)) {
167         $fp = fopen($settings_file,"r");
168         $contents = "";
169         while (!feof($fp)) {
170             $contents .= fread($fp, 8192);
171         }
172         fclose($fp);
173
174         $lines = explode("\n",$contents);
175         foreach ($lines as $line) {
176             if (trim($line) !== "") {
177                 list ($setting, $value) = @explode(":",$line,2);
178                 switch ($setting) {
179                 case "proxy_host": 
180                     $settings["sock_host"] = trim($value);
181                     break;
182                 case "proxy_port":
183                     $settings["sock_port"] = trim($value);
184                     break;
185                 }
186                 if (trim($value) !== "") {
187                     $settings[trim($setting)] = trim($value);
188                 }
189             }
190         }
191     }
192
193     if (isset($settings["proxy_host"]) && isset($settings["proxy_port"]) && !isset($settings["use_proxy"])) {
194         $settings["use_proxy"] = "1";
195     } else {
196         $settings["use_proxy"] = "0";
197     }
198
199     if (isset($settings["proxy_user"]) && isset($settings["proxy_pass"]) && !isset($settings["proxy_auth"])) {
200         $settings["proxy_auth"] = "basic";
201     } else {
202         $settings["proxy_auth"] = "none";
203     }
204
205     if (!isset($settings["sock_host"])) $settings["sock_host"] = __REQUEST_HOST;
206     if (!isset($settings["sock_port"])) $settings["sock_port"] = __REQUEST_PORT;
207
208     return $settings;
209 }
210
211 function performRequest($request) {
212     $response = "";
213
214     $settings = readSettings();
215
216     if ($settings["use_proxy"] == "1") {
217         // POST via proxy
218         $post_url = "http://".__REQUEST_HOST.":".__REQUEST_PORT.__REQUEST_SCRIPT;
219
220         $head  = "POST ".$post_url." HTTP/1.0\r\n";
221         //$head .= "Host: ".__REQUEST_HOST."\r\n";
222         $head .= "User-Agent: PHPot ".__HPOT_TAG2."\r\n";
223         if ($settings["proxy_auth"] == "basic") {
224             $head .= "Proxy-Authorization: Basic ".base64_encode($settings["proxy_user"].":".$settings["proxy_pass"])."\r\n";
225         }
226         $head .= "Cache-Control: no-store, no-cache\r\n";
227         $head .= "Accept: */*\r\n";
228         $head .= "Pragma: no-cache\r\n";
229         $head .= "Content-Type: application/x-www-form-urlencoded\r\n";
230         $head .= "Content-Length: ".strlen($request)."\r\n";
231         $head .= "Connection: close\r\n\r\n";
232
233     } else {
234         // POST directly
235         $head  = "POST ".__REQUEST_SCRIPT." HTTP/1.1\r\n";
236         $head .= "Host: ".__REQUEST_HOST."\r\n";
237         $head .= "User-Agent: PHPot ".__HPOT_TAG2."\r\n";
238         $head .= "Content-Type: application/x-www-form-urlencoded\r\n";
239         $head .= "Content-Length: ".strlen($request)."\r\n";
240         $head .= "Connection: close\r\n\r\n";
241     }
242     
243     $errno  = NULL;
244     $errstr = NULL;
245     $fd = @fsockopen ($settings["sock_host"], $settings["sock_port"], $errno, $errstr, 20);
246
247     if (!$fd) {
248         // Socket Error
249         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");
250         return "-1";
251     } else {
252
253         fputs($fd,$head.$request);
254         while(!feof($fd)) {
255             $response .= fgets($fd,4096);
256         }
257         fclose($fd);
258     }
259
260     return $response;
261 }
262
263 function prepareRequest() {
264     $postvars          = array();
265     $postvars["tag1"]  = __HPOT_TAG1;
266     $postvars["tag2"]  = __HPOT_TAG2;
267     $postvars["tag3"]  = __HPOT_TAG3;
268     if (!($handle = fopen(__FILE__,"r"))) {
269         die("\n<BR>Unable to read contents of ".__FILE__." for hashing<BR>\n");
270         return -2;
271     }
272     $contents = "";
273     while (!feof($handle)) {
274         $contents .= fread($handle, 8192);
275     }
276     fclose($handle);
277     $postvars["tag4"]   = md5(ereg_replace("[^a-zA-Z0-9]","",$contents));
278     $postvars["ip"]    = $_SERVER["REMOTE_ADDR"];
279     $postvars["svrn"]  = $_SERVER["SERVER_NAME"];  
280     $postvars["svp"]   = $_SERVER["SERVER_PORT"];  
281     $postvars["svip"]  = isset($_SERVER["SERVER_ADDR"]) ? $_SERVER["SERVER_ADDR"] : "";
282     $postvars["rquri"]   = isset($_SERVER["REQUEST_URI"]) ? $_SERVER["REQUEST_URI"] : "";
283     $postvars["phpself"] = str_replace(' ','%20',$_SERVER["PHP_SELF"]);
284     $postvars["version"] = "php-".phpversion();
285     $postvars["sn"]     = str_replace(' ','%20',$_SERVER["SCRIPT_NAME"]);
286     $postvars["ref"]    = isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : "";
287     $postvars["uagnt"]  = isset($_SERVER["HTTP_USER_AGENT"]) ? $_SERVER["HTTP_USER_AGENT"] : "";
288     if (isset($_POST) && count($_POST) > 0) {
289         $postvars["has_post"] = count($_POST);
290         for (reset($_POST);list($k,$v) = each($_POST);) {
291             $postvars["post|".$k] = $v;
292         }
293         reset($_POST);
294     }
295     if (isset($_GET) && count($_GET) > 0) {
296         $postvars["has_get"] = count($_GET);
297         for (reset($_GET);list($k,$v) = each($_GET);) {
298             $postvars["get|".$k] = $v;
299         }
300         reset($_GET);
301     }
302
303     return $postvars;
304 }
305
306 function transcribeResponse(& $response) {
307     $settings  = NULL;
308     $arr       = explode("\n",$response);
309     $isParam   = FALSE;
310
311     
312     for ($i=0;list(,$v)=each($arr);$i++) {
313         if ($v == "<END>")   $isParam = FALSE;
314
315         if ($isParam) {          
316             $pieces = explode("=",$v,2);
317             $settings[$pieces[0]] = urldecode($pieces[1]);
318         }
319         if ($v == "<BEGIN>") $isParam = TRUE;
320     }
321     
322
323     if ($settings["directives"]) {
324         $settings["directives"] = explode(",",$settings["directives"]);
325     }
326
327     return $settings;
328 }
329
330 header("Cache-Control: no-store, no-cache");
331 header("Pragma: no-cache");
332
333 $response  = "";
334 $request   = "";
335 $post      = prepareRequest();
336
337 for (reset($post);list($k,$v) = each($post);) {
338     $request .= "&".urlencode($k)."=".urlencode(stripslashes($v));
339 }
340 $request    = substr($request,1);
341 $response   = performRequest($request);
342 if ($response == "-1") {
343     exit();
344 }
345 $settings   = transcribeResponse($response);
346
347 $directives   = $settings["directives"];
348 $email        = isset($settings["email"]) ? $settings["email"] : "";
349 $emailmethod  = isset($settings["emailmethod"]) ? $settings["emailmethod"] : 0;
350
351
352
353
354 ?>
355 <?php echo (isset($directives[0]) && $directives[0]==1) ? getDocType()    : ""; ?>
356 <?php echo (isset($settings["injDocType"])) ? formatHTML($settings["injDocTypeMsg"]) : ""; ?>
357 <?php echo (isset($directives[1]) && $directives[1]==1) ? getHeadHTML1()   : ""; ?>
358 <?php echo (isset($settings["injHead1HTML"])) ? formatHTML($settings["injHead1HTMLMsg"]) : ""; ?>
359 <?php echo (isset($directives[8]) && $directives[8]==1) ? getRobotHTML()   : ""; ?>
360 <?php echo (isset($settings["injRobotHTML"])) ? formatHTML($settings["injRobotHTMLMsg"]) : ""; ?>
361 <?php echo (isset($directives[9]) && $directives[9]==1) ? getNoCollectHTML()   : ""; ?>
362 <?php echo (isset($settings["injNoCollectHTML"])) ? formatHTML($settings["injNoCollectHTMLMsg"]) : ""; ?>
363 <?php echo (isset($directives[1]) && $directives[1]==1) ? getHeadHTML2()   : ""; ?>
364 <?php echo (isset($settings["injHead2HTML"])) ? formatHTML($settings["injHead2HTMLMsg"]) : ""; ?>
365 <?php echo (isset($directives[2]) && $directives[2]==1) ? getTopHTML()    : ""; ?>
366 <?php echo (isset($settings["injTopHTML"])) ? formatHTML($settings["injTopHTMLMsg"]) : ""; ?>
367 <?php
368    if (isset($settings["actMsgOn"])) { 
369        echo formatHTML($settings["actMsg"]); 
370    }
371    if (isset($settings["errMsgOn"])) { 
372        echo formatHTML($settings["errMsg"]); 
373    }
374    if (isset($settings["customMsgOn"])) { 
375        echo formatHTML($settings["customMsg"]); 
376    }
377 ?>
378 <?php echo (isset($directives[3]) && $directives[3]==1) ? getLegalHTML()  : ""; ?>
379 <?php echo (isset($settings["injLegalHTML"])) ? formatHTML($settings["injLegalHTMLMsg"]) : ""; ?>
380 <?php
381    if (isset($settings["altLegalOn"])) { 
382        echo formatHTML($settings["altLegalMsg"]); 
383    } 
384 ?>
385 <?php echo (isset($directives[4]) && $directives[4]==1) ? getEmailHTML(intval($emailmethod),$email)  : ""; ?>
386 <?php echo (isset($settings["injEmailHTML"])) ? formatHTML($settings["injEmailHTMLMsg"]) : ""; ?>
387 <?php echo (isset($directives[5]) && $directives[5]==1) ? getStyleHTML()  : ""; ?>
388 <?php echo (isset($settings["injStyleHTML"])) ? formatHTML($settings["injStyleHTMLMsg"]) : ""; ?>
389 <?php echo (isset($directives[6]) && $directives[6]==1) ? getVanityHTML() : ""; ?>
390 <?php echo (isset($settings["injVanityHTML"])) ? formatHTML($settings["injVanityHTMLMsg"]) : ""; ?>
391 <?php
392    if (isset($settings["altVanityOn"])) {
393         echo formatHTML($settings["altVanityMsg"]);
394     }
395 ?>
396 <?php echo (isset($directives[7]) && $directives[7]==1) ? getBottomHTML() : ""; ?>
397 <?php echo (isset($settings["injBottomHTML"])) ? formatHTML($settings["injBottomHTMLMsg"]) : ""; ?>