Advertisement
aaaaaa123456789

Multiple PR2 instances in one page

May 4th, 2012
109
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. function pr2_embed ($width, $height) {
  4.   $w = (string) (int) $width;
  5.   $h = (string) (int) $height;
  6.   return <<<HTMLcode_end
  7. <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>
  8. HTMLcode_end;
  9. }
  10.  
  11. function get_value ($name, $default) {
  12.   if (!isset($_REQUEST[$name])) return $default;
  13.   return $_REQUEST[$name];
  14. }
  15.  
  16. function create_page () {
  17.   $rows = get_value("rows", 1);
  18.   $cols = get_value("cols", 1);
  19.   $width = get_value("width", 770);
  20.   $height = get_value("height", 560);
  21.   if ($width <= 0) $width = 770;
  22.   if ($height <= 0) $height = 560;
  23.   if ($rows <= 0) $rows = 1;
  24.   if ($cols <= 0) $cols = 1;
  25.   $i1 = (int) $rows;
  26.   $i2 = (int) $cols;
  27.   $display = pr2_embed($width, $height);
  28.   $result = "";
  29.   while ($i2) {
  30.     for ($instance = 0; $instance < $i1; $instance ++)
  31.       $result .= $display;
  32.     $result .= '<br />';
  33.     $i2 --;
  34.   }
  35.   return <<<HTMLcode_end
  36.     <html>
  37.       <head>
  38.         <title>Many PR2s!</title>
  39.       <head>
  40.       <body>$result</body>
  41.     </html>
  42. HTMLcode_end;
  43. }
  44.  
  45. echo create_page ();
  46.  
  47. ?>
Advertisement
RAW Paste Data Copied
Advertisement