vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   PHP Coders - Please Help (https://vborg.vbsupport.ru/showthread.php?t=72634)

nubian 12-08-2004 04:10 AM

PHP Coders - Please Help
 
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 (
          "forums.mywebsite.com",
          "mywebsite.com",
        ) ;
      
        // Website Root
        // Where people will be sent if you dont include the file name.
        $homepage = "http://www.mywebsite.com/";
      
        // What is your email address?
        // Remove '//' and edit email to enable bad referer notification.
        //$email = "yourname@yourdomain.com" ;
      
        // ------------ END OF CONFIGURABLE SECTION ------------
      //Shouldn't need editing from here on down
      
        function isreferrerokay ( $referrer, $validprefixes )
        {
          $validreferrer = 0 ;
          $authreferrer  = current( $validprefixes );
          while ($authreferrer) {
            if (eregi( "^https?://$authreferrer/", $referrer )) {
              $validreferrer = 1 ;
              break ;
            }
            $authreferrer = next( $validprefixes );
          }
          return $validreferrer ;
        }
      
        //----------------------- main program -----------------------
      
        //File from URL
        $rta = $_GET['rta'] ;
        //Referer
        $referrer = getenv( "HTTP_REFERER" );
        
        //Gets file extension
       $split= explode(".", $rta);
       $textcount= substr_count($rta, ".")+1;
       $ttype =$split[$nextcount];
       //link to ot including path + filename
      $path = $rtadir . $rta ;
      
       //If File doesnt exist
       if (!file_exists($path)) {
         echo "The file '$rta' does not exist";
         exit;
      }
      
      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)); 
              @readfile($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>" );
              }
              echo "Invalid file.";
          }
      }
        else {
          header( "Location: $homepage" );
        }
      ?>

this code worked for a while and now it doesn't...at 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.

miz 12-08-2004 10:10 AM

well i didnt really looked on the code
but if you say that its working for your users and not for you
so the problem is not on the php code, but its on your computer !

nubian 12-08-2004 12:01 PM

i've tried it on another computer on my network and it's causing the same problem. :ermm:
they both pc's under firefox and ie


All times are GMT. The time now is 11:05 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04933 seconds
  • Memory Usage 1,731KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete