upload to a file sharing site (like hotfile)to my account using php??????

Discussion in 'PHP' started by shuman202, Aug 2, 2012.

  1. #1
    hello guys,
    i have qooy script and i use it to upload to file sharing site like hotfile...etc
    i have jumbofiles.com mirror it was working like a charm until they require users to login to upload to the server
    the original
    jumbofiles.com code is like that

    
    <?php
    
    
    
    function createId() {
         $chars = "0123456789";
         $id = "20";
         while(strlen($id) < 12) $id .= $chars{mt_rand()%strlen($chars)};
         return $id;
    }
    
        $file_id = $argv[1];
        require 'includes/db.inc.php';
        require 'includes/configs.inc.php';
        
        if ($argv[2])
            $status=$argv[2];
        else 
            $status=0;   
    
    
            
            $data = mysql_query("SELECT name FROM file WHERE uid = '$file_id'") or die(mysql_error());        
            $info = mysql_fetch_array( $data ); 
            if ($status==0)
                mysql_query("INSERT INTO mirror (uid, hostid) VALUES ('$file_id', '20')") or die(mysql_error());
    
            mysql_close();
            $done=0;
            $flag=0;
    
    
        $file_loc = 'uploads/'.$info['name'];
    
            $url = "http://www.jumbofiles.com/";
    
            $reffer = "http://www.jumbofiles.com/";
            $agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4)Gecko/20030624 Netscape/7.1 (ax)";
    
    
    
             $file=@file($url);
        $count=count($file);
        for($i='0';$i<$count;$i++)
            {
                if (strstr($file[$i],"multipart/form-data")){
                    $main=$file[$i]; $flag=1;break;
                }  
                    
            }
           if ($flag==1){
                $parse=explode('action="',$main);
                $parse1=explode('" ',$parse[1]);
                $posturl=$parse1[0];
    
                $randid=createId();
    
                $posturl=$posturl.$randid."&js_on=1&utype=anon&upload_type=file";
        
                
                $postcontent = array();
                   $postcontent['file_0']='@'.$file_loc.";filename=".$info['name'];
    
                    $postcontent['upload_type'] = "file";
                $postcontent['sess_id'] = "";
            
    
    
                $ch = curl_init();
            curl_setopt($ch,CURLOPT_URL,$posturl);
            curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,2);
            curl_setopt($ch,CURLOPT_POST,1); 
            curl_setopt($ch,CURLOPT_POSTFIELDS,$postcontent);
            curl_setopt($ch,CURLOPT_USERAGENT, $agent);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
            curl_setopt($ch, CURLOPT_REFERER, $reffer);
            $result=curl_exec($ch);
    
            curl_close($ch);
            $flag=0;
            $file=explode("\n",$result);
    
                $parse=explode("<textarea name='fn'>",$file[0]);
                $parse1=explode('</textarea>',$parse[1]);
                $mirrorurl="http://www.jumbofiles.com/".$parse1[0]."/".$info['name'].".html";
    
    
    
        
                $done=1;
            }
            require 'includes/db.inc.php';
    
            if ($done==1) {
                $status=3;
                mysql_query("UPDATE mirror SET url='$mirrorurl', status='$status' WHERE uid = '$file_id' AND hostid = '20'") or die(mysql_error());
            } else {
                $status++;
                mysql_query("UPDATE mirror SET status='$status' WHERE uid = '$file_id' AND hostid = '20'") or die(mysql_error());
            }
            mysql_close();
            
    
    
    
                
    ?>
    
    Code (markup):

    the login form of the jumbofiles.com is like that
    
    
    <form method="POST" action="[URL="http://forums.digitalpoint.com/view-source:http://jumbofiles.com/"]http://jumbofiles.com/[/URL]" name="FL"> <input name="op" value="login" type="hidden"> <input name="redirect" value="" type="hidden"> <table> <tbody><tr> <td>Login:</td><td><input name="login" value="" class="myForm" type="text"></td> </tr> <tr> <td>Password:</td><td><input name="password" class="myForm" type="password"></td> </tr> </tbody></table>  <input src="[URL="http://forums.digitalpoint.com/view-source:http://jumbofiles.com/images/login.gif"]http://jumbofiles.com/images/login.gif[/URL]" type="image"> <br><br> <a href="[URL="http://forums.digitalpoint.com/view-source:http://jumbofiles.com/?op=forgot_pass"]http://jumbofiles.com/?op=forgot_pass[/URL]">Forgot your password?</a> <br><br> </form>
    
    Code (markup):

    i did the following to th code
    
    <?php
    $user= "muuser"; //Set you username
    $pass = "mypass"; //Set your password
    
    
    function createId() {
         $chars = "0123456789";
         $id = "20";
         while(strlen($id) < 12) $id .= $chars{mt_rand()%strlen($chars)};
         return $id;
    }
    
        $file_id = $argv[1];
        require 'includes/db.inc.php';
        require 'includes/configs.inc.php';
        
        if ($argv[2])
            $status=$argv[2];
        else 
            $status=0;   
    
    
            
            $data = mysql_query("SELECT name FROM file WHERE uid = '$file_id'") or die(mysql_error());        
            $info = mysql_fetch_array( $data ); 
            if ($status==0)
                mysql_query("INSERT INTO mirror (uid, hostid) VALUES ('$file_id', '20')") or die(mysql_error());
    
            mysql_close();
            $done=0;
            $flag=0;
    
    
        $file_loc = 'uploads/'.$info['name'];
    
            $url = "http://www.jumbofiles.com/";
            $POSTFIELDS = array();
                $POSTFIELDS['op'] = "login";
                $POSTFIELDS['redirect'] = "";
                $POSTFIELDS['login'] = $user;
                $POSTFIELDS['password'] =$pass;
            $reffer = "http://www.jumbofiles.com/";
            $agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4)Gecko/20030624 Netscape/7.1 (ax)";
    
    
    
             $file=@file($url);
        $count=count($file);
        for($i='0';$i<$count;$i++)
            {
                if (strstr($file[$i],"multipart/form-data")){
                    $main=$file[$i]; $flag=1;break;
                }  
                    
            }
           if ($flag==1){
                $parse=explode('action="',$main);
                $parse1=explode('" ',$parse[1]);
                $posturl=$parse1[0];
    
                $randid=createId();
    
                $posturl=$posturl.$randid."&js_on=1&utype=anon&upload_type=file";
        
                
                $postcontent = array();
                   $postcontent['file_0']='@'.$file_loc.";filename=".$info['name'];
    
                    $postcontent['upload_type'] = "file";
                $postcontent['sess_id'] = "";
            
    
    
                $ch = curl_init();
            curl_setopt($ch,CURLOPT_URL,$posturl);
            curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,2);
            curl_setopt($ch,CURLOPT_POST,1); 
            curl_setopt($ch,CURLOPT_POSTFIELDS,$POSTFIELDS);
            curl_setopt($ch,CURLOPT_USERAGENT, $agent);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
            curl_setopt($ch, CURLOPT_REFERER, $reffer);
            $result=curl_exec($ch);
    
            curl_close($ch);
            $flag=0;
            $file=explode("\n",$result);
    
                $parse=explode("<textarea name='fn'>",$file[0]);
                $parse1=explode('</textarea>',$parse[1]);
                $mirrorurl="http://www.jumbofiles.com/".$parse1[0]."/".$info['name'].".html";
    
    
    
        
                $done=1;
            }
            require 'includes/db.inc.php';
    
            if ($done==1) {
                $status=3;
                mysql_query("UPDATE mirror SET url='$mirrorurl', status='$status' WHERE uid = '$file_id' AND hostid = '20'") or die(mysql_error());
            } else {
                $status++;
                mysql_query("UPDATE mirror SET status='$status' WHERE uid = '$file_id' AND hostid = '20'") or die(mysql_error());
            }
            mysql_close();
            
    
    
    
                
    ?>
    
    
    Code (markup):

    but it didn't work
    how to modify this mirror to make it support account
     
    shuman202, Aug 2, 2012 IP