Jump to content

User acces to files after login


sever3d

Recommended Posts

Hi

I am making small service with .swf movies to watch. I want to make files unavailable to watch for users thar aren't logged in.

So ...

You log in to my site  - You have access to .swf file

You are not logged in .... you can's see it

All logged users don't have access to all files. just for files that they make account for.

 

ex.I made my account to watch videos from one category and I can't watch any movie from any different category than that I have access.

 

How to do that ? Maybe change chmod for files for user that have access to that file.

 

Link to comment
https://forums.phpfreaks.com/topic/163444-user-acces-to-files-after-login/
Share on other sites

I know how to make login system. but how to restrict access to files on server

anybody can insert path in web browser to file for example www.mywebsite.com/video/category/01.swf or www.mywebsite.com/zip/category/01.zip

and watch or download movie.

I want to restrict access to those files for not authorized users.

Just use sessions

ie

<?php
session_start();
//login check
$_SESSION['UserGroup'] = $row['group'];
//...
?>

 

<?php
session_start();
if($_SESSION['UserGroup'] < 2) //whatever!
{
die("No Access");
}
header('Content-type: application/x-shockwave-flash');
readfile("../category/01.swf"); //folder outside/below the public folder
?>

readfile("../category/01.swf"); //folder outside/below the public folder

??

I have addon domain on my serwer

/public_html/mydomain.com and inside that domain.com folde I have my website and that is root folder for that domain

where should I make

readfile("../category/01.swf"); //folder outside/below the public folder

  ?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.