No announcement yet.

PHP Coders Help Please

  • Filter
  • Time
  • Show
Clear All
new posts

  • PHP Coders Help Please

    this is my php code:

    PHP Code:
    // ---------------- CONFIGURABLE SECTION -----------------
             // Please modify the following or it will not work on your website.
             // Relative to this .php file, ie. This file should not be in "thisotfolder".
             // Make sure that the path you put below ends with a directory slash ("/"). The script below assumes it.
    $rtadir "videos/" ;
    // Valid Referers
             // Do not put any trailing slashes ("/") nor any "http://" prefixes.
    $validprefixes = array (
             ) ;
    // Website Root
             // Where people will be sent if you dont include the file name.
    $homepage "";
    // What is your email address?
             // Remove '//' and edit email to enable bad referer notification.
             //$email = "[email protected]" ;
             // ------------ END OF CONFIGURABLE SECTION ------------
           //Shouldn't need editing from here on down
    function isreferrerokay $referrer$validprefixes )
    $validreferrer ;
    $authreferrer  current$validprefixes );
               while (
    $authreferrer) {
                 if (
    eregi"^https?://$authreferrer/"$referrer )) {
    $validreferrer ;
                   break ;
    $authreferrer next$validprefixes );
    $validreferrer ;
    //----------------------- main program -----------------------
             //File from URL
    $rta $_GET['rta'] ;
    $referrer getenv"HTTP_REFERER" );
    //Gets file extension
    $ttype =$split[$nextcount];
    //link to ot including path + filename
    $path $rtadir $rta ;
    //If File doesnt exist
    if (!file_exists($path)) {
    "The file '$rta' does not exist";
           if (isset(
    $_GET['rta'])) {
               if (
    isreferrerokay($referrer$validprefixes)) {
    header('Content-Description: File Transfer');
    header('Content-Type: application/force-download');
    header('Content-Length: ' filesize($path));
    header('Content-Disposition: attachment; filename=' basename($path)); 
               else {
                   if (isset(
    $email)) {
    mail$email"Bandwidth Theft Alert",
    "WARNING:\n\n$referrer\ntried to access\n$rta\n",
    "From: RTA Anti-Leech <$email>" );
    "Invalid file.";
             else {
    header"Location: $homepage);
    this code worked for a while and now it doesn' least for me.
    i was able to click on the link and it gave me a dialog window to download the video from my forum.
    now it won't give me that dialog window to download when i click on the link. it'll give the "invalid file" error.
    but users on my board are still able to click on the link with no problem except for me.
    sometimes it works and sometimes it doesn't like if the code is unstable.
    what gives???

    i'm not much of a php coder.
    this file was given to me by someone i know.
    i'm having troubles getting a hold of this person.
    is there anyway that i can optimize this file?
    any one of you can tell me why it stopped working and it allows my other members to download?
    any help on how to fix this issue will be greatly appreciated.
    thanks in advance.
    Last edited by nubian; Wed 8th Dec '04, 4:23pm.