Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Creating password protected RAR files in PHP?

Posted on 2006-05-02
Medium Priority
Last Modified: 2006-11-18
I need to dynamically create a password protected RAR file with a file inside it. The password would be the same as that of the user downloading the file.

Alternatively, I need a way to password protect a PDF document, also dynamically.

Any help you can give would be much appreciated, as I've looked all over and found no luck.
Question by:spikeyjames

Accepted Solution

poedguy earned 1000 total points
ID: 16602256
If your host allows you to execute files and if it has RAR installed, you can do it with the following command (change it as necessary):

exec("rar a -p[password] archive.rar file1.ext file2.ext");

Change [password] with the password (e.g. if the password was "password" then it would be -ppassword).

Author Comment

ID: 16784504
thanks poedguy.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
This holiday season, we’re giving away the gift of knowledge—tech knowledge, that is. Keep reading to see what hacks, tips, and trends we have wrapped and waiting for you under the tree.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question