aaaaaa123456789 icon

Multiple PR2 instances in one page

aaaaaa123456789 | PRO | 05/05/12 04:28:14 AM UTC | 0 ⭐ | 437 👁️ | Never ⏰ | []
PHP |

1.21 KB

|

None

|

0 👍

/

0 👎

<?php
 
function pr2_embed ($width, $height) {
  $w = (string) (int) $width;
  $h = (string) (int) $height;
  return <<<HTMLcode_end
<embed width="$w" height="$h" 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>
HTMLcode_end;
}
 
function get_value ($name, $default) {
  if (!isset($_REQUEST[$name])) return $default;
  return $_REQUEST[$name];
}
 
function create_page () {
  $rows = get_value("rows", 1);
  $cols = get_value("cols", 1);
  $width = get_value("width", 770);
  $height = get_value("height", 560);
  if ($width <= 0) $width = 770;
  if ($height <= 0) $height = 560;
  if ($rows <= 0) $rows = 1;
  if ($cols <= 0) $cols = 1;
  $i1 = (int) $rows;
  $i2 = (int) $cols;
  $display = pr2_embed($width, $height);
  $result = "";
  while ($i2) {
    for ($instance = 0; $instance < $i1; $instance ++)
      $result .= $display;
    $result .= '<br />';
    $i2 --;
  }
  return <<<HTMLcode_end
    <html>
      <head>
        <title>Many PR2s!</title>
      <head>
      <body>$result</body>
    </html>
HTMLcode_end;
}
 
echo create_page ();
 
?>

Comments