Rapidshare Premium Link Generator

January 30th, 2020

Theres something wrong with the code..
I think its the part where it fetches the username and pass in the database
can anyone help me witth this please?
<?php
error_reporting(E_ERROR | E_PARSE);
define( 'IBIET', 1 );
@require "config.php";
@require "function.php";
@require "db.php";
class RapidFool {
    //-----------------------------------------------------
    // initialize
    //-----------------------------------------------------
    function initialize()
    {
        global $ibiet, $std, $DB, $INFO;
        $this->vars = &$INFO;
        $act = $_GET['action'];
        if($_POST['url'] != "")
        {
            $act = "makeurl";
        }
        $action = array("makeurl", "download");
        if(in_array($act, $action))
        {
            $this->$act();
            return;
        }
        else
        {
            $this->welcome();
        }
    }
    //-----------------------------------------------------
    // Welcome Screen
    //-----------------------------------------------------     function welcome()
    {
        global $ibiet, $std, $skin, $DB;
        $data = array();
        $check_serv = $this->serverload();
        if($check_serv['overloaded'])
        {
            $stage = "disabled";
            $txtstring = $check_serv['msg'];
        }
        else
        {
            if($ibiet->vars['premium_act'])
            {
                $t = $DB->query("SELECT * FROM accounts WHERE id = '".intval($ibiet->vars['premium_act'])."'");
                $r = $DB->fetch_array($t);
                if($r['login'] != "")
                {
                    $txtstring = "Enter ~ Dead file host ~ URL here";
                }
                else
                {
                    $stage = "disabled";
                    $txtstring = "<span style='color:#688000; font-size : 10pt; text-decoration: none; font-family: Trebuchet MS;'><b>Sorry, we're out of premium account at the moment.</b></span>";
                }
            }
            else
            {
                $stage = "disabled";
                $txtstring = "<span style='color:#688000; font-size : 10pt; text-decoration: none; font-family: Trebuchet MS;'><b>Sorry, we're out of premium account at the moment.</b></span>";
            }
        }
        if($ibiet->vars['dl_limit_perday'] > 0)
        {
            $l_limit = time() - 60*60*24;
            $ip = $_SERVER['REMOTE_ADDR'];
            $l = $DB->query("SELECT * FROM logs WHERE fdate > '$l_limit' AND ip = '$ip'");
            $link_downloaded = $DB->get_num_rows($l);
            $link_downloaded = ($link_downloaded) ? $link_downloaded : 0;
            $stat = "<span style='color:#688000; font-size : 10pt; text-decoration: none; font-family: Trebuchet MS;'>So far you have downloaded $link_downloaded/{$ibiet->vars['dl_limit_perday']} links limit.</span>";
        }
        $data['html'] .= "<script>\n";
        $data['html'] .= "function CheckForm() {\n";
        $data['html'] .= "  url = document.getElementById('url');\n";
        $data['html'] .= "  if (url) {\n";
        $data['html'] .= "      if (url.value.substr(0,21) != \"http://~ Dead file host ~\") {\n";
        $data['html'] .= "          alert(\"Please enter valid ~ Dead file host ~ URL\");\n";
        $data['html'] .= "          return false;\n";
        $data['html'] .= "      }\n";
        $data['html'] .= "  }\n";
        $data['html'] .= "}\n";
        $data['html'] .= "</script>\n";
        $data['html'] .= "<form action=\"{$ibiet->vars['base_url']}\" method=\"post\" onsubmit=\"return CheckForm()\">\n";
        $data['html'] .= "<input type=\"text\" id=\"url\" style=\"text-align:center\" name=\"url\" value=\"$txtstring\" size=\"60\" onfocus=\"if(this.value=='Enter ~ Dead file host ~ URL here'){this.value=''}\" $stage>\n";
        $data['html'] .= "<br><input type=\"submit\" value=\"Download\" $stage></form>";
        $data['html'] .= $stat;
        $data['title'] = "Heavengrounds.com Rapidshare Premium link generator";
        $std->_print($data);
    }
    //-----------------------------------------------------
    // Generate Link Screen
    //-----------------------------------------------------
    function makeurl()
    {
        global $ibiet, $std, $DB;
        $data = array();
        $link = addslashes(trim($_POST['url'])) ;
        $url = @parse_url($link);
        $ip = $_SERVER['REMOTE_ADDR'];
        if($url['host'] != "~ Dead file host ~" || !preg_match("#^/files/#", $url['path']))
        {
            $data['html'] = "<span style='color:#688000; font-size : 10pt; text-decoration: none; font-family: Trebuchet MS;'><b>Please enter valid ~ Dead file host ~ link.</b></span>";
            $data['title'] = "Error";
            $std->_print($data);
            return;
        }
        $refererr = @parse_url($_SERVER['HTTP_REFERER']);
        if($refererr['host'] != $_SERVER['HTTP_HOST'])
        {
            $data['html'] = "<span style='color:#688000; font-size : 10pt; text-decoration: none; font-family: Trebuchet MS;'><b>No leeching, visit http://{$_SERVER['HTTP_HOST']} for more info</b></span>";
            $data['title'] = "Error";
            $std->_print($data);
            return;
        }
        if(!$ibiet->vars['premium_act'])
        {
            $data['html'] = "<span style='color:#688000; font-size : 10pt; text-decoration: none; font-family: Trebuchet MS;'><b>Sorry, we're out of premium account at the moment.</b></span>";
            $data['title'] = "Error";
            $std->_print($data);
            return;
        }
        if($ibiet->vars['dl_limit_perday'] > 0)
        {
            $l_limit = time() - 60*60*24;
            $l = $DB->query("SELECT * FROM logs WHERE fdate > '$l_limit' AND ip = '$ip'");
            $link_downloaded = $DB->get_num_rows($l);
            $link_downloaded = ($link_downloaded) ? $link_downloaded : 0;
            if($link_downloaded >= intval($ibiet->vars['dl_limit_perday']))
            {
                $data['html'] .= "<br><span style='color:#688000; font-size : 10pt; text-decoration: none; font-family: Trebuchet MS;'>You have downloaded $link_downloaded/{$ibiet->vars['dl_limit_perday']} links already.</span>";
                $data['title'] = "Error";
                $std->_print($data);
            }
        }
        $t = $DB->query("SELECT * FROM accounts WHERE id = '".intval($ibiet->vars['premium_act'])."'");
        $r = $DB->fetch_array($t);
        $full_link = $std->getserver($link);
        $try = $std->getFileInfo($full_link, $r);
        $filename = $try['filename'];
        $fsize = $try['fsize'];
        $now = time();
        $fid = md5( uniqid(microtime()) );
        $DB->query("INSERT INTO logs SET fid='$fid',filename='{$filename}',ip='$ip',fdate='$now',furl='$full_link', filesize='$fsize'");
        $dlurl = $ibiet->vars['base_url']."?action=download&id=$fid";
        $data['html'] .= "<br><a href='$dlurl'><span style='color:#688000; font-size : 10pt; text-decoration: none; font-family: Trebuchet MS;'>Click here to download this file <br><b>$filename</b></span></a>\n";
        $data['title'] = "Download";
        $std->_print($data);
    }
    //-----------------------------------------------------
    // Download Screen
    //-----------------------------------------------------
    function download()
    {
      global $ibiet, $std, $DB;
        $id = addslashes(trim($_GET['id'])) ;
        if(strlen($id) != 32)
        {
            @header("HTTP/1.0 404 Not Found");
            echo "<span style='color:#688000; font-size : 10pt; text-decoration: none; font-family: Trebuchet MS;'><b>404! File not found</b></span>";
            exit;
        }
        $t = $DB->query("SELECT * FROM accounts WHERE id = '".intval($ibiet->vars['premium_act'])."'");
        $r = $DB->fetch_array($t);
        $limit = time() - 60*60*6; //Only download link that was generated in the last 6 hours
        $ip = $_SERVER['REMOTE_ADDR'];
        $q = $DB->query("SELECT * FROM logs WHERE fid='$id' AND ip='$ip' AND fdate > '$limit'");
        $row = $DB->fetch_array($q);
        $url = @parse_url($row['furl']);
        if($row['furl'] == "")
        {
            @header("HTTP/1.0 404 Not Found");
            echo "<span style='color:#688000; font-size : 10pt; text-decoration: none; font-family: Trebuchet MS;'><b>404! File not found</b></span>";
            exit;
        }
        @header("Cache-Control:");
        @header("Cache-Control: public");
        @header("Content-Type: application/octet-stream");
        @header("Content-Disposition: attachment; filename=".$row['filename']);
        @header("Accept-Ranges: bytes");
        if(isset($_SERVER['HTTP_RANGE']))
        {
            list($a, $range)=explode("=",$_SERVER['HTTP_RANGE']);
            $range = str_replace("-", "", $range);
            $new_length = $row['filesize'] - $range;
            @header("HTTP/1.1 206 Partial Content");
            @header("Content-Length: $new_length");
        }
        else
        {
            @header("Content-Length: ".$row['filesize']);
        }
        $vars = "dl.start=PREMIUM&uri={$url['path']}&directstart=1";
        $head = "Host: {$url['host']}\r\n";
        $head .= "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)\r\n";
        $head .= "Cookie: user={$r['login']}-{$r['password']}\r\n";
        $head .= "Content-Type: application/x-www-form-urlencoded\r\n";
        if($range != "") $head .= "Range: bytes={$range}-\r\n";
        $head .= "Content-Length: ".strlen($vars)."\r\n";
        $head .= "Connection: close\r\n\r\n";
        $fp = @fsockopen($url['host'], 80, $errno, $errstr);
        if (!$fp)
        {
            echo "<span style='color:#688000; font-size : 10pt; text-decoration: none; font-family: Trebuchet MS;'>The script says <b>$errstr</b>, please try again later.</span>";
            exit;
        }
        @stream_set_timeout($fp, 300);
        fputs($fp, "POST {$url['path']}  HTTP/1.1\r\n");
        fputs($fp, $head.$vars);
        fflush($fp);
        $buff = 256;
        while (!feof($fp))
        {
            $data = fgets($fp, $buff);
            if($headerdone)
            {
                print $data;;
            }
            if(!$headerdone)
            {
                $tmp .= $data;
                $d = explode("\r\n\r\n", $tmp);
                if($d[1])
                {
                    print $d[1];
                    $headerdone = true;
                    $buff = 1024;
                }
            }
            flush();
            ob_flush();
        }
        @fclose($fp);
        exit;
    }
    //-----------------------------------------------------
    // Check Server Load
    //-----------------------------------------------------
    function serverload()
    {
        global $ibiet, $std, $DB;
        if ( @file_exists('/proc/loadavg') )
        {
            if ( $fh = @fopen( '/proc/loadavg', 'r' ) )
            {
                $data = @fread( $fh, 6 );
                @fclose( $fh );
                $load_avg = explode( " ", $data );
                $server_load = trim($load_avg[0]);
                if ($server_load > $ibiet->vars['serverload'])
                {
                    return array('overloaded' => 1, 'loaded' => $server_load, 'msg' => "<span style='color:#688000; font-size : 10pt; text-decoration: none; font-family: Trebuchet MS;'><b>Sorry, the server is overloaded, please try again in a moment</b></span>");
                }
            }
        }
        else
        {
            if ( $serverstats = @exec("uptime") )
            {
                preg_match( "/(?:averages)?\: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/", $serverstats, $load );
                $server_load = $load[1];
                if ($server_load > $ibiet->vars['serverload'])
                {
                    return array('overloaded' => 1, 'loaded' => $server_load, 'msg' => "<span style='color:#688000; font-size : 10pt; text-decoration: none; font-family: Trebuchet MS;'><b>Sorry, the server is overloaded, please try again in a moment</b></span>");
                }
            }
        }
    }
} // End Class
$ibiet = new RapidFool;
$ibiet->initialize();
?>

