dreamwest Posted December 2, 2008 Share Posted December 2, 2008 I have about 100 or so swf movies and want to use only one page based on the url the user clicks example: http://www.site.com/video_player.php?1234.swf where 1234.swf is the file so based on the url - file 1234.swf should be displayed within: <p align="center"> <object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="935" height="301"> <param name="movie" value="/1234.swf"> <param name="quality" value="High"> <embed src="/1234.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="920" height="520"></object> im just not sure how to go about it.... Quote Link to comment https://forums.phpfreaks.com/topic/135121-one-php-page-for-multiple-files/ Share on other sites More sharing options...
waynew Posted December 2, 2008 Share Posted December 2, 2008 <?php //check if filename is a number if(!is_numeric($_GET['movie'])){ header('Location: index.php'); } //check if file exists if(!is_file($_GET['movie'].'.php')){ header('Location: index.php'); } echo ' <p align="center"> <object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="935" height="301"> <param name="movie" value="/'.$_GET['movie'].'.swf"> <param name="quality" value="High"> <embed src="/'.$_GET['movie'].'.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="920" height="520"></object>'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/135121-one-php-page-for-multiple-files/#findComment-703801 Share on other sites More sharing options...
dreamwest Posted December 2, 2008 Author Share Posted December 2, 2008 can you elaborate a bit.....please :-\ Heres my directory structure...hope it helps /files/ where swf files are stored /video_player.php where the player macromedia code is located isnt header('Location: index.php'); a redirect to index.php, i cant see how this works Quote Link to comment https://forums.phpfreaks.com/topic/135121-one-php-page-for-multiple-files/#findComment-703809 Share on other sites More sharing options...
waynew Posted December 2, 2008 Share Posted December 2, 2008 That redirect will only come into place if the name of the file isn't a number or if the file doesn't exist. Updated version to fit with your file structure. <?php //check if filename is a number if(!is_numeric($_GET['movie'])){ header('Location: index.php'); } //check if file exists if(!is_file('files/'.$_GET['movie'].'.php')){ header('Location: index.php'); } echo ' <p align="center"> <object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="935" height="301"> <param name="movie" value="/files/'.$_GET['movie'].'.swf"> <param name="quality" value="High"> <embed src="/files/'.$_GET['movie'].'.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="920" height="520"></object>'; ?> So if the user wants to watch file 123.swf, he navigates to this page like so: video_player.php?movie=123 Quote Link to comment https://forums.phpfreaks.com/topic/135121-one-php-page-for-multiple-files/#findComment-703821 Share on other sites More sharing options...
dreamwest Posted December 2, 2008 Author Share Posted December 2, 2008 IT WORKS!! Thanks! I can basically pull out anything of a url string by using: <?php echo ''.$_GET['anything'].'' ?> This will be invaluable in the future Thanks again!! Quote Link to comment https://forums.phpfreaks.com/topic/135121-one-php-page-for-multiple-files/#findComment-703835 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.