Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8489713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:54:17+00:00 2026-06-10T21:54:17+00:00

I am building a web application in PHP. Users will access with their accounts.

  • 0

I am building a web application in PHP. Users will access with their accounts. They will have resources like their pictures, notes, etc. in the system, as in Facebook.

My first problem is not letting anybody to access an account’s private resource. Let say this is a picture. There are 3 situations:

  1. Everybody can access to that picture with URL of picture.
  2. A friend account of that picture’s owner account can access that picture.
  3. Only owner account can see that picture, no body else. Even with URL of picture.

I don’t know if Facebook does anything like point 1. Because business is important, and also privacy of users.

My first idea was making all resource accesses through a PHP file. But after a while it looked like really complex.

My another idea was keeping a list of all resources in a database table, and privacy setting together. This looks like a better idea, but I am not sure how performance will be affected in time.

What are your thoughts, how would you build a system like this?

P.S. I am planning to add one more web application, and create a shared resource area to put shared resource into. I will need same privilege system there as well.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T21:54:19+00:00Added an answer on June 10, 2026 at 9:54 pm

    In my experience you can best solve this by uploading your files to a directory that is not available publicly. Then you would also have some table in your database where you’d have at least three columns: the name of the file, the access level you want to give it and the user that uploaded the file.

    You could then write something that checks if the visiting user has access to the file. First it would retrieve the column containing information about the mentioned file. Based on that information, if the user has access, use readfile (see the example on the PHP manual) to display the file. In all other case you could just show a 403 Forbidden page.

    In your case the function that checks access would look something like this:

    function hasAccess($accesslevel, $owner, $visitor) 
    {
        if ($accesslevel === 'public') {
            return true;
        }
        if ($accesslevel === 'private') {
            return $owner === $visitor;
        }
        if ($accesslevel === 'friends') {
            return $owner === $visitor || isfriend($visitor, $owner);
        }
    }
    

    This is just an example, your implementation would probably be a little different, depending on your environment.

    As far as I know Facebook just allows all files to be viewed by everyone, but tries to create a url that is difficult to guess. As soon as you’ve got the url, you can just view the image itself, regardless of the privacy-settings of the user that uploaded the image.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a web application with php and mysql. Web application will have 3-4
I am building a web application that will need to allow users to save
I'm building a PHP Web Application for Company A in which users can login
I am building php web application that let's a user upload a MS Access
I am building a web application that will have a fair bit of forms.
I'm building a web application in work and I have a form where users
I am building a web application that is currently PHP with MySQL. There is
I'm building a PHP web application and need to know what the current date/time
Hello I have been tasked with creating a fairly complex web application in php,
I'm building a very small web ERP application with PHP / mySQL / CodeIgniter

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.