Answer #1
I am actually trying to convert this script to n00b-readable format PHP code (I’m only learning PHP so this objects and classes stuff is a bit beyond me at the moment!), without the need for MySQL, but I’m having a bit of trouble with it. I know this is the IBIET premium link generator code. If I get my simplified code to work, i can hopefully make a bulk-link generator, because my RS account’s bandwidth is being wasted – so I could share it with people this way.
Why, what error are you getting with the code that it won’t work? It worked for me fine, just a ‘Duplicate entry for…’ every now and then, but clearing the database usually fixed that. There was also an error in the MySQL file before import, but that was easy to fix. I don’t think anybody is going to be bothered reading through all this code (myself included!) unless you tell us some errors you receive which lead you to believe where in the code the error is!
Answer #2
Well it generates a link but then when I click downlaod to the link it downloads this 6kb file and if i open it in web browser it goes to the RS login page…
Answer #3
1) Make sure the link actually exists on the RS servers. I have tried to download files from RS thinking my account details were wrong, when in actual fact the link I was trying to download was either ‘expired’ or ‘forbidden to be shared’ (deleted), so it made no difference anyway!
2) If you have entered your details properly in the database for the script, it should work. You have to use your Customer-ID, not your alias, as using your username alias (that you can create yourself in RS settings), doesn’t seem to work with this script.
Answer #4
oh no wonder customer ID….do u know wher eI can check that?
Answer #5
yeah, I have been wondering is there a way to do this easily – but for now, the only way I know how to do it is to try to extend your account – click on Extend Account, and then you will be brought to paypal, and in the top of the page you can see something like ‘extend #7777’ whatever, there it is!
Answer #6
im still getting the 6kb file…>_<
Answer #7
yeah, it’s a pretty buggy script.
pm me your msn / gtalk / yahoo id and we can check there i suppose. on this forum it could take a century to find out what’s wrong!
Answer #8
this script is way old… download rapidshot (use google)
Answer #9
Download latest Rapidshot.v4Script (Use Rapidshot.com)

 

| Sitemap |