Jump to content

One php page for multiple files


dreamwest

Recommended Posts

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....

Link to comment
Share on other sites

<?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>';
   
?>

Link to comment
Share on other sites

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

 

 

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.