<?php
global $prefix, $dbi;
include_once("mainfile.php");
$url_downloads_folder = "http://www.humpa.com/images/"; // put the url to the
// directory with your downloads - you need the trailing slash!
$cat = 2; // the download category id (cid)
$description = "You can put a generic description here - this will be on all of them!!!!";
$name = "PutThe_Subbmitted_By_Name_Here";
$email = "PutEmailHere";
$the_hits = 0; // you can change this if you want
$filesize = 0; // you can change this if you want
$version = ""; // you can put something betwenn the quotes if you want, or leave them empty
$homepage = "http://www.HomePage.com";
$fp = @fopen("$url_downloads_folder","r");
if($fp) {
echo "success opening the $url_downloads$downloads_folder folder.<br><br>";
$i=1;
$buffer = "";
while (!feof ($fp)) {
$i++;
$buffer_temp = fgets($fp, 2048);
$buffer = "$buffer$buffer_temp";
}
fclose ($fp);
}else {
echo "couldn't connect to $url_downloads_folder";
die();
}
//$buffer = str_replace("A HREF=\"/", "", $buffer);
//$buffer = str_replace("A HREF=\"?", "", $buffer);
$i=0;
while(eregi("(<A HREF=\")([a-zA-Z0-9._-]+)(\">)",$buffer,$array_data)) {
$i++;
$buffer = str_replace($array_data[1].$array_data[2].$array_data[3],"",$buffer);
//echo "$array_data[2] is data-2<br>";
$file_names[$i] = $array_data[2];
}
echo "found $i files<br>";
while($i>0) {
//echo "$file_names[$i]<br>";
$title = eregi_replace("(.+)(\.)(.+)","\\1",$file_names[$i]);
$url = $url_downloads_folder.$file_names[$i];
$the_sql_querys .= "insert into ".$prefix."_downloads_downloads values
(NULL, '$cat', '0', '$title', '$url', '$description', now(), '$name', '$email',
'$the_hits',",'0','0','0', '$filesize', '$version', '$homepage');<br><br>";
$i--;
}
echo "<br><br>$the_sql_querys";
?>
|