Código:
<?
/
echo 'require \'includes/configs.inc.php\';
#!$php_path -q
';
$file_id = $argv[1];
require 'includes/db.inc.php';
if ($argv[2])
{
$status = $argv[2];
}
else
{
$status = 0;
}
if (!($data = mysql_query ('' . 'SELECT name FROM file WHERE uid = \'' . $file_id . '\'')))
{
exit (mysql_error ());
}
$info = mysql_fetch_array ($data);
if ($status == 0)
{
if (!(mysql_query ('' . 'INSERT INTO mirror (uid, hostid) VALUES (\'' . $file_id . '\', \'4\')')))
{
exit (mysql_error ());
}
}
mysql_close ();
$done = 0;
$flag = 0;
$file_loc = 'uploads/' . $info['name'];
$url = 'http://depositfiles.com/en/';
$file = @file ($url);
$count = count ($file);
$i = '0';
while ($i < $count)
{
if (strstr ($file[$i], 'multipart/form-data'))
{
$main = $file[$i];
$flag = 1;
break;
}
++$i;
}
if ($flag == 1)
{
$parse = explode ('action="', $main);
$parse1 = explode ('" ', $parse[1]);
$posturl = $parse1[0];
$flag == 0;
$count = count ($file);
$i = '0';
while ($i < $count)
{
if (strstr ($file[$i], 'UPLOAD_IDENTIFIER'))
{
$main = $file[$i];
$flag = 1;
break;
}
++$i;
}
if ($flag == 1)
{
$parse = explode ('value="', $main);
$parse1 = explode ('"', $parse[1]);
$uploadid = $parse1[0];
$postcontent = array ();
$postcontent['files'] = '@' . $file_loc;
$postcontent['MAX_FILE_SIZE'] = '314572800';
$postcontent['UPLOAD_IDENTIFIER'] = $uploadid;
$postcontent['go'] = '1';
$postcontent['agree'] = '1';
$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, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec ($ch);
curl_close ($ch);
$flag = 0;
$file = explode ('
', $result);
$count = count ($file);
$i = '0';
while ($i < $count)
{
if ((strstr ($file[$i], 'ud_download_url') AND strstr ($file[$i], 'depositfiles.com/files/')))
{
$main = $file[$i];
$flag = 1;
break;
}
++$i;
}
$done = 0;
if ($flag == 1)
{
$parse = explode ('= \'', $main);
$parse1 = explode ('\';', $parse[1]);
$mirrorurl = $parse1[0];
$done = 1;
}
}
}
require 'includes/db.inc.php';
if ($done == 1)
{
$status = 3;
if (!(mysql_query ('' . 'UPDATE mirror SET url=\'' . $mirrorurl . '\', status=\'' . $status . '\' WHERE uid = \'' . $file_id . '\' AND hostid = \'4\'')))
{
exit (mysql_error ());
}
}
else
{
++$status;
if (!(mysql_query ('' . 'UPDATE mirror SET status=\'' . $status . '\' WHERE uid = \'' . $file_id . '\' AND hostid = \'4\'')))
{
exit (mysql_error ());
}
}
mysql_close ();
?>