|
|
| Author |
Message |
meetzah Warrant Officer

Joined: 09 Aug 2005 Posts: 63
|
Posted: Thu Feb 16, 2006 4:26 pm Post subject: How to add 200+ filles to the PHP-Nuke Downloads module |
|
|
|
hello,
I just got 200+ filles for my download module and I need to make them available to public. there is any way to make them available in "bulk"? I mean if I can place them all to my download module without adding each fille manualy.
I hope you understand what I want to do. Please help me if you know how to resolve this problem.
Thank you. _________________ Life has given nothing to mortals without hard work! |
|
| Back to top |
|
 |
chris Dark Lord of the Sith

Joined: 10 May 2003 Posts: 6262 Location: Outer Space
|
|
| Back to top |
|
 |
meetzah Warrant Officer

Joined: 09 Aug 2005 Posts: 63
|
Posted: Fri Feb 17, 2006 4:13 pm Post subject: |
|
|
|
Hello,
I try to use that script to add 200+ filles to my download module in phpnuke 7.7 version. I set the address correct and all other setiings in script but I don't succes. My site is e-oferta.ro and my download folder is e-oferta.ro/docs
Can you please tell me what I do wrong? Also, here is the downloadadd.php fille i run on my root folder. Also, I don't have a index.htm fille om my download folder. My download filles have spaces is the name. Is there a problem?
Thank you.
| Code: | <?php
global $prefix, $dbi;
include_once("mainfile.php");
$url_downloads_folder = "http://www.e-oferta.ro/docs/"; // put the url to the
// directory with your downloads - you need the trailing slash!
$cat = 1; // the download category id (cid)
$description = "Model de contract. Folositi pe propria raspundere.";
$name = "meetzah";
$email = "admin@e-oferta.ro";
$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.e-oferta.ro";
$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";
?> |
_________________ Life has given nothing to mortals without hard work! |
|
| Back to top |
|
 |
chris Dark Lord of the Sith

Joined: 10 May 2003 Posts: 6262 Location: Outer Space
|
Posted: Thu Feb 23, 2006 11:07 am Post subject: |
|
|
|
| meetzah wrote: | My download filles have spaces is the name. Is there a problem?
 |
Oh yes, a big one indeed.
That's a damage that Microsoft has done in users brains...
Space is a command option delimiter (i.e. it is used to separate filenames from other things like options, parameters, other filenames etc. on the command line), how on earth would one think of misusing it as part of a filename?
You have to "escape" the spaces in filenames, i.e. you have to use "\ " (backslash space) whenever you see a " " in the filename.
What's worse, you may have to escape the backslash with another backslash, so that the sed scripts work (not sure about that).
You open a Pandorra's Box with blanks in filenames. The URLs for your web server must then contain "%20" in place of blanks. That is "http://www.mysite.xx/some filename with blanks in the name.html" must become "http://www.mysite.xx/some%20filename%20with%20blanks%20in%20the%20name.html".
Is that all worth the trouble? Are those blanks in the filenames a MUST? Then go ahead and do all these changes in the scipts and so on. But I cannot help you with that. Ask Microsoft for help.
However, if the blanks are not that important, I suggest you rename the files, replacing each blank with, say, a minus ("-") and try again. _________________ Regards
Chris Karakas
www.karakas-online.de |
|
| Back to top |
|
 |
meetzah Warrant Officer

Joined: 09 Aug 2005 Posts: 63
|
Posted: Sat Feb 25, 2006 12:09 pm Post subject: |
|
|
|
| Quote: | Ask Microsoft for help.  |
thank you. _________________ Life has given nothing to mortals without hard work! |
|
| Back to top |
|
 |
|
|
 |
|
|