Page 2 of 2

Re: Beginners PHP 1:PHP GET

Posted: Tue Nov 16, 2010 11:32 pm
by Livengood
Alex wrote:
Livengood wrote:
now lets say you have a video player, but you want to use this to videos.? how would you do this, i know some php, but i am lost on trying to do this...
Well, you could get the video id and have in your root web directory a folder named "videos" so when a user uploads a video, it uploads it to that folder by the name of "1.avi","2.avi" and so on. Now, to use $_GET[] for that, it'd be something along the lines of...
Code: Select all
<?php
//playvideo.php (Or whatever you want to call it)
$videoid = $_GET['id'];
?>
<html>
<head>
<TITLE> Show Video</TITLE>
</head>
<body>
<embed src="<?php echo 'http://www.yourwebsite.com/videos/'.$videoid.'.avi'; ?>" autostart="false" />
</body>
</html>
Basically, we get the id of the video from the URL (http://www.yourwebsite.com/playvideo.php?id=1) and it would embed the video "http://www.yourwebsite.com/videos/1.avi" and tell it not to start on page load.
Thanks :), i understand that part lol
Know lets put this to perspective on Flv, and swf video player, how about that one? lol cause thats what i am working with

Re: Beginners PHP 1:PHP GET

Posted: Tue Nov 16, 2010 11:42 pm
by Alex
Livengood wrote:
Alex wrote:
Livengood wrote:
now lets say you have a video player, but you want to use this to videos.? how would you do this, i know some php, but i am lost on trying to do this...
Well, you could get the video id and have in your root web directory a folder named "videos" so when a user uploads a video, it uploads it to that folder by the name of "1.avi","2.avi" and so on. Now, to use $_GET[] for that, it'd be something along the lines of...
Code: Select all
<?php
//playvideo.php (Or whatever you want to call it)
$videoid = $_GET['id'];
?>
<html>
<head>
<TITLE> Show Video</TITLE>
</head>
<body>
<embed src="<?php echo 'http://www.yourwebsite.com/videos/'.$videoid.'.avi'; ?>" autostart="false" />
</body>
</html>
Basically, we get the id of the video from the URL (http://www.yourwebsite.com/playvideo.php?id=1) and it would embed the video "http://www.yourwebsite.com/videos/1.avi" and tell it not to start on page load.
Thanks :), i understand that part lol
Know lets put this to perspective on Flv, and swf video player, how about that one? lol cause thats what i am working with
You would just change the <embed src= part to the HTML code for embedding those types of files.

Re: Beginners PHP 1:PHP GET

Posted: Wed Nov 17, 2010 12:54 am
by zachman61
hi it works perfectly but the video player is waaaaay to small
any ideas?

Re: Beginners PHP 1:PHP GET

Posted: Wed Nov 17, 2010 1:12 am
by Alex
zachman61 wrote:
hi it works perfectly but the video player is waaaaay to small
any ideas?
Use width and height parameters.
640x385 is youtube width/height if that helps.
Code: Select all
<embed src="<?php echo 'videos/'.$videoid.'.wmv'; ?>" autostart="false" width="640" height="385" />

Re: Beginners PHP 1:PHP GET

Posted: Wed Nov 17, 2010 4:36 am
by zachman61
Your a Genius im nominating u for Moty