...

View Full Version : Hiding FLV path.



CyberPirate
03-01-2009, 04:21 PM
Hello I've been trying to hide my FLV videopath because I don't want the average user to download stuff directly from server or people leeching my bandwidth.

This is the script that get's video URL based on QueryString ID

<?php
if (isset($_GET['id']) && file_exists('videos/video' . str_pad($_GET['ID'], 3, '0', STR_PAD_LEFT) . '.flv'))
{
header('Content-type: flv-application/octet-stream');
readfile('videos/video' . str_pad($_GET['ID'], 3, '0', STR_PAD_LEFT) . '.flv');
}
else
{
header('HTTP/1.0 404 Not Found');
}
?>

This is the video code:

<script type="text/javascript" src="http://www.site.com/embed/swfobject.js"></script>
<div id="player"><p align="center">
<img alt="http://www.arunbhatia.com/images/error-icon.jpg" src="http://www.arunbhatia.com/images/error-icon.jpg"><br>
It seems you have an outdated Flash player installed. <b>
<a href="http://get.adobe.com/flashplayer/">Click here to get the latest Adobe
Flash Player!</a></b></p></div>

<script type="text/javascript">
var so = new SWFObject('http://www.site.com/jw/embed/player.swf','mpl','600','450','9');
so.addParam('allowscriptaccess','always');
so.addParam('allowfullscreen','true');
so.addParam('flashvars','&file=playvideo.php?ID=1');
so.write('player');
</script>

It won't work, I get error message that the file is not found. Can anyone please help? :)

CyberPirate
03-02-2009, 10:13 AM
No one can help on this subject?

_Aerospace_Eng_
03-02-2009, 08:47 PM
Query string variables are case sensitive. You have $_GET['id'] in some places but in your code you are using $_GET['ID'] as well.

If you did


<?php
echo $_GET['ID'];
?>
On a url such as test.php?id=blah nothing would get echoed out. However if you did test.php?ID=blah then it would work.

Also learn to be patient. We are here on our own time. A little research on your own would have solved this problem.

CyberPirate
03-02-2009, 10:42 PM
Yeah, I know that it's case-sensetive. I've tried both, but they won't work.

_Aerospace_Eng_
03-03-2009, 02:49 PM
With the code you posted above you will always get the else. If you keep your current html and use this for your php it should work

<?php
if (isset($_GET['ID']) && file_exists('videos/video' . str_pad($_GET['ID'], 3, '0', STR_PAD_LEFT) . '.flv'))
{
header('Content-type: flv-application/octet-stream');
readfile('videos/video' . str_pad($_GET['ID'], 3, '0', STR_PAD_LEFT) . '.flv');
}
else
{
header('HTTP/1.0 404 Not Found');
}
?>
If that does work compare it to your old code and tell me why it works. If it doesn't work then just before your if statement add this

echo file_exists('videos/video' . str_pad($_GET['ID'], 3, '0', STR_PAD_LEFT) . '.flv';
Post what you get here. Also at the very top of your php add this

ini_set('display_errors','1');
error_reporting(E_ALL);
Once you have working remove the above two lines.

Yuen Biao
03-04-2009, 08:59 PM
Does this work with files that are not hosted on your server? I tried using readfile on an external flv before, but it only shows a loading sign forever. Any ideas?

_Aerospace_Eng_
03-09-2009, 10:34 PM
I don't know if readfile works with files from different servers for security reasons. Why are you worried about hiding files that you are getting from other servers? Do you have permission to use those files?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum