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

  • SEARCH
  • Home
  • 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 494907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:32:34+00:00 2026-05-13T05:32:34+00:00

Im adding a premium section to my site which already has free registration. People

  • 0

Im adding a premium section to my site which already has free registration. People who will pay a monthly fee will have access to content (html, images and media files) that will be hosted on a subdomain lets say….. content1.domain.com

How would I make it so files that are delivered via that subdomain, cannot be hotlinked or copied, unless the user is logged into the main site, and has a paid account ($premium = 1 site-wide variable defines that).

Im using php and mysql for the site, and lighttpd web server.

  • 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-05-13T05:32:34+00:00Added an answer on May 13, 2026 at 5:32 am

    Update:

    Example:

    http://www.pitgroup.nl/demo/protect/?file_id=1&user_id=1&file=string

    The file=string, does not work, because it is not correct with the database value;

    The page then shows a link with the correct database value which you can click to view the hidden file. The link you clicked is still at the top then, but it will not work again. The bottom of the page shows the update database value, which is a valid link again.

    To prevent hotlinking, you should actually use htacces i think.

    You should do like this:

    ( or something like it )

    mysql:
        files:
        id
        url
        created
    
        user_files:
        id
        user_id
        file_id
        string
    

    then insert a record into user_files, using the files info, and for the string, do something like:

    md5( $file->url . $file->created . $user->id );
    

    when a user calls an url, eg:

    files / fileid / sldfjsdfasduapdj123

    then you reroute it to a script, that does a lookup in the database for that string, comparing the user id and file id in the record.

    after the file has been looked up, md5 the string again and save the record.

    provide the user with headers of the requested file, look at
    http://php.net/manual/en/function.header.php

    and your done 🙂

    ( i use this for a websitet that provides flv content against sms payments )

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

Sidebar

Related Questions

Adding files to .hgignore will prevent them from being tracked. But we have some
Adding some gui modifications and I want to have a button which is 10pixels
When adding a QAction* to a QMenu who is responsible for deleting the QAction*
After adding ASIHTTPRequest to my project (which incidentally I've now removed) I get linking
Will adding an argument to member function gonna change the behavior of the function?
Adding more and more configurations to my servlet container ( Embedded Jetty in my
Adding more than one child to a WPF StatusBar results in poor layout with
Adding Exceptional Handling is a good practise, but I have a doubt, In our
Adding the row one by one in the button click.. (i tried but its
Adding functionality to a class can be done by adding a method or by

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.