names are: image0.jpg image1.jpg image2.jpg image3.jpg image4.jpg flash0.swf flash1.swf flash2.swf flash3.swf I also tried the following code, but get the following in my error log "File does not exist: /home/website/public_html/test/<" Code (markup): <?php $r_swf[]="flash0.swf" $r_swf[]="flash1.swf" $r_swf[]="flash2.swf" $swf = $r_swf[ rand(0,2) ]; ?> <embed name="Movie1" src="<? echo $swf; ?>" quality="high" bgcolor="#FFFFFF" width="269" height="367" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"> </embed> PHP:
Put this in a php file, put in on your server <?php $random_number = rand(1,9); echo '<object width="550" height="400"> <param name="movie" value="flash' . $random_number . '.swf"> <embed src="flash' . $random_number . '.swf" width="550" height="400"> </embed> </object>'; ?> PHP: Then add <iframe src="myflash.php" width="550" height="400" scrolling="no" frameborder="0">Sorry, your browser does not support IFrames!</iframe> Code (markup): And it works. Only for flash, but it works
This will incorporate both. <?php $imageorflash = rand(1,2); If (imageorflash == 1){ $random_number = rand(0,3); echo '<object width="550" height="400"> <param name="movie" value="flash' . $random_number . '.swf"> <embed src="flash' . $random_number . '.swf" width="550" height="400"> </embed> </object>'; } else { $random_integer = rand(0,4); // Assumes you have images from image0 to image4 echo '<img src="http://www.domain.com/image', $random_integer, '.jpg"></img>'; //point to the correct domain/folder, this assumes .jpg but can be easily changed } ?> PHP: