In this script ask to in which folder u want to save file.
but in this script open main path is that files folder. I want to that open only files/Songs path. So how to edit ?
but in this script open main path is that files folder. I want to that open only files/Songs path. So how to edit ?
PHP Code:
<?
require '../moduls/connect.php';
require '../moduls/fun.php';
require '../moduls/ini.php';
require '../moduls/header.php';
if ($_GET['do'] != 'grab')
{
echo '<html>
<head>
<title>Leacher</title>
</head>
<body>
<center>
<h3>Lets leech</h3>
<br/>
<form action="index.php?do=grab" method="post">
Url: <input type="text" name="link"><br/>';
$dirs = mysql_query('SELECT `path` FROM `files` WHERE `size` = 0');
echo 'Save to:<br>
<select class="buttom" size="1" width="70" name="topath"><option value="'.$setup['path'].'/">./</option>';
while($item = mysql_fetch_assoc($dirs)){
$name = str_replace($setup['path'].'/','',$item['path']);
$path = explode('/',$name);
$option = '';
unset($path[sizeof($path)-1]);
foreach($path as $value){
if(strpos($value , '!') !== false) $name = trans($value); else $name = $value;
$option = $option.$name.'/';
}
echo '<option value="'.$item['path'].'">'.$option.'</option>';
}
echo '<input type="submit" value="Submit" >';
echo '</form>
<br/><br/>';
}else{
$file = '../'.$_POST['topath'];
$search = array(".zip",".rar",".sis", ".jar", ".sisx", ".3gp", ".mp4", ".avi", ".nth", ".thm", ".mp3", ".wav", ".exe");
function getLinks($link)
{ $ret = array();
$dom = new domDocument;
@$dom->loadHTML(file_get_contents($link));
$dom->preserveWhiteSpace = false;
$links = $dom->getElementsByTagName('a');
foreach ($links as $tag)
{
$ret[$tag->getAttribute('href')] = $tag->childNodes->item(0)->nodeValue;
}
return $ret;
}
if(!is_dir($file)) mkdir($file);
$link = $_POST['link'];
if($link){
$urls = getLinks($link);
if(sizeof($urls) > 0)
{
foreach($urls as $key=>$value)
{
$find = str_replace($search, '|',strtolower($key));
if(substr_count($find,'|')>0){
if(substr_count($key,'http')<1)
$key = $link.$key;
$ice = explode('/',$key);
$num = count($ice)-1;
$local = explode('?',$file.$ice[$num]);
$local = $local[0];
if(copy($key, $local))
echo '<div class="row">Copied <a href="'.$file.$ice[$num].'">'.$ice[$num].' </a> Successfully</div>';
else
echo '<div class="row">Could Not Copy '.$ice[$num].'</div>';
}
}
}else{
echo "No links found at $link";
}
}
}
echo '</center>
</body>
</html>';
?>
Comment