bigbenbuilders Posted September 2, 2009 Share Posted September 2, 2009 I am trying to random load a flash file when the page refreshes but it is not working. here is the code [<?php $imglist=''; //$img_folder is the variable that holds the path to the swf files. // see that you dont forget about the "/" at the end $img_folder = "flash/"; mt_srand((double)microtime()*1000); //use the directory class $imgs = dir($img_folder); //read all files from the directory, ad them to a list while ($file = $imgs->read()) { if (eregi("swf", $file)) $imglist .= "$file "; } closedir($imgs->handle); //put all images into an array $imglist = explode(" ", $imglist); $no = sizeof($imglist)-2; //generate a random number between 0 and the number of images $random = mt_rand(0, $no); $image = $imglist[$random]; //display random swf echo '<embed src="'.$img_folder.$image.'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="100" height="100"></embed>'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/172863-solved-random-load/ Share on other sites More sharing options...
bigbenbuilders Posted September 2, 2009 Author Share Posted September 2, 2009 sorry about that <?php $imglist=''; //$img_folder is the variable that holds the path to the swf files. // see that you dont forget about the "/" at the end $img_folder = "images/"; mt_srand((double)microtime()*1000); //use the directory class $imgs = dir($img_folder); //read all files from the directory, ad them to a list while ($file = $imgs->read()) { if (eregi("swf", $file)) $imglist .= "$file "; } closedir($imgs->handle); //put all images into an array $imglist = explode(" ", $imglist); $no = sizeof($imglist)-2; //generate a random number between 0 and the number of images $random = mt_rand(0, $no); $image = $imglist[$random]; //display random swf echo '<embed src="'.$img_folder.$image.'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="100" height="100"></embed>'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/172863-solved-random-load/#findComment-911066 Share on other sites More sharing options...
mikesta707 Posted September 2, 2009 Share Posted September 2, 2009 what happens when you run the script? you need a better description than not working. is it throwing an error? not showing the flash? blank page? Quote Link to comment https://forums.phpfreaks.com/topic/172863-solved-random-load/#findComment-911068 Share on other sites More sharing options...
bigbenbuilders Posted September 2, 2009 Author Share Posted September 2, 2009 I get no errors it just does not show up? Quote Link to comment https://forums.phpfreaks.com/topic/172863-solved-random-load/#findComment-911072 Share on other sites More sharing options...
bigbenbuilders Posted September 2, 2009 Author Share Posted September 2, 2009 shows the page content just not the flash? Quote Link to comment https://forums.phpfreaks.com/topic/172863-solved-random-load/#findComment-911077 Share on other sites More sharing options...
mattal999 Posted September 2, 2009 Share Posted September 2, 2009 View the source of the page and check the flash code. See if what is output is correct. Quote Link to comment https://forums.phpfreaks.com/topic/172863-solved-random-load/#findComment-911079 Share on other sites More sharing options...
bigbenbuilders Posted September 2, 2009 Author Share Posted September 2, 2009 no it shows this doesnt show the flash file <script src="http://cuaa.info/mambo/templates/Scripts/AC_RunActiveContent.js" type="text/javascript"></script> Quote Link to comment https://forums.phpfreaks.com/topic/172863-solved-random-load/#findComment-911121 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.