[PHP] Protecting a file via PHP.

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default Re: [PHP] Protecting a file via PHP.

    Hi,

    "Steve Jackson" <stephen.jackson@violasystems.com> wrote:
    > I just read this:
    > [url]http://zend.com/zend/trick/tricks-august-2001.php[/url]
    > To protect a file via PHP.
    Didn't really read this but...
    > What does this part mean in the serving the files part:
    > define('FILEDIR', '/mnt/dos/');
    >
    > Do I define the directory where the file is served from? Or do I define
    > a directory to which the file is served to (a temp) or what?
    It should be "from" and not "to".
    > No matter
    > what I've tried I get no error message and the browser (IE6) just hangs
    > so it appears that PHP is trying to serve the file but failing for some
    > reason.
    Could be a different problem...

    - E -
    __________________________________________________
    Do You Yahoo!?
    Yahoo! BB is Broadband by Yahoo!
    [url]http://bb.yahoo.co.jp/[/url]
    - Edwin - Guest

  2. Similar Questions and Discussions

    1. Protecting Video
      VJ, I'm looking for a way to protect my QT videos from being taken off the distributed cd-rom by the customer. Is there a way to prohibit someone...
    2. PROTECTING FREEHAND FILE!
      How can i protect my freehand files, that others can't chenge my files.
    3. [PHP] Getting part of a string...Was protecting a file via php
      Thanks to all so far. However I am still having problems I have directory outside the root with PDF's in it. The links to the PDF files are called...
    4. Getting part of a string...Was protecting a file via php
      OK, After much headbanging I figured out the first part of my problem. I want to retrieve a file from behind the webroot and to do this I need to...
    5. protecting CD contents
      I want to create a front end to a CD that requires a password to access the PDFs contained on the CD. What is the best way to do this so that...
  3. #2

    Default FW: [PHP] Protecting a file via PHP.



    Steve Jackson
    Web Development and Marketing Manager
    Viola Systems Ltd.
    [url]http://www.violasystems.com[/url]
    [email]stephen.jackson@violasystems.com[/email]
    Mobile +358 50 343 5159





    -----Original Message-----
    From: Steve Jackson [mailto:stephen.jackson@violasystems.com]
    Sent: 16. syyskuuta 2003 12:15
    To: 'copperwa11s@yahoo.co.jp'
    Subject: RE: [PHP] Protecting a file via PHP.

    > > What does this part mean in the serving the files part:
    > > define('FILEDIR', '/mnt/dos/');
    > >
    > > Do I define the directory where the file is served from? Or do I
    > > define a directory to which the file is served to (a temp) or what?
    >
    > It should be "from" and not "to".
    OK. The thing is I wonder why in the zend article the directory here is
    different. There are two scripts on the page: <?
    define('FILEDIR', '/downloads/');

    //display available files
    $d = dir(FILEDIR);
    while($f = $d->read())
    {
    //skip 'hidden' files
    if($f{0} != '.')
    {
    print("<a href=\"get.php?file=$f\">$f</a><br>\n");
    }
    }
    $d->close();
    ?>

    This first one looks in the downloads directory (outside the root) and
    grabs the filenames displaying them as a link. This works fine on my
    server.

    This second one starts with:
    define('FILEDIR', '/mnt/dos/');

    And I can't see an explanation why. Surely if it was meant to be the
    same the writer would have had the same route defined?

    >
    > Could be a different problem...
    >
    Could be. But I'm trying to eliminate this one first. I've tried the
    from directory and get the same error as I menioned previously. If I
    can't get this to work are there any other ways I can protect a file
    from being displayed. I need to be able to:
    1) Display links to authenticated users (php session)
    2) Let authenticated users download the files.

    I don't want to use an htaccess file unless there is a way to
    authenticate the user in htaccess by reading the session variable.
    Steve Jackson Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139