tags:

views:

47

answers:

5

I want to only let "right" people watch those videos. In other words, only registered users that are allowed (by other users, ie, friends) should see videos. I have a hard retriction for cpu usage in my shared environment, so I can't use things like php's readfile.

A: 

It must be http streaming any way.

Tharases
+2  A: 

Stream through PHP using readfile, as you mention. Just set a cookie with a session ID when someone logs in and check it before you start streaming the video, and don't bother if they're not authenticated.

Samir Talwar
A: 

Samir Talwar, I can't do so, because it is cpu-intensive (as I mentioned).

Tharases
Apologies—you wrote "can" instead of "can't" in the original post. In that case, there's no way you can do this—the best you can do is create an obscure file name that changes every so often, but this won't just stop people linking to it—it'll also break bookmarks.
Samir Talwar
A: 

Samir Talwar, I wish to know how to make it not cpu-intensive. It's all I need. By myself I will take care of other stuff with cookie and such.

Tharases
A: 

I liked Samir Talwar way to go. But if this is too CPU intensive (I'm not really sure of this), you can go with apache and use a backend PHP script that will allow or deny access upon user cookie state.

But have you access to apache conf in your shared env ?

If so, you can look at apache urlrewriting guide, in "Extended Redirection" section.

Benoit