Is there a free script which I can use to:

Share some PDF with my partners. But i need the user to reach only those PDFs which they have privileges for. So I need:

  • login script with registration (i will make the registration if need. So registration function will public)
  • every user should have their own member area
  • I will upload PDFs to the specified user areas
  • when my partners sign in they can see only those PDFs that they have privileges for
  • Skydrive would be a lot easier.
    – ZippyV
    Commented May 9, 2012 at 9:40
  • 1
    You can also try Google Docs for this type of thing. Would save you the trouble of setting this up yourself. Commented May 10, 2012 at 4:14

2 Answers 2


I would recommend using Google Docs for this.

In broad strokes: If you insist on creating this feature yourself, you would need to store your user info (user ID, Password, etc) in a table in a database.
Then you'd need a second table which has the info on the PDF files (link, name, which user ID's have access to it).
When a user logs in you would run a query to authenticate them with their user ID and password from the users table, and checks at the same time which PDF files are accessible to that user.

Your login form would look something like this:

<form name="login" action="login.php" method="post">  
  User ID: <input type="text" name="user" /><br />  
  Password: <input type="text" name="pass" /><br />  
  <input type="submit" value="Sign In" />  

Your login.php file would have something like this:

  $query = mysql_query("SELECT userID, password FROM users_table WHERE userID = '$_POST['user']'");  
  $get_user = mysql_fetch_array($query);  
  if ($get_user['password_column'] == $_POST['pass']){  
    //user is logged in!  
  else {  
    //invalid username or password  

Your PDF file info table would have to have at the least the PDF file name and which users are allowed to view/download that file. Once the user is logged in you would run a query which looks something like this (assuming you have the user name stored in the PHP variable $user:

SELECT * FROM pdf_table WHERE MATCH(allowed_users_column) AGAINST ('$user')  

So to make a long story short: it is very possible to do this. The code I've posted is rudimentary and basic at best, but it should give you a general idea of how to accomplish this if you cannot use a service like Google Docs for this.

  • If you implement this make sure you escape properly all fields coming from the form. Also a good idea would be to encrypt the password.
    – milo5b
    Commented Jul 22, 2012 at 10:44

UserCake is an open source PHP user management script which has registration features and user group features which you could use to manage who has access to which PDF files.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.