This is my scenario:
I have a localhost website that only logged in users can visit. They are stored on a mysql database.
The server side is running PHP.
Inside my website I have a video player that plays a video from a localhost flumotion video streaming server.
I want to protect my video streaming url in order to only registered users can access it. If anyone copy the video URL, it won't be able to play outside my website.
How can I do it?
EDIT: I mean "video url" as url like this: 192.168.1.221/myvideo.mp4 (my flumotion video streaming running on localhost)
This is the url that the html5 video player get. And I want to protect it from copy and paste in another browser tab. Because if i do it, I can play it without need my website.
You could check if the user is logged in, by checking if a session is set depending on how your login system works.
function is_logged_in(){
if (!isset($_SESSION['you_session_name']))//user is not logged in..
return false;
return true;
}
Then in your video page check if the user is actually logged in, and if it's not redirect him on another page:
if (!is_logged_in()) header("Location: http://redirectsite.com/page");
Related
Is there any way from which i can obfuscate my video url or video link ? I am embedding video in <video> of html 5. I have disabled right click of the page using jquery. But still user can download video thru download manager. I want to restrict it. How can i do it?
My website is in Opencart 2
If the user can view the video, you CAN'T restrict the download.
As a side note, any attempts to restrict user access to elements that he/she can see or interact are a waste of time, any savvy user will bypass them easily.
I want to implement a website which like Youtube, these real URLs of videos has to be hidden.
When a user comes in, and the PHP webpage will authenticate the user, and redirect that user to the real URL of the video. The problem is how can I redirect URL and hide its real video URL, or other ways to prevent the real URL of videos exposed?
I don't know if I got your point, but are you looking for something like this?
$video_url = $user_is_authenticated ? $video_url : $authentication_url."?returnUrl=".$video_url;
echo "<a href='$video_url'>Video Title</a>";
This way, if the user is authenticated, you send him the real video URL, otherwise the login page would be seen instead.
If you don't want users to see the URL you can use session variables during authentication.
You want to hide the video location, I guess. Make a script to feed your video to your front.
feed.php?video=id
This will read your video file based on the video id and return it with propper headers to your frontend player.
URL bar can be hidden using JavaScript in InternetExplorer using window.open method.
And that will work only in InternetExplorer. And remaining browsers dont allow you to hide address bar, as per security issues.
I have a webpage hosted in my local server being displayed inside a Page Viewer Web Part in SharePoint 2007.
I would like to include a user check inside the pages in my server, so when an user tried to access some page through the SharePoint web part, the page would first check who is the user logged in SharePoint trying to access the page, and then check if the specific user is allowed to see that page.
I have tried the most common solutions found online using js and/or php: SPAPI, SPContext and Jquery SPServices, but wasn't able to make any of them work with the php pages in my local server.
Is there a practical way to get the user who is accessing the page? I am new to web development, so I would appreciate any help.
in your case the problem is how to pass user identity from SharePoint to your PHP page as SharePoint user (as well as any other SP information) is not accessible directly in page displayed within Page Viewer webpart. Page Viewer webpart uses IFRAME to display specified page.
I suggest you to use ContentEditor webpart to include your own IFRAME and some javascript to the SharePoint page. Within the javascript you can use SPServices to get user info and pass it to SRC attribute of IFRAME as the part of PHP page URL .
Drawback of this is that advanced user can construct the the URL by itself and pass username of another user.
I have a problem with my fanpage. A gallery script is running a my webspace and i put it in the app also in th iframe of the Fanpage. The gallery script has get an Share button to post the photos on facebook. This part of it is running fine but when i clicked the link that was posted in Facebook i had been reffered to my page on my webspace and not to the iframe with the webpage and the photo. Is it possible to edit the link to go to this page in facebook iframe?
This is not a problem in general. You can try to redirect your website into the Facebook tab application my checking the HTTP_REFERRER and the url. You might have a look at this example
There is an URL you can try to call and see if you get redirected to the right application. Additionally, you can add app_data-parameters to the URL to identify the real target into your app.
All that can be done by the following code:
// set the target facebook page name and id to perform a forceRedirectToTab()
$tmpFbHelper
->setPageName($iniHandler->getIniSetting('facebook.'.fbHelper::getAppNamespace().'.page.name'))
->setPageId($iniHandler->getIniSetting('facebook.'.fbHelper::getAppNamespace().'.page.id'))
->setSecret($iniHandler->getIniSetting('facebook.'.fbHelper::getAppNamespace().'.secret'));
// perform a redirect to the facebook tab application if someone opens the url out of facebook
// the facebook-linter is not affected by this :)
$tmpFbHelper->forceRedirectToTab();
// perform a deeplink if for example a special url is called or you identify some app-data
$tmpFbHelper->performDeeplink();
You will have to look at your published links into the stream so that the PHP-code finds out that you will redirect and deeplink!
I hope this ideas might help you :)
I am developing an application that requires a user to view a set of videos.
How can I identify if the user has watched a particular video(complete and incomplete)?
You could embed the video on a page on your website, so you can register it that way.
You could also put a URL at the end of the video that they must follow to register they've seen the video.
I hope that the answer is "you can't" if you're talking about having watched it directly from YouTube.
You can use php's session variables, and put each video on a different webpage. Then when one video ends it redirects to another webpage and adds a value to that session. Before each page is loaded the session checks to see if the user should be on that webpage like so:
session_start();
if($_SESSION['videos']=="whatever value"){ //check to see if the session equals what value it should
$_SESSION['videos'] = 'whatever value2'; //update the value for next webpage
}
else { //if session variable doesn't equal what it should, redirect to homepage
header("Location: http://www.example.com/");
and to figure out when the video ends, just set a timer to the exact length of the video. I think you can figure that out for yourself.
Ah youtube videos. I made a YouTube Client that could do exactly what your referring to. It was a Client side URL sniffer that checked various urls for the presence of a youtube video ID. It could detect when a video was watched embedded in a site and many other places where the video could be watched.
Unfortunately, Firefox has changed their JS Engine to disallow URL sniffers, so finding if youtube videos have been watched via javascript is now out of the question. Your last option might be to authenticate the user under their youtube account and check the History. Good Luck!