ANTICHAT.XYZ    VIDEO.ANTICHAT.XYZ    НОВЫЕ СООБЩЕНИЯ    ФОРУМ  
Баннер 1   Баннер 2
Antichat снова доступен.
Форум Antichat (Античат) возвращается и снова открыт для пользователей. Здесь обсуждаются безопасность, программирование, технологии и многое другое. Сообщество снова собирается вместе.
Новый адрес: forum.antichat.xyz
Вернуться   Форум АНТИЧАТ > Программирование > PHP, PERL, MySQL, JavaScript
   
 
 
Опции темы Поиск в этой теме Опции просмотра

perl кодеры помощь нужна.
  #1  
Старый 26.02.2007, 07:56
Аватар для guest3297
guest3297
Banned
Регистрация: 27.06.2006
Сообщений: 1,614
Провел на форуме:
3887520

Репутация: 2996


Question perl кодеры помощь нужна.

Код:
#!/usr/bin/perl

### Virtual Webwerx Form-Based Upload CGI
### v1.0 (17 Feb 96) by James K. Boutcher (geewhiz@novia.net)
### Feel free to use, modify, distribute.. But remember to give some credit
### where credit is due.
###
### If you are having problems with this, or have a bug to report, just send
### me some mail


# Let's define our variables first off.. 
$| = 1;  
$upath = "/stor/mp3/webuploads/";
$uindex = "/stor/mp3/webuploads/upload.index";
$tempfile = $upath . $ENV{'REMOTE_ADDR'};
$nofileerror = "/upload.html";

# The following reads in the CGI buffer, and writes it to a temporary file
# which will used later.
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
open (x,">$tempfile");
print x $buffer;
close (x);


# Now, time to open the temporary file and process it!
open (temp,$tempfile);


# Gotta pull the MIME/multipart separator line out.. We'll keep the 15 
# digit number for later...
$_ = <temp>;
($vernum) = /(\d+)/;


# Next line of the file contains the filename in the format: 
#     filename="C:\windows\win.ini"
# We'll just keep the part inside the quotes...
$_ = <temp>;
$filetemp = $1 if (/filename=\"(.*)\"/); 


# The filename currently has the full pathname to the file in it.. We
# don't want that! .. First we grab the last word after the backslash (for
# PC systems), then we're gunna grab the last word after the forward slash
# (unix systems).. Don't worry, it works.
@pathz = (split(/\\/,$filetemp));
$filetempb = $pathz[$#pathz];
@pathza = (split('/',$filetempb));
$filename = $pathza[$#pathza];


# And, if the filename is nothing, we'll clean everything up and give them
# a pretty error message
if ($filename eq "") {
	print "Location: $nofileerror\n\n";
	close(temp);
	`rm $tempfile`;
	}


# Now that we know the name of the file, let's create it in our upload
# directory..
open (outfile, ">$upath$filename");


# Now we don't care about the Content-type of this, so we'll pass that up
$junk = <temp>; 
$junk = <temp>;


# And we're gunna read/write all the lines of our file until we come to the
# MIME-multipart separator, which we'll ignore.
while (<temp>) {
   if (!(/-{28,29}$vernum/)) {
		print outfile $_;
		}
   }

# We're done with that.. Let's close things up and remove that temp file.
close (temp);
close (outfile);
`rm $tempfile`;


# And bust da HTML
print "Content-type: text/html\n\n";
print "<html><title>Form Upload</title><body>\n";
print "You may now go to the <A HREF=\"http://206.54.177.102:84\">WebAmp</A> page and search for your file in the webuploads directory.<br><br>\n";
print "</body></html>";
Просьюба корректно обьяснить куда загружаеться файл, если скрипт лежит в /cgi-bin/ ?
Какое имя назначаеться и так далее.
Учитывай то что пути прописанные в файле истины.
 
Ответить с цитированием
 



Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
Books Perl FRAGNATIC PHP, PERL, MySQL, JavaScript 0 11.08.2005 16:58
Нужна помощь! Black_Death Болталка 7 11.12.2004 16:03
Нужна помощь... Чаты 2 24.02.2003 02:17
Нужна помощь Амир Чаты 0 04.09.2002 11:21



Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
 


Быстрый переход




ANTICHAT.XYZ