Pastebin

New pastes are no longer accepted · Stats

Latest Pastes

SFD 1.1 By Doug

<?php
    /* +------------------------------------------------+
       |  Simple File Downloader 1.1 - Made By Doug ;)  |
       +------------------------------------------------+ */
    function DownloadFile($file) // Download File Function
    {
        if (file_exists($file)) // IF the File Exists
        {
            header("Content-Type: application/force-download"); // Force File Download
            header("Content-Disposition: attachment; filename=\"{$file}\""); // Show Attachment to the File
            header("Content-Transfer-Encoding: binary"); // Set Transfer Mode to Binary
            header("Accept-Ranges: bytes"); // Update Range to Bytes
            header("Cache-control: private"); // Block Cache
            header("Pragma: private"); // Block Cache
            header("Expires: Mon, 1 Jan 2001 00:01:15 GMT"); // NEW: Send updated files.
            header("Content-Length: " . filesize($file)); // Send Content Length
            header("X-Powered-By: SFD 1.1"); // A Little Credit for Me, its free, so please dont remove it
            die(file_get_contents($file)); // Send file to Client
        }
        else // Else, if the file doesn't exists
        {
            define("HTML_ERR", "<!DOCTYPE HTML><html><head><meta http-equiv=\"Content-Type\"content=\"text/html; charset=utf-8\"><title>Information</title><link rel=\"stylesheet\"href=\"http://www.dooug.com/get.dsp?u=err_style\"media=\"all\"/></head><body><div align=\"center\"><div id=\"content\"><div id=\"box\"><div id=\"header\">Information</div><div id=\"econtent\"><p>Sorry, the file you requested was not found on this server.</p><p id=\"tinfo\">[404] File Not Found.</p><div class=\"copy\">Powered by <a href=\"http://www.dooug.com/\"title=\"Visit Dooug Services\">Dooug Services</a>.</div></div></div></div></div></body></html>");
            header("HTTP/1.1 404 Not Found", true, 404); // 404 Not Found Header
            header("Status: 404 Not Found", true, 404); // 404 Not Found Header
            header("Cache-control: private"); // Block Cache
            header("Pragma: private"); // Block Cache
            header("Expires: Mon, 1 Jan 2001 00:01:15 GMT"); // NEW: Send updated files.
            die(HTML_ERR); // Shows the HTML Error Page and Exit
        }
    }
     
    /* Lets Use ? */
    set_time_limit(0); // Make the User don't stop to listen the Server
    DownloadFile("FileName.ExT"); // Force File Download
    /* Any Command Below this line will not be executed, because we've executed an die() command. */