Changeset 78


Ignore:
Timestamp:
11/23/05 15:19:58 (7 years ago)
Author:
sam
Message:
  • commented a few functions and got rid of image_list().
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trollforge/lastmeasure/index.php

    r77 r78  
    1212$music = $_GET['music']; 
    1313 
    14 function list_images() { 
    15    global $files; 
    16    $files = array(); 
    17    $dh = opendir('images/'); 
    18    while(($file = readdir($dh)) != false) { 
    19       $ext = substr($file, -3); 
    20       if($ext == 'jpg' || $ext == 'gif') { 
    21          $files[] = 'images/'.$file; 
     14/* Print a random image name, with its 'image/' prefix. */ 
     15function random_image() { 
     16   static $imagelist = null; 
     17   if(!$imagelist) { 
     18      $imagelist = array(); 
     19      $dh = opendir('images/'); 
     20      while(($file = readdir($dh)) != false) { 
     21         $ext = substr($file, -3); 
     22         if($ext == 'jpg' || $ext == 'gif') { 
     23            $imagelist[] = $file; 
     24         } 
    2225      } 
    2326   } 
    2427   closedir($dh); 
    25 } 
    26  
    27 function random_image() { 
    28    global $files; 
    29    echo $files[rand(0,count($files)-1)]; 
    30 } 
    31  
     28   echo 'images/'.$imagelist[rand(0,count($imagelist)-1)]; 
     29} 
     30 
     31/* Output an <object> whose sole purpose is to play the "hey everybody, I'm 
     32 * watching gay porno!" sound. */ 
    3233function hey_everybody() { ?> 
    3334  <object classid= "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
     
    125126<?php 
    126127} 
    127  
    128 /* Initialise shit */ 
    129 list_images(); 
    130128 
    131129?> 
     
    198196    <input type="submit" value="CLICK ME" name="CLICK ME" 
    199197           style="width: 2000px; height: 2000px; 
    200                   background-image: url('<?php random_image($files);?>');" 
     198                  background-image: url('<?php random_image();?>');" 
    201199           src="<?php random_image();?>" height="300" width="300" 
    202200           onMouseOver="if(is_ie) {showModelessDialog('index.php?procreate=1'); 
     
    208206                       return true; } else{procreate();} 
    209207                       playBall();return true;"> 
    210     <img src="<?php random_image($files);?>" 
     208    <img src="<?php random_image();?>" 
    211209         onMouseOver="if(is_ie) {showModelessDialog('index.php?procreate=1'); 
    212210                      return true; } procreate();playBall();return true;" 
Note: See TracChangeset for help on using the changeset viewer.