PHP Scripting Issue

Discussion in 'Troubleshooting' started by jjump, Aug 18, 2012.

  1. jjump

    jjump New Member

    Joined:
    Jun 22, 2012
    Messages:
    14
    Okay this is probably going to take a few minutes to explain. I have had amember on two different subscription websites now. My first site is still using an older version of amember and my new site is using the newest version of amember.

    On my old site we could code in that if a story was written by a certain author the story would be a "free" story and anyone could access that story whether they had a subscription or not or whether they were logged in or not.

    Now however on the new site with the new amember program the code is automatically taking people to the login page when they click on a story regardless of author and regardless of whether the content is free or not.

    Is there a way we can delay that action or completely take out that action. We have a login widget at the top of the page, so we really don't need people redirected to login.

    We want them to be able to access certain stories without payment and without having to login. Thank you in advance for your time and help!
  2. thehpmc

    thehpmc Member

    Joined:
    Aug 24, 2006
    Messages:
    901
    Why not just remove protection for these stories?
  3. jjump

    jjump New Member

    Joined:
    Jun 22, 2012
    Messages:
    14
    Because ALL of the stories are being called by the same .php file. In the old system we were simply able to place some code in there that said if a story is written by this author don't go through the subscription check just open the story. With the way the new system is coded the subscription code is bypassing all of our other code and anytime ANY story is clicked on the subscription code is what is running first so unless they are logged in it will take them to a login page instead of the free story page or the preview system we had set up.

    I'm hoping there is a way to fix this. We have a workable solution we think, but it will kill our original concept, which is to allow ALL site visitors to access some free material without having to login at all.
  4. thehpmc

    thehpmc Member

    Joined:
    Aug 24, 2006
    Messages:
    901
    It is always possible to have a 'downloader' file placed outside of aMember protection that can then read any file protected by aMember but not be sent to aMember for verification.

    Hope that makes sense hard to put that into words!

    As an example I have a folder containing several thousand PDF files protected by aMember. Try to access them directly and you are sent to aMember. To avoid having a list of links on a page to these files ( which means they can be downloaded on block which I do not want) the actual download link goes via a 'download script ( this causes mass downloading programs fail to work).

    On my site this 'Downloading script' is protected but it would be just as easy not to. This would then mean if a file is selected via the downloader it will still download even although the actual pdf file is protected. Accessing the protected content this way doesn't invoke the actions in the .htacess file.

    This might work for you. You could simply make the 'not necessary to login to view files' work via a similar downloader script.
  5. jjump

    jjump New Member

    Joined:
    Jun 22, 2012
    Messages:
    14
    Would that work if they aren't "downloading" a file though? The way our system is set up is that we have news stories that are stored in our database. When a person clicks on a headline it opens a PHP page that then pulls out the correct story/photo combination. So they aren't technically downloading anything.

    And each story calls the exact same .php file.
  6. thehpmc

    thehpmc Member

    Joined:
    Aug 24, 2006
    Messages:
    901
    If they are viewing it on their computer then they are "downloading" the file.

    If every story calls the same .php file then how do you determine what story they can view?

    Every download my members initiate they call the same actual php file (the downloading script) with extra parameters added.

Share This Page