Creating password protected RAR files in PHP?

Posted on 2006-05-02
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
    LVL 2

    Accepted Solution

    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).
    LVL 1

    Author Comment

    thanks poedguy.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    This is a general how to create your own custom plugin system for your PHP application that you designed (or wish to extend a third party program to have plugin functionality that doesn't have it yet).  This is not how to make plugins for existing s…
    These days socially coordinated efforts have turned into a critical requirement for enterprises.
    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…
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now