In my project, user will upload videos. So i have done simple code to check video file extension and moved to a particular folder. now problem is that only registered user can see that video. So i decided to check session while loading page which contain player to play video. but in view-source option , video file url available. so then can see that video using that url. now 开发者_开发知识库i need to check session before accessing that video folder. or is it possible to store video files in DB? thanks in advance..
It is insane, you need to make a rewrite or something like this video.php?id=blablabla, a then check if user is logged in, if he is, play (readfile) video. What type of file is it?
$id = $_GET["id"];
if($session == true)
{
header("Content-type: video/flv");
readfile("my/secret/path/".$id);
}
everything that's shown for a user can always be copied and spread, but one way to prevent it from a more regular user would be using a php that reads an id/hash(basicaly a key of some sort) that is related to an video and then loads the video through file_read and outputs it.
store key and then the real url in a database then query the id to get the real url and then use a file reading function for example to stream it the function could be fopen, fgets or something similiar
精彩评论