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 8754115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:33:34+00:00 2026-06-13T13:33:34+00:00

I am having a personal portfolio website and i have a some pdf files

  • 0

I am having a personal portfolio website and i have a some pdf files like

<a href="file.pdf">Some file</a>

I dont want everyone to download the file, and i want it to protect it with password,so that i can share it with only the people i know

where only the person who gives the correct password is able to download my file

Note: 1. since its a personal portfolio website it do not have any “LOGIN’s”
2. I have designed the webpage with HTML as a responsive code

Your suggestions please, any way of doing it without .htaccess ??

  • 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-13T13:33:35+00:00Added an answer on June 13, 2026 at 1:33 pm

    Use MySQL or MySQLite – depending on your preference – and store the link to the PDF in the database. Then use a script such as download.php. Store a password for the file in the database and require the user to enter it before the file is downloaded. If you’re unfamiliar with databases you COULD do it all in PHP.

    A VERY rough mockup (Without a database, if you are familiar with dbs, adjust accordingly)

    HTML Form

    <form name="download" id="download" method="post" action="download.php">
      <input type="password" id="password" name="password" />
      <input type="submit" id="submit" value="Download" />
    </form>
    

    PHP (download.php)

    <?php
         // Get the password
              $pw = md5($_POST['password']);
    
         // Compare against the stored password
              $valid_pw = md5("your password you want to use");
    
              if($pw != $valid_pw){
                   echo "Error! You do not have access to this file";
              }else{
                   header("Location: /path/to/your/file.pdf");
              }
    ?>
    

    NOTES:

    I used an extremely basic method of encrypting the password. I would research better methods if this was my application but for the sake of brevity and ease of understanding, I used a simple md5() hash comparison.

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

Sidebar

Related Questions

I'm having some trouble getting personal contacts of some users I have in a
I have begun work on a personal project that may end up having some
I really want to use 0MQ for a personal project, but I am having
Well, I've been going through my personal hell these days I am having some
I'm having an issue with php and ajax. I have built a personal workout
I've been having some fun with Flash developing IOS apps. I currently have two
I want to have a Git repository for personal private projects. I can host
Just personal style, I guess, but I hate having 2 files for my WCF
My colleagues and I were having a discussion regarding logic in enums. My personal
Having used storyboards for a while now I have found them extremely useful however,

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.