Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Olá pessoal, estava entendo fazer um gerador de link premium. Achei um chamado LeechViet ele funciona, mais não estou podendo criar sessões no Download (para baixar mais rápido) e nem pausar.
Queria saber se vocês podem me ajudar com o código para fazer isso:
1º Poder Criar Sessões no link de Download
2º Poder pausar o download sem perder o que já fez
O Código do Download é o Seguinte:
function download(){
if (!$job = $this->lookup_job($_REQUEST['file'])){
return;
}
$filename = $this->download_prefix.$job['filename'];
if ($job['type'] == 'remote'){
header('Location: '.$job['path'].$filename);
}else if ($job['type'] == 'redirect'){
header('Location: '.$job['directlink']);
}else{
$range = '';
if (isset($_SERVER['HTTP_RANGE'])){
$range = substr($_SERVER['HTTP_RANGE'], 6);
list($start, $end) = explode('-', $range);
$new_length = $job['size'] - $start;
}
header("Cache-Control: public");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=".$filename);
header("Accept-Ranges: bytes");
header("Connection: Keep-Alive");
if (empty($range)){
header("Content-Length: {$job['size']}");
}else{
header("HTTP/1.1 206 Partial Content");
header("Content-Length: $new_length");
header("Content-Range: bytes $range/{$job['size']}");
}
if (is_array($job['directlink'])){
$link = $job['directlink']['url'];
if (preg_match('#^http://([a-z0-9]+\.)?rapidshare\.(com)/#', $job['directlink']['url'])){
include("axrotate.php");
}
}else{
$cookies = '';
$link = $job['directlink']['url'];
}
$schema = parse_url($link);
$data = "GET {$schema['path']} HTTP/1.1\r\n";
$data .= "Host: {$schema['host']}\r\n";
$data .= "User-Agent: " . JTools::web_agent() . "\r\n";
$data .= $cookies ? "Cookie: {$cookies}\r\n" : '';
if ($user && $pass){
$data .= "Authorization: Basic " . base64_encode("{$user}:{$pass}") . "\r\n";
}
if (!empty($range)) {
$data .= "Range: bytes={$range}\r\n";
}
$data .= "Connection: Close\r\n\r\n";
$fp = fsockopen($schema['host'], 80, $errno, $errstr);
if (!$fp){
die("Connection error.");
}
fputs($fp, $data);
fflush($fp);
$tmp = '';
do{
$tmp .= fgets ($fp, $this->unit);
} while (strpos($tmp, "\r\n\r\n" ) === false);
$tmp = explode("\r\n\r\n", $tmp);
if ($tmp[1]){
print $tmp[1];
}
while (!feof($fp) && (connection_status()==0)){
$recv = @fgets($fp, $this->unit);
@print $recv;
@flush();
@ob_flush();
}
fclose($fp);
}
die;
}
Essa função é ativada nesse momento:
if (isset($_REQUEST['file'])){
$this->download();
}
E o Arquivo dos Link para essa função funcionar é essa:
Array
(
[hash] => 3b64a2b8
[path] => 7504a
[filename] => C_W(C)-[EQi].rar
[size] => 311324
[msize] => 0
[mtime] => 1296986341
[speed] => 0
[url] => http://www.megaupload.com/?d=633XXVPB
[owner] => 110510000
[ip] => 127.0.0.1
[type] => direct
[directlink] => Array
(
[url] => http://www1243.megaupload.com/files/17c1d0c91c4ba07294dd353870f552a9/C_W(C)-[EQi].rar
[cookies] =>
)
)
Até o Momento eu entendi que essa função de download libera o Bluffer 1x continuamente, e que o IP que fica registrado no MegaUpload é o IP do Seridor a partir da função fsockopen() . Existe algum jeito de fazer isso sem registrar o IP de quem esta baixando no MU (Usando o Link Premium). Ja vi isso em outros Sites (Gerando um Link premium (Não o real), mais que podia fazer Sessões e Pausar o Download. Ex o Gerador do Nowloaded).
Eu ainda estou aprendendo PHP, por isso não sei essas funções "Escondidas" do PHP, só as mais simples e conhecidas.
Carregando comentários...