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

  1. #1

    Default Re: [PHP] Restricted access

    Yes, put the files outside of web root or protect them using .htaccess
    file. After authorization use readfile90 to serve the file. There are
    lots of tutorials on authentization and if you are using some CMS you
    might have all you need.

    Ciprian Trofin wrote:
    > Hi All,
    >
    > I want to give access to resources (PDFs and some RTFs) only to registered
    > users and I also want to deny that kind of access to people that "guess"
    > the URL. I guess it is all about putting these files outside the web-tree
    > and somehow putting PHP to work.
    >
    > Could you enlighten me ? )
    >
    > --
    > Thnx,
    > Cip
    >
    >
    Marek Kilimajer Guest

  2. Similar Questions and Discussions

    1. Webservice with restricted ip access
      I've consumed a webservices that will only accept connection from my servers IP address and a password. When I run the file locally on the server...
    2. Restricted to Page
      I am building a login page by following the Part 2: http://www.macromedia.com/devnet/mx/dreamweaver/articles/php_blog2.html. I'm using Windows...
    3. Time restricted access to folder?
      Hello I wonder if there is a way when using .htaccess /.htpasswd to restrict access to a web site folder for a limited time, eg 0.5 hr? Cheers...
    4. Problem with web.config access-restricted subdirectory
      Hi, I have a problem with web.config unsuccessfully controlling access to a subdirectory. I'm using VS03 and IIS5.0 on NT2K. I have been able...
    5. Unable to access Tools/Internet Optios in I.E. - Restricted
      Am using XP-Pro with two accounts the first as an administrator and the second as a user (Both accounts having different names) While using I.E...
  3. #2

    Default Restricted access

    Hi All,

    I want to give access to resources (PDFs and some RTFs) only to registered
    users and I also want to deny that kind of access to people that "guess"
    the URL. I guess it is all about putting these files outside the web-tree
    and somehow putting PHP to work.

    Could you enlighten me ? )

    --
    Thnx,
    Cip

    Ciprian Trofin Guest

  4. #3

    Default Re: Restricted access

    Ciprian Trofin wrote:
    > Hi All,
    >
    > I want to give access to resources (PDFs and some RTFs) only to registered
    > users and I also want to deny that kind of access to people that "guess"
    > the URL. I guess it is all about putting these files outside the web-tree
    > and somehow putting PHP to work.
    >
    > Could you enlighten me ? )
    >
    [url]http://php.net/fpassthru[/url] is the answer to the web-tree problem.

    The authentication is a different matter. I have my own method - I'm
    sure others have other/better methods.

    Kae

    Kae Verens Guest

  5. #4

    Default Re: [PHP] Restricted access

    What is readfile90 ? I tried google and nothing.
    MK> Yes, put the files outside of web root or protect them using .htaccess
    MK> file. After authorization use readfile90 to serve the file. There are
    MK> lots of tutorials on authentization and if you are using some CMS you
    MK> might have all you need.
    >> I want to give access to resources (PDFs and some RTFs) only to registered
    >> users and I also want to deny that kind of access to people that "guess"
    >> the URL. I guess it is all about putting these files outside the web-tree
    >> and somehow putting PHP to work.
    Ciprian Trofin Guest

  6. #5

    Default Re: [PHP] Restricted access

    I'm sorry, should be readfile(). Switched keyboard.

    Ciprian Trofin wrote:
    > What is readfile90 ? I tried google and nothing.
    > MK> Yes, put the files outside of web root or protect them using .htaccess
    > MK> file. After authorization use readfile90 to serve the file. There are
    > MK> lots of tutorials on authentization and if you are using some CMS you
    > MK> might have all you need.
    >
    >
    >>>I want to give access to resources (PDFs and some RTFs) only to registered
    >>>users and I also want to deny that kind of access to people that "guess"
    >>>the URL. I guess it is all about putting these files outside the web-tree
    >>>and somehow putting PHP to work.
    >
    >
    >
    Marek Kilimajer Guest

  7. #6

    Default Re: Restricted access

    There is a easier way, I use this all the time and I don't have a problem
    with it. Sometime the header() need some tweaking to make it work right.
    You must include an exit() function after the header() due to bugs and bugs
    in IE. This script below is what I use for file download. Instead of file
    download, you can easily tweak the header to any of other things like
    display PDF without knowing where hte real file is...

    --snip-- "HTML Link"
    echo "<a href='$PHP_SELF?dw_code=0'>\n";
    --snip--

    --snip-- "PHP Script"
    //Script for File Download... (DP, Temp, etc...)
    //(1st --> Original File (File on Server)...
    //(2nd --> Renamed File & Fake File Path (Browser Download)...
    //(3rd --> Hyperlink (Display Comment)...
    $DownloadUpdateArray[0] = array('update\setup.exe','setup.exe','Special
    Feature Update 1.0');

    if (strlen(trim($_REQUEST['dw_code']))!=0) {
    //Send Downloadable File(s) To Browsers...

    $file=$DownloadUpdateArray[$_REQUEST['dw_code']][0];
    header ("Pragma: public");
    header ("Expires: 0"); // set expiration time
    header ("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header ("Content-Type: application/force-download");
    header ("Content-Type: application/octet-stream");
    header ("Content-Type: application/download");

    header ("Content-Disposition: attachment;
    filename=\"".$DownloadUpdateArray[$_REQUEST['dw_code']][1]."\";");
    header ("Content-Length: ".filesize($file));
    header ("Content-Transfer-Encoding: binary");

    //Can't use readfile() due to poor controling of the file download.
    //(IE have this problems)...
    //readfile($file);

    //use fopen() instead of readfile...
    $fp = fopen($file, 'rb');
    $content = fread ($fp, filesize($file));
    fclose ($fp);

    print $content;
    }

    //Required, to keep IE from running into problems
    //when opening the file while downloading or downloading...
    //(IE been acting strange lately...)
    exit();
    }
    --snip--
    "Kae Verens" <kverens@contactjuggling.org> wrote in message
    news:20030814123110.72614.qmail@pb1.pair.com...
    > Ciprian Trofin wrote:
    > > Hi All,
    > >
    > > I want to give access to resources (PDFs and some RTFs) only to
    registered
    > > users and I also want to deny that kind of access to people that "guess"
    > > the URL. I guess it is all about putting these files outside the
    web-tree
    > > and somehow putting PHP to work.
    > >
    > > Could you enlighten me ? )
    > >
    >
    > [url]http://php.net/fpassthru[/url] is the answer to the web-tree problem.
    >
    > The authentication is a different matter. I have my own method - I'm
    > sure others have other/better methods.
    >
    > Kae
    >

    Scott Fletcher Guest

  8. #7

    Default Restricted access

    Two problems the first is the easiest. When I click on home a new page opens
    instead of going back to the opened homepage. The second is a bit more
    complicated. I want to allow clients to log in and access their own pages and
    not others. Site is: [url]www.kloco.net[/url] go to project>Emma or any link. Every thing
    is behind the login and that is as far as anyone can go

    I have all the files and plug-ins and programs that help suggests. The login
    page is ASP Net page I have: ISS, .Net Framework 1.1 and SDK, and SQR Express.
    When I press the + and select dataset, it says that no table found (I have an
    access .mdb in the root folder) and then asks for ?select statement. I am lost.
    I want to allow clients to access there own pages and not others.


    KLOCO Guest

  9. #8

    Default Re: Restricted access

    First Queston: You probably have target="_blank" in the <a> tag. Remove this.

    Second Question: You will need to create a DB connection to your database

    jeremyluby Guest

Posting Permissions

  • You may not post new threads
  • You may not 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