17th December 2017, 10:55 PM
For a long time, there was a page on acidch.at/multipr2.php that allowed loading an arbitrary number of instances of PR2 in a configurable layout. Originated as a prank (trying to make someone load 25,000 instances of PR2, which would crash most setups), the page actually survived and was useful to quite a few people.
That page has been down for a while, for a few reasons. I happened to find the code for it, so I figured I'd share it; someone might be able to do something nice with it.
Here:
That page has been down for a while, for a few reasons. I happened to find the code for it, so I figured I'd share it; someone might be able to do something nice with it.
Here:
PHP Code:
<?php
function pr2code ($width, $height) {
$width = (int) $width;
if ($width <= 0) return false;
$height = (int) $height;
if ($height <= 0) return false;
return '<embed width="' . (string) $width . '" height="' . (string) $height .
'" base="http://external.kongregate-games.com/gamez/0001/0110/live/" ' .
'src="http://external.kongregate-games.com/gamez/0001/0110/live/embeddable_10110.swf"' .
'type="application/x-shockwave-flash"></embed>';
}
function repeat ($rows, $cols, $content) {
$rows = (int) $rows;
$cols = (int) $cols;
if (($rows < 0) or ($cols < 0)) return false;
$content = (string) $content;
$line = str_repeat($content, $cols);
if ($rows > 1)
$result = str_repeat($line . '<br />', $rows - 1);
else
$result = "";
if ($rows) $result .= $line;
return $result;
}
function homepage () {
$uri = $_SERVER['PHP_SELF'];
return <<<code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Multiple PR2s</title>
</head>
<body>
<center>
<h2>Multiple PR2s</h2>
<br />
Enter the configuration you want:<br />
<br />
<form action="$uri" method="get">
<table>
<tr>
<td align="right">Rows:</td>
<td align="left"><input type="text" name="rows" value="1" /></td>
</tr>
<tr>
<td align="right">Columns:</td>
<td align="left"><input type="text" name="cols" value="1" /></td>
</tr>
<tr>
<td align="right">Width (px):</td>
<td align="left"><input type="text" name="width" value="550" /></td>
</tr>
<tr>
<td align="right">Height (px):</td>
<td align="left"><input type="text" name="height" value="400" /></td>
</tr>
</table>
<br />
<input type="submit" value="Load" />
<input type="reset" value="Reset" />
</form>
</center>
</body>
</html>
code;
}
$pagehead = <<<'code'
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Multiple PR2s</title>
</head>
<body>
code;
$pagefoot = <<<'code'
</body>
</html>
code;
$r = @$_REQUEST['rows'];
$c = @$_REQUEST['cols'];
$w = @$_REQUEST['width'];
$h = @$_REQUEST['height'];
if (($r === null) or ($c === null)) {
echo homepage();
return 0;
}
if (($w === null) and ($h === null)) {
$w = 550;
$h = 400;
}
if ($w === null) $w = $h * 11 / 8;
if ($h === null) $h = $w * 8 / 11;
$line = pr2code($w, $h);
if ($line === false) {
echo homepage();
return 0;
}
$repeat = repeat($r, $c, $line);
if ($repeat === false) {
echo homepage();
return 0;
}
echo $pagehead;
echo $repeat;
echo $pagefoot;