Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 596417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:10:11+00:00 2026-05-13T16:10:11+00:00

The script below is a quick and dirty attempt to provide a means of

  • 0

The script below is a quick and dirty attempt to provide a means of protecting my files that I’m selling on PayDotCom and Paypal.

If anyone has experience with these services, I have a few questions…

1) Is there a token that I can set at either of these pay sites that I can then check for in the script below before executing the download?

2) In the script below, the file that is retrieved is correct, however, the filename it wants to save it to is the same as the PHP processing page (secure-download.php). How can I change the saved file’s filename? e.g. it will be a zip file.

3) There’s a few notes in the code below, I need some advice on…

<?php

    $file = basename(urldecode($_GET['file']));
    $fileDir = dirname(dirname( dirname( __FILE__ ) ) )."/secure/";

// The secure directory is outside of www root

    if (file_exists($fileDir . $file))
    {
        // Note: Need advice here to do some more checks 
        // on the filetype, size, etc.
        $contents = file_get_contents($fileDir . $file);

        // Note: Need to implement some kind 
        // of check on filetype
        header('Content-type: application/zip');

        echo $contents;
                    //currently the filename is same as the processing file, need to change it to [somefile].zip

    }

?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T16:10:11+00:00Added an answer on May 13, 2026 at 4:10 pm

    Hy im not sure i understand your uestion but i think you hae a problem with downloading the file? right if so here is your fixed code:

    <?php
    
        $file = basename(urldecode($_GET['file']));
        $fileDir = dirname(dirname( dirname( __FILE__ ) ) )."/secure/";
    
    // The secure directory is outside of www root
    
        if (file_exists($fileDir . $file))
        {
            $contents = file_get_contents();
            header("Content-Type: x-type/subtype");
            header("Content-Disposition: attachment; filename=\""$fileDir.$file"\"");
        }
    
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The script below should open all the files inside the folder 'pruebaba' recursively but
The script below illustrates a capability of set and frozenset that I would like
The script below should be exluding items that are assigned to the my-menu category.
The short bash script below list all files and dirs in given directory and
The below code is a quick script in T-SQL which builds Get Set properties
The script below has a parameter called loadurl . The loadurl represents a page
Hi Can anyone suggest a quick form script for a php form? I generated
Anyone has seen this issue before? What's the cause here? Error executing script War:
The script below works fine if 3 and 3.2 are not links but i
The script below, test.php, is intended to be placed in a specific directory of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.