Top-Themen

AppleEntwicklungHardwareInternetLinuxMicrosoftMultimediaNetzwerkeOff TopicSicherheitSonstige SystemeVirtualisierungWeiterbildungZusammenarbeit

Aktuelle Themen

Administrator.de FeedbackApache ServerAppleAssemblerAudioAusbildungAuslandBackupBasicBatch & ShellBenchmarksBibliotheken & ToolkitsBlogsCloud-DiensteClusterCMSCPU, RAM, MainboardsCSSC und C++DatenbankenDatenschutzDebianDigitiales FernsehenDNSDrucker und ScannerDSL, VDSLE-BooksE-BusinessE-MailEntwicklungErkennung und -AbwehrExchange ServerFestplatten, SSD, RaidFirewallFlatratesGoogle AndroidGrafikGrafikkarten & MonitoreGroupwareHardwareHosting & HousingHTMLHumor (lol)Hyper-VIconsIDE & EditorenInformationsdiensteInstallationInstant MessagingInternetInternet DomäneniOSISDN & AnaloganschlüsseiTunesJavaJavaScriptKiXtartKVMLAN, WAN, WirelessLinuxLinux DesktopLinux NetzwerkLinux ToolsLinux UserverwaltungLizenzierungMac OS XMicrosoftMicrosoft OfficeMikroTik RouterOSMonitoringMultimediaMultimedia & ZubehörNetzwerkeNetzwerkgrundlagenNetzwerkmanagementNetzwerkprotokolleNotebook & ZubehörNovell NetwareOff TopicOpenOffice, LibreOfficeOutlook & MailPapierkorbPascal und DelphiPeripheriegerätePerlPHPPythonRechtliche FragenRedHat, CentOS, FedoraRouter & RoutingSambaSAN, NAS, DASSchriftartenSchulung & TrainingSEOServerServer-HardwareSicherheitSicherheits-ToolsSicherheitsgrundlagenSolarisSonstige SystemeSoziale NetzwerkeSpeicherkartenStudentenjobs & PraktikumSuche ProjektpartnerSuseSwitche und HubsTipps & TricksTK-Netze & GeräteUbuntuUMTS, EDGE & GPRSUtilitiesVB for ApplicationsVerschlüsselung & ZertifikateVideo & StreamingViren und TrojanerVirtualisierungVisual StudioVmwareVoice over IPWebbrowserWebentwicklungWeiterbildungWindows 7Windows 8Windows 10Windows InstallationWindows MobileWindows NetzwerkWindows ServerWindows SystemdateienWindows ToolsWindows UpdateWindows UserverwaltungWindows VistaWindows XPXenserverXMLZusammenarbeit

Variable aus URL-String übernehmen und in Zielpfad einbauen...

Frage Entwicklung Perl

Mitglied: 35801

35801 (Level 1)

06.12.2007, aktualisiert 22:09 Uhr, 5341 Aufrufe, 4 Kommentare

Hallo Leute!

Ich weiß es ist nicht gerde die feine Art andere meine Arbeit machen lassen aber ich verzweifle bald...

Ich hab untenstehende Script in PERL und hab NULL Ahnung was und wo und wie ich eine Variable welche per URL übergeben wird zum UPLOAD-DIR hinzufügen soll...

Problem:
Ich hab ein fertiges Perl-Uploadscript, dass super funktioniert!

Per URL übergebe ich die Variable "pd" mit ...&pd=projektname (zB: 122587_TestProjekt)

Nun, so weit so schlecht...

Das Script schmeißt mir alle Daten in den Ordner "uploads" der bei bedarf auch erstellt wird...

Ich möchte nur dass das script für jede Projekt einen Unterordner anlegt....
(zB: uploads/122587_TestProjekt)

Kann mir jemand sagen wo ich die Variable einbaue bzw. mir schnell die 1-2 Zeilen ändern??


GROSSES DANKE!!!



SCRIPT UPLOAD.PL
01.
#!/usr/bin/perl -w 
02.
 
03.
 
04.
#********************************************************************************************************************************** 
05.
my $THIS_VERSION = "6.7";                                                    # Version of this driver 
06.
my $start_upload = time();                                                   # Timestamp start of upload 
07.
my $end_upload = 0;                                                          # Timestamp end of upload 
08.
 
09.
# Makes %ENV safer 
10.
$ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin'; 
11.
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'}; 
12.
 
13.
use strict; 
14.
use lib qw(.);                              # Add current directory to list of valid paths 
15.
# use CGI::Carp 'fatalsToBrowser';          # Dump fatal errors to screen 
16.
use CGI qw(:cgi);                           # Load the CGI.pm module 
17.
use File::Copy;                             # Module for moving uploaded files 
18.
use uu_lib;                                 # Load the uu_lib.pm module 
19.
 
20.
############################################################### 
21.
# The following possible query string formats are assumed 
22.
23.
# 1. ?temp_sid=some_sid_number&config_file=some_config_file_name 
24.
# 2  ?temp_sid=some_sid_number 
25.
# 3. ?cmd=about 
26.
# 4. ?cmd=debug&config_file=some_config_file_name 
27.
# 5. ?cmd=debug 
28.
############################################################### 
29.
my %query_string = parse_query_string($ENV{'QUERY_STRING'}); 
30.
 
31.
# Check for tainted sid 
32.
if(exists($query_string{'temp_sid'})){ 
33.
	if($query_string{'temp_sid'} !~ m/(^[a-zA-Z0-9]{32}$)/){ &kak("<font color='red'>ERROR<\/font>: Invalid session-id<br>\n", 1, __LINE__); } 
34.
	else{ $query_string{'temp_sid'} = $1; } 
35.
36.
 
37.
# Check for tainted config file name 
38.
if(exists($query_string{'config_file'})){ 
39.
	if($query_string{'config_file'} !~ m/(^\w{5,32}$)/){ &kak("<font color='red'>ERROR<\/font>: Invalid config file name<br>\n", 1, __LINE__); } 
40.
	else{ $query_string{'config_file'} = $1; } 
41.
42.
 
43.
# Check for tainted command 
44.
if(exists($query_string{'cmd'})){ 
45.
	if($query_string{'cmd'} ne 'about' && $query_string{'cmd'} ne 'debug'){ &kak("<font color='red'>ERROR<\/font>: Invalid command<br>\n", 1, __LINE__); } 
46.
47.
 
48.
# Make sure cmd or temp_sid was passed but not both 
49.
if(!exists($query_string{'cmd'}) && !exists($query_string{'temp_sid'})){ &kak("<font color='red'>ERROR<\/font>: Invalid parameters<br>\n", 1, __LINE__); } 
50.
if(exists($query_string{'cmd'}) && exists($query_string{'temp_sid'})){ &kak("<font color='red'>ERROR<\/font>: Conflicting parameters<br>\n", 1, __LINE__); } 
51.
 
52.
####################################################################################################### 
53.
# Attempt to load the config file that was passed to the script if multi configs is enabled. If no 
54.
# config file name was passed to the script, load the default config file 'uu_default_config.pm' 
55.
####################################################################################################### 
56.
my $config_file = 'uu_default_config'; 
57.
 
58.
if(exists($query_string{'config_file'}) && $MULTI_CONFIGS_ENABLED){ 
59.
	$config_file = $query_string{'config_file'}; 
60.
 
61.
	unless(eval "use $config_file"){ 
62.
		if($@){ &kak("<font color='red'>ERROR<\/font>: Failed to load config file $config_file.pm<br>\n", 1, __LINE__); } 
63.
64.
65.
elsif(exists($query_string{'config_file'}) && !$MULTI_CONFIGS_ENABLED){ 
66.
	 &kak("<font color='red'>ERROR<\/font>: Multi Config files disabled<br>\n", 1, __LINE__); 
67.
68.
else{ 
69.
	unless(eval "use $config_file"){ 
70.
		if($@){ &kak("<font color='red'>ERROR<\/font>: Failed to load config file $config_file.pm<br>\n", 1, __LINE__); } 
71.
72.
73.
 
74.
# Process 'about' or 'debug' command 
75.
if(exists($query_string{'cmd'}) && $query_string{'cmd'} eq 'about'){ &kak("<u><b>UBER UPLOADER VERSION</b><\/u><br> UBER UPLOADER VERSION = <b>" . $UBER_VERSION . "<\/b><br> UU_UPLOAD = <b>" . $THIS_VERSION . "<\/b><br>\n", 1, __LINE__); } 
76.
elsif(exists($query_string{'cmd'}) && $query_string{'cmd'} eq 'debug' && !$DEBUG_ENABLED){ &kak("<u><b>UBER UPLOADER CGI SETTINGS<\/b><\/u><br> DEBUG = <b><font color='red'>disabled</font><\/b><br>\n", 1, __LINE__); } 
77.
elsif(exists($query_string{'cmd'}) && $query_string{'cmd'} eq 'debug' && $DEBUG_ENABLED){ &debug($main::config, $UBER_VERSION, $THIS_VERSION, $MULTI_CONFIGS_ENABLED); } 
78.
 
79.
# Declare Local variables 
80.
my $temp_sid = $query_string{'temp_sid'};                                           # Assign session-id 
81.
my $sleep_time = 1;                                                                 # Seconds to wait before upload proceeds (for small file uploads) 
82.
my %uploaded_files = ();                                                            # Hash used to store uploaded file names, sizes and types 
83.
my $temp_dir_sid = $main::config->{'temp_dir'} . $temp_sid;                           # Append Session-id to upload temp directory 
84.
my $flength_file = $temp_dir_sid . '/flength';                                      # Flength file is used to store the size of the upload in bytes 
85.
my $unique_dir;                                                                     # Unique upload directory name 
86.
 
87.
umask(0); 
88.
$|++;                                                                               # Force auto flush of output buffer 
89.
$SIG{HUP} = 'IGNORE';                                                               # Ignore sig hup 
90.
local $SIG{__DIE__} = \&cleanup;                                                    # User has pressed stop during upload so deal with it 
91.
$CGI::POST_MAX = $main::config->{'max_upload'};                                     # Set the max post value 
92.
 
93.
# Create temp directory if it does not exist 
94.
if(!-d $main::config->{'temp_dir'}){ mkdir($main::config->{'temp_dir'}, 0777) or &kak("<font color='red'>ERROR</font>: Failed to mkdir $main::config->{'temp_dir'}: $!", 1, __LINE__); } 
95.
 
96.
# Create a temp directory based on Session-id 
97.
if(!-d $temp_dir_sid){ mkdir($temp_dir_sid, 0777) or &kak("<font color='red'>ERROR</font>: Failed to mkdir $temp_dir_sid: $!", 1, __LINE__); } 
98.
else{ 
99.
	&deldir($temp_dir_sid); 
100.
	mkdir($temp_dir_sid, 0777) or &kak("<font color='red'>ERROR</font>: Failed to mkdir $temp_dir_sid: $!", 1, __LINE__); 
101.
102.
 
103.
# Prepare the flength file for writing 
104.
open(FLENGTH, ">" , "$flength_file") or &kak("<font color='red'>ERROR</font>: Failed to open $temp_dir_sid/flength: $!", 1, __LINE__); 
105.
 
106.
if($ENV{'CONTENT_LENGTH'} > $main::config->{'max_upload'}){ 
107.
	# If file size exceeds maximum write error to flength file and exit 
108.
	my $max_size = &format_bytes($main::config->{'max_upload'}, 99); 
109.
 
110.
	print FLENGTH "ERROR: Maximum upload size of $max_size exceeded"; 
111.
	close(FLENGTH); 
112.
	chmod 0666, $flength_file; 
113.
 
114.
	&kak("<font color='red'>ERROR</font>: Maximum upload size of $max_size exceeded.<br><br>Your upload has failed.<br>", 1, __LINE__); 
115.
	close(STDIN); 
116.
117.
else{ 
118.
	# Write total upload size in bytes to flength file 
119.
	print FLENGTH $ENV{'CONTENT_LENGTH'}; 
120.
	close(FLENGTH); 
121.
	chmod 0666, $flength_file; 
122.
123.
 
124.
# Let progress bar get some info (for small file uploads) 
125.
sleep($sleep_time); 
126.
 
127.
# Tell CGI.pm to use our directory based on Session-id 
128.
if($TempFile::TMPDIRECTORY){ $TempFile::TMPDIRECTORY = $temp_dir_sid; } 
129.
elsif($CGITempFile::TMPDIRECTORY){ $CGITempFile::TMPDIRECTORY = $temp_dir_sid; } 
130.
else{ &kak("<font color='red'>ERROR</font>: Failed to assign CGI temp directory", 1, __LINE__); } 
131.
 
132.
my $query = new CGI; 
133.
 
134.
#################################################################################################################### 
135.
# The upload is complete at this point, so you can now access any post values. eg. $query->param("some_post_value"); 
136.
#################################################################################################################### 
137.
 
138.
#################################################################################################################### 
139.
# IF you are modifying the upload directory with a post value, it may be done here. 
140.
141.
# Note: Making modifications based on posted input may be unsafe. Make sure your posted input is safe! 
142.
143.
# You must override the $main::config->{'upload_dir'} value 
144.
# If you are linking to the file you must also override the $main::config->{'path_to_upload'} value 
145.
146.
# eg. $main::config->{'upload_dir'} .= $query->param("employee_num") . '/'; 
147.
# eg. $main::config->{'path_to_upload'} .= $query->param("employee_num") . '/'; 
148.
################################################################################################################### 
149.
 
150.
# Create a unique directory inside the upload directory if config setting 'unique_upload_dir' is enabled 
151.
if($main::config->{'unique_upload_dir'}){ 
152.
	$unique_dir = &generate_random_string($main::config->{'unique_upload_dir_length'}); 
153.
	$main::config->{'upload_dir'} .= $unique_dir . '/'; 
154.
 
155.
	if($main::config->{'link_to_upload'} || $main::config->{'link_to_upload_in_email'}){ $main::config->{'path_to_upload'} .= $unique_dir . '/'; } 
156.
157.
 
158.
# Create upload directory if it does not exist 
159.
if(!-d $main::config->{'upload_dir'}){ mkdir($main::config->{'upload_dir'}, 0777) or &kak("<font color='red'>ERROR</font>: Failed to mkdir $main::config->{'upload_dir'}: $!", 1, __LINE__); } 
160.
 
161.
# Start processing the uploaded files 
162.
for my $upload_key (keys %{$query->{'.tmpfiles'}}){ 
163.
	# Get the file slot name eg. 'upfile_0' 
164.
	$query->{'.tmpfiles'}->{$upload_key}->{info}->{'Content-Disposition'} =~ / name="([^"]*)"/; 
165.
	my $file_slot = $1; 
166.
 
167.
	# Get uploaded file name 
168.
	my $file_name = param($file_slot); 
169.
 
170.
	# Get the upload file handle 
171.
	my $upload_filehandle = $query->upload($file_slot); 
172.
 
173.
	# Get the CGI temp file name 
174.
	my $tmp_filename = $query->tmpFileName($upload_filehandle); 
175.
 
176.
	# Get the type of file being uploaded 
177.
	my $content_type = $query->uploadInfo($upload_filehandle)->{'Content-Type'}; 
178.
 
179.
	# Strip extra path info from the file (IE). Note: Will likely cause problems with foreign languages like chinese 
180.
	$file_name =~ s/.*[\/\\](.*)/$1/; 
181.
 
182.
	# Normalize file name  Note: Will cause problems with foreign languages like chinese 
183.
	if($main::config->{'normalize_file_names'}){ $file_name = &normalize_filename($file_name, $main::config->{'normalize_file_delimiter'}, $main::config->{'normalize_file_length'}); } 
184.
 
185.
	# Get the file extention 
186.
	my ($f_name, $file_extension) = ($file_name =~ /(.*)\.(.+)/); 
187.
 
188.
	######################################################################################################## 
189.
	# IF you are modifying the file name with a post value, it may be done here. 
190.
191.
	# Note: Making modifications based on posted input may be unsafe. Make sure your posted input is safe! 
192.
193.
	# eg. $file_name = $f_name . "_" . $query->param("employee_num") . $file_extension; 
194.
	######################################################################################################## 
195.
 
196.
	################################################################################################################################################# 
197.
	# IF you want to filter file uploads by disallowed AND allowed extensions, change the following line to use the allow extensions config setting. 
198.
	# eg. if((-s $tmp_filename) && ($file_extension !~ m/^$main::config->{'disallow_extensions'}$/i) && ($file_extension =~ m/^$main::config->{'allow_extensions'}$/i)){ 
199.
	################################################################################################################################################################# 
200.
 
201.
	# Do not process zero length files or files with illegal extensions 
202.
	if((-s $tmp_filename) && ($file_extension !~ m/^$main::config->{'disallow_extensions'}$/i)){ 
203.
		# Create a unique filename if config setting 'unique_filename' is enabled 
204.
		if($main::config->{'unique_file_name'}){ 
205.
			my $unique_file_name = generate_random_string($main::config->{'unique_file_name_length'}); 
206.
			$unique_file_name = $unique_file_name . "." . $file_extension; 
207.
			$file_name = $unique_file_name; 
208.
209.
 
210.
		# Check for an existing file and rename if it already exists 
211.
		if(!$main::config->{'overwrite_existing_files'}){ $file_name = &rename_filename($file_name, 1, $main::config->{'upload_dir'}); } 
212.
 
213.
		my $upload_file_path = $main::config->{'upload_dir'} . $file_name; 
214.
 
215.
		# Win wants the file handle closed before transfer 
216.
		close($upload_filehandle); 
217.
 
218.
		# Transfer uploaded file to final destination 
219.
		move($tmp_filename, $upload_file_path) or copy($tmp_filename, $upload_file_path) or die("Cannot move/copy from $tmp_filename to $upload_file_path: $!"); 
220.
 
221.
		chmod 0666, $upload_file_path; 
222.
223.
 
224.
	# Store the upload file info 
225.
	$uploaded_files{$file_slot}{'file_size'} = &get_file_size($main::config->{'upload_dir'}, $file_name); 
226.
	$uploaded_files{$file_slot}{'file_name'} = $file_name; 
227.
	$uploaded_files{$file_slot}{'file_type'} = $content_type; 
228.
229.
 
230.
# Timestamp end of upload (includes file transfer) 
231.
$end_upload = time(); 
232.
 
233.
# Delete the temp directory based on session-id and everything in it 
234.
&deldir($temp_dir_sid); 
235.
 
236.
# Log Upload 
237.
if($main::config->{'log_uploads'}){ &log_upload($main::config, $config_file, $start_upload, $end_upload, $temp_sid, $unique_dir, %uploaded_files); } 
238.
 
239.
# Redirect to php page if redirect enabled else display results 
240.
if($main::config->{'redirect_after_upload'}){ 
241.
	# Create param directory if it does not exist 
242.
	if(!-d $main::config->{'param_dir'}){ 
243.
		if(!mkdir($main::config->{'param_dir'}, 0777)){ 
244.
			&kak("<font color='red'>ERROR<\/font>: Failed to create param directory $main::config->{'param_dir'}. $!", 0 , __LINE__); 
245.
			&display_results($main::config, $start_upload, $end_upload, $temp_sid, %uploaded_files); 
246.
247.
248.
 
249.
	my $param_file_path = $main::config->{'param_dir'} . $temp_sid . ".xml"; 
250.
 
251.
	# We are re-directing so write a sid.xml file with upload info 
252.
	if(!open PARAMS, ">", "$param_file_path"){ 
253.
		&kak("<font color='red'>ERROR<\/font>: Failed to open $param_file_path. $!", 0 , __LINE__); 
254.
		&display_results($main::config, $start_upload, $end_upload, $temp_sid, %uploaded_files); 
255.
256.
 
257.
	binmode PARAMS; 
258.
	print PARAMS "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; 
259.
	print PARAMS "<uu_upload>\n"; 
260.
	print PARAMS "  <config>\n"; 
261.
	print PARAMS "    <config_file>$config_file<\/config_file>\n"; 
262.
	print PARAMS "    <start_upload>$start_upload<\/start_upload>\n"; 
263.
	print PARAMS "    <end_upload>$end_upload<\/end_upload>\n"; 
264.
	print PARAMS "    <remote_ip>$ENV{REMOTE_ADDR}<\/remote_ip>\n"; 
265.
	print PARAMS "    <user_agent>$ENV{HTTP_USER_AGENT}<\/user_agent>\n"; 
266.
	print PARAMS "    <temp_sid>$temp_sid<\/temp_sid>\n"; 
267.
	print PARAMS "    <upload_dir>$main::config->{'upload_dir'}<\/upload_dir>\n"; 
268.
	print PARAMS "    <link_to_upload>$main::config->{'link_to_upload'}<\/link_to_upload>\n"; 
269.
 
270.
	# If we want a direct link and or an email link, we need to pass the path_to_upload setting 
271.
	if($main::config->{'link_to_upload'} || ($main::config->{'send_email_on_upload'} && $main::config->{'link_to_upload_in_email'})){ 
272.
		print PARAMS "    <path_to_upload>$main::config->{'path_to_upload'}<\/path_to_upload>\n"; 
273.
274.
 
275.
	# If 'unique_upload_dir' config setting is enabled pass the info 
276.
	if($main::config->{'unique_upload_dir'}){ 
277.
		print PARAMS "    <unique_upload_dir>$main::config->{'unique_upload_dir'}<\/unique_upload_dir>\n"; 
278.
		print PARAMS "    <unique_dir>$unique_dir<\/unique_dir>\n"; 
279.
280.
 
281.
	# If email on upload, write all the email info to param file 
282.
	if($main::config->{'send_email_on_upload'}){ 
283.
		print PARAMS "    <send_email_on_upload>1<\/send_email_on_upload>\n"; 
284.
		print PARAMS "    <link_to_upload_in_email>$main::config->{'link_to_upload_in_email'}<\/link_to_upload_in_email>\n"; 
285.
		print PARAMS "    <email_subject>$main::config->{'email_subject'}<\/email_subject>\n"; 
286.
		print PARAMS "    <html_email_support>$main::config->{'html_email_support'}<\/html_email_support>\n"; 
287.
		print PARAMS "    <to_email_address>$main::config->{'to_email_address'}<\/to_email_address>\n"; 
288.
		print PARAMS "    <from_email_address>$main::config->{'from_email_address'}<\/from_email_address>\n"; 
289.
290.
	else{ print PARAMS "    <send_email_on_upload>0<\/send_email_on_upload>\n"; } 
291.
 
292.
	print PARAMS "  <\/config>\n"; 
293.
	print PARAMS "  <post>\n"; 
294.
 
295.
	# Write all posted values 
296.
	my @names = $query->param; 
297.
 
298.
	foreach my $key (@names){ 
299.
		my $post_value = $query->param($key); 
300.
 
301.
		$post_value =~ s/&/&amp;/g; 
302.
		$post_value =~ s/</&lt;/g; 
303.
		$post_value =~ s/>/&apos;/g; 
304.
		$post_value =~ s/'/&gt;/g; 
305.
		$post_value =~ s/"/&quot;/g; 
306.
 
307.
		$key =~ s/[^a-zA-Z0-9\_\-]/_/g; 
308.
 
309.
		print PARAMS "    <$key>$post_value<\/$key>\n"; 
310.
311.
 
312.
	print PARAMS "  <\/post>\n"; 
313.
 
314.
	# Write all file uploads 
315.
 
316.
	print PARAMS "  <file>\n"; 
317.
 
318.
	for my $file_slot (keys %uploaded_files){ 
319.
		my $file_name = $uploaded_files{$file_slot}{'file_name'}; 
320.
		my $file_size = $uploaded_files{$file_slot}{'file_size'}; 
321.
		my $file_type = $uploaded_files{$file_slot}{'file_type'}; 
322.
 
323.
		print PARAMS "    <file_upload>\n"; 
324.
		print PARAMS "      <slot>$file_slot<\/slot>\n"; 
325.
		print PARAMS "      <name>$file_name<\/name>\n"; 
326.
		print PARAMS "      <size>$file_size<\/size>\n"; 
327.
		print PARAMS "      <type>$file_type<\/type>\n"; 
328.
		print PARAMS "    <\/file_upload>\n"; 
329.
330.
 
331.
	print PARAMS "  <\/file>\n"; 
332.
	print PARAMS "<\/uu_upload>\n"; 
333.
 
334.
	close(PARAMS); 
335.
	chmod 0666, $param_file_path; 
336.
 
337.
	# Append random string so finished page does not cache 
338.
	my $redirect_url = $main::config->{'redirect_url'} . "?rnd_id=" . &generate_random_string(8); 
339.
 
340.
	# Force 'redirect_using_location' if user does not have a javascript capable browser or using embedded_upload_results 
341.
	if(($query->param('no_script') && $query->param('no_script') == 1) || ($query->param('embedded_upload_results') && $query->param('embedded_upload_results') == 1)){ 
342.
		$main::config->{'redirect_using_js_html'} = 0; 
343.
		$main::config->{'redirect_using_location'} = 1; 
344.
345.
 
346.
	# Perform Redirect 
347.
	if($main::config->{'redirect_using_js_html'}){ 
348.
		if($main::config->{'pass_param_dir'}){ 
349.
			&kak("<form name='redirect' method='post' action=\"$redirect_url\"><input type='hidden' name='temp_sid' value=\"$temp_sid\"><input type='hidden' name='param_dir' value=\"$main::config->{'param_dir'}\"></form><script language='javascript' type='text/javascript'>document.redirect.submit()</script>", 1, __LINE__); 
350.
351.
		else{ 
352.
			&kak("<form name='redirect' method='post' action=\"$redirect_url\"><input type='hidden' name='temp_sid' value=\"$temp_sid\"></form><script language='javascript' type='text/javascript'>document.redirect.submit()</script>", 1, __LINE__); 
353.
354.
355.
	else{ 
356.
		# Append the temp_sid and param_dir path to the redirect url. 
357.
		if($main::config->{'pass_param_dir'}){ $redirect_url .= "&temp_sid=$temp_sid&param_dir=$main::config->{'param_dir'}"; } 
358.
		else{ $redirect_url .= "&temp_sid=" . $temp_sid; } 
359.
 
360.
		if($main::config->{'redirect_using_html'}){ 
361.
			print "content-type:text/html; charset=utf-8\n\n"; 
362.
			print "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"><meta http-equiv=\"refresh\" content=\"0; url='$redirect_url'\"></head><body></body></html>"; 
363.
364.
		elsif($main::config->{'redirect_using_js'}){ 
365.
			&kak("<script language=\"javascript\" type=\"text/javascript\">location.href='$redirect_url';</script>", 1, __LINE__); 
366.
367.
		elsif($main::config->{'redirect_using_location'}){ 
368.
			# Uncomment next line if using Webstar V 
369.
			# print "HTTP/1.1 302 Redirection\n"; 
370.
			print "Location: $redirect_url\n\n"; 
371.
372.
373.
374.
else{ 
375.
	# We are not redirecting so dump upload results to screen using CGI 
376.
	&display_results($main::config, $start_upload, $end_upload, $temp_sid, %uploaded_files); 
377.
378.
 
379.
exit; 
380.
 
381.
######################################################### START SUBROUTINES ################################################### 
382.
 
383.
########################################### 
384.
# Create a log of the upload in XML format 
385.
########################################### 
386.
sub log_upload{ 
387.
	my $config = shift; 
388.
	my $config_file = shift; 
389.
	my $start_upload = shift; 
390.
	my $end_upload = shift; 
391.
	my $temp_sid = shift; 
392.
	my $unique_dir = shift; 
393.
	my $uploaded_files = shift; 
394.
	my @names = $query->param; 
395.
 
396.
	# Create log directory if it does not exist 
397.
	if(!-d $config->{'log_dir'}){ 
398.
		if(!mkdir($config->{'log_dir'}, 0777)){ 
399.
			&kak("Failed to create uu log directory $!", 0 , __LINE__); 
400.
			return; 
401.
402.
403.
 
404.
	my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time); 
405.
	$year += 1900; 
406.
	$mon++; 
407.
 
408.
	my $day_dir = $config->{'log_dir'} . $year . '-' . $mon . '-' . $mday; 
409.
 
410.
	# Create day log directory if it does not exist 
411.
	if(!-d $day_dir){ 
412.
		if(!mkdir($day_dir, 0777)){ 
413.
			&kak("Failed to create uu day log directory $!", 0 , __LINE__); 
414.
			return; 
415.
416.
417.
 
418.
	# Log file format = temp_sid-8_character_random_string-unix_time_stamp.log 
419.
	my $random_string = &generate_random_string(8); 
420.
	my $log_file = $day_dir . '/' . $temp_sid . '-' . $random_string . '-' . time() . '.xml'; 
421.
 
422.
	# Create log file 
423.
	if(open(UULOG, ">" , "$log_file")){ 
424.
		binmode UULOG; 
425.
		print UULOG "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; 
426.
		print UULOG "<uu_upload>\n"; 
427.
		print UULOG "  <config>\n"; 
428.
		print UULOG "    <config_file>$config_file<\/config_file>\n"; 
429.
		print UULOG "    <start_upload>$start_upload<\/start_upload>\n"; 
430.
		print UULOG "    <end_upload>$end_upload<\/end_upload>\n"; 
431.
		print UULOG "    <remote_ip>$ENV{REMOTE_ADDR}<\/remote_ip>\n"; 
432.
		print UULOG "    <user_agent>$ENV{HTTP_USER_AGENT}<\/user_agent>\n"; 
433.
		print UULOG "    <temp_sid>$temp_sid<\/temp_sid>\n"; 
434.
 
435.
		if($config->{'unique_upload_dir'}){ print UULOG "    <unique_dir>$unique_dir<\/unique_dir>\n"; } 
436.
 
437.
		print UULOG "  <\/config>\n"; 
438.
 
439.
		# Log post values 
440.
		if($config->{'log_params'}){ 
441.
			print UULOG "  <post>\n"; 
442.
 
443.
			foreach my $key (@names){ 
444.
				my $post_value = $query->param($key); 
445.
 
446.
				$post_value =~ s/&/&amp;/g; 
447.
				$post_value =~ s/</&lt;/g; 
448.
				$post_value =~ s/>/&apos;/g; 
449.
				$post_value =~ s/'/&gt;/g; 
450.
				$post_value =~ s/"/&quot;/g; 
451.
 
452.
				$key =~ s/[^a-zA-Z0-9\_\-]/_/g; 
453.
 
454.
				print UULOG "    <$key>$post_value<\/$key>\n"; 
455.
456.
 
457.
			print UULOG "  <\/post>\n"; 
458.
459.
 
460.
		print UULOG "  <file>\n"; 
461.
 
462.
		# Log upload file info 
463.
		for my $file_slot (keys %uploaded_files){ 
464.
			my $file_name = $uploaded_files{$file_slot}{'file_name'}; 
465.
			my $file_size = $uploaded_files{$file_slot}{'file_size'}; 
466.
			my $file_type = $uploaded_files{$file_slot}{'file_type'}; 
467.
 
468.
			print UULOG "    <file_upload>\n"; 
469.
			print UULOG "      <file_slot>$file_slot<\/file_slot>\n"; 
470.
			print UULOG "      <file_name>$file_name<\/file_name>\n"; 
471.
			print UULOG "      <file_size>$file_size<\/file_size>\n"; 
472.
			print UULOG "      <file_type>$file_type<\/file_type>\n"; 
473.
			print UULOG "    <\/fileUpload>\n"; 
474.
475.
 
476.
		print UULOG "  <\/file>\n"; 
477.
		print UULOG "<\/uu_upload>\n"; 
478.
		close(UULOG); 
479.
		chmod 0666, $log_file; 
480.
481.
	else{ &kak("Failed to create log file $!", 0, __LINE__); } 
482.
483.
 
484.
################################################## 
485.
# Get the size of the ploaded file if it exists 
486.
################################################## 
487.
sub get_file_size{ 
488.
	my $upload_dir = shift; 
489.
	my $file_name = shift; 
490.
	my $path_to_file = $upload_dir . $file_name; 
491.
	my $file_size = 0; 
492.
 
493.
	if(-e $path_to_file && -f $path_to_file){ $file_size = -s $path_to_file; } 
494.
 
495.
	return $file_size; 
496.
497.
 
498.
######################################## 
499.
# Delete the temp dir based on temp_sid 
500.
######################################## 
501.
sub cleanup{ &deldir($temp_dir_sid); } 
502.
 
503.
#################################### 
504.
# Format the upload result and exit 
505.
#################################### 
506.
sub display_results{ 
507.
	my $config = shift; 
508.
	my $start_upload = shift; 
509.
	my $end_upload = shift; 
510.
	my $temp_sid = shift; 
511.
	my $uploaded_files = shift; 
512.
	my ($upload_result, $email_file_list, $bg_col) = (); 
513.
	my $i = 0; 
514.
	my $end_char = "\n"; 
515.
 
516.
	if($config->{'html_email_support'}){ $end_char = "<br>\n"; } 
517.
 
518.
	if(defined($query->param('embedded_upload_results')) && $query->param('embedded_upload_results') == 1){ 
519.
		$upload_result .= "<script language=\"javascript\" type=\"text/javascript\">\n"; 
520.
		$upload_result .= "  parent.document.getElementById('upload_div').style.display = \"\";\n"; 
521.
		$upload_result .= "  parent.iniFilePage();\n"; 
522.
		$upload_result .= "</script>\n"; 
523.
524.
 
525.
	$upload_result .= "<table cellpadding='1' cellspacing='1' width='70%'>\n"; 
526.
	$upload_result .= "  <tr>\n"; 
527.
	$upload_result .= "    <td align='center' bgcolor='bbbbbb'>&nbsp;&nbsp;<b>UPLOADED FILE NAME</b>&nbsp;&nbsp;</td><td align='center' bgcolor='bbbbbb'>&nbsp;&nbsp;<b>UPLOADED FILE SIZE</b>&nbsp;&nbsp;</td>\n"; 
528.
	$upload_result .= "  </tr>\n"; 
529.
 
530.
	for my $file_slot (keys %uploaded_files){ 
531.
		my $file_name = $uploaded_files{$file_slot}{'file_name'}; 
532.
		my $file_size = $uploaded_files{$file_slot}{'file_size'}; 
533.
		my $file_type = $uploaded_files{$file_slot}{'file_type'}; 
534.
 
535.
		if($i%2){ $bg_col = 'cccccc'; } 
536.
		else{ $bg_col = 'dddddd'; } 
537.
 
538.
		if($file_size > 0){ 
539.
			$file_size = &format_bytes($file_size, 99); 
540.
 
541.
			if($config->{'link_to_upload'}){ 
542.
				$upload_result .= "<tr><td align='center' bgcolor='$bg_col'><a href=\"$config->{'path_to_upload'}$file_name\" TARGET=\"_blank\">$file_name</a><\/td><td align='center' bgcolor='$bg_col'>$file_size<\/td><\/tr>\n"; 
543.
544.
			else{ 
545.
				$upload_result .= "<tr><td align='center' bgcolor='$bg_col'>&nbsp;$file_name&nbsp;<\/td><td align='center' bgcolor='$bg_col'>$file_size<\/td><\/tr>\n"; 
546.
547.
 
548.
			if($config->{'link_to_upload_in_email'}){ 
549.
				$email_file_list .= "File Name: $config->{'path_to_upload'}$file_name     File Size: $file_size" . $end_char; 
550.
551.
			else{ 
552.
				if($config->{'unique_upload_dir'}){ $email_file_list .= "File Name: $unique_dir/$file_name     File Size: $file_size\n"; } 
553.
				else{ $email_file_list .= "File Name: $file_name     File Size: $file_size" . $end_char; } 
554.
555.
556.
		else{ 
557.
			$upload_result .= "<tr><td align='center' bgcolor='$bg_col'>&nbsp;$file_name&nbsp;<\/td><td align='center' bgcolor='$bg_col'><font color='red'>Failed To Upload<\/font><\/td><\/tr>\n"; 
558.
			$email_file_list .= "File Name: $file_name     File Size: Failed To Upload !" . $end_char; 
559.
560.
 
561.
		$i++; 
562.
563.
 
564.
	$upload_result .= "</table>\n"; 
565.
	$upload_result .= "<br>\n"; 
566.
 
567.
	if($config->{'send_email_on_upload'}){ &email_upload_results($email_file_list, $config, $start_upload, $end_upload, $temp_sid); } 
568.
	&kak($upload_result, 1, __LINE__); 
569.
570.
 
571.
########################################## 
572.
#  Send an email with the upload results. 
573.
########################################## 
574.
sub email_upload_results{ 
575.
	my $file_list = shift; 
576.
	my $config = shift; 
577.
	my $start_upload = shift; 
578.
	my $end_upload = shift; 
579.
	my $temp_sid = shift; 
580.
 
581.
	my $path_to_sendmail = "/usr/sbin/sendmail -t"; 
582.
	my $message; 
583.
	my $end_char = "\n"; 
584.
	my ($ssec, $smin, $shour, $smday, $smon, $syear, $swday, $syday, $sisdst) = localtime($start_upload); 
585.
	my ($esec, $emin, $ehour, $emday, $emon, $eyear, $ewday, $eyday, $eisdst) = localtime($end_upload); 
586.
	my @abbr = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'); 
587.
 
588.
	$eyear += 1900; 
589.
	$syear += 1900; 
590.
 
591.
	if(open(SENDMAIL, "|$path_to_sendmail")){ 
592.
		print SENDMAIL "From:" . $config->{'from_email_address'} . "\n"; 
593.
		print SENDMAIL "To:" . $config->{'to_email_address'} . "\n"; 
594.
		print SENDMAIL "Subject:" . $config->{'email_subject'} . "\n"; 
595.
 
596.
		if($config->{'html_email_support'}){ 
597.
			print SENDMAIL 'Content-type: text/html; charset=utf-8; format=flowed' . "\r\n"; 
598.
			$end_char = "<br>\n"; 
599.
600.
		else{ print SENDMAIL 'Content-type: text/plain; charset=utf-8; format=flowed' . "\r\n"; } 
601.
 
602.
		$message .= "SID: ". $temp_sid . $end_char; 
603.
		$message .= "\nStart Upload: " . $abbr[$smon] . " " . $smday . ", " . $syear . ", " .  $shour . ":" . $smin . ":" . $ssec . $end_char; 
604.
		$message .= "End Upload: " . $abbr[$emon] . " " . $emday . ", " . $eyear . ", " .  $ehour . ":" . $emin . ":" . $esec . $end_char; 
605.
		$message .= "Remote IP: " . $ENV{'REMOTE_ADDR'}  . $end_char; 
606.
		$message .= "Browser: " . $ENV{'HTTP_USER_AGENT'} . $end_char . $end_char; 
607.
		$message .= $file_list; 
608.
 
609.
		print SENDMAIL $message; 
610.
		close(SENDMAIL); 
611.
612.
	else{ warn("Failed to open sendmail $!"); } 
613.
614.
 
615.
#################################################### 
616.
#  formatBytes($file_size, 99) mixed file sizes 
617.
#  formatBytes($file_size, 0) KB file sizes 
618.
#  formatBytes($file_size, 1) MB file sizes etc 
619.
#################################################### 
620.
sub format_bytes{ 
621.
	my $bytes = shift; 
622.
	my $byte_format = shift; 
623.
	my $byte_size = 1024; 
624.
	my $i = 0; 
625.
	my @byte_type = (" KB", " MB", " GB", " TB", " PB", " EB", " ZB", " YB"); 
626.
 
627.
	$bytes /= $byte_size; 
628.
 
629.
	if($byte_format == 99 || $byte_format > 7){ 
630.
		while($bytes > $byte_size){ 
631.
			$bytes /= $byte_size; 
632.
			$i++; 
633.
634.
635.
	else{ 
636.
		while($i < $byte_format){ 
637.
			$bytes /= $byte_size; 
638.
			$i++; 
639.
640.
641.
 
642.
	$bytes = sprintf("%1.2f", $bytes); 
643.
	$bytes .= $byte_type[$i]; 
644.
 
645.
	return $bytes; 
646.
647.
 
648.
############################################ 
649.
# Rename uploaded file if it already exists 
650.
############################################ 
651.
sub rename_filename{ 
652.
	my $file_name = shift; 
653.
	my $count = shift; 
654.
	my $upload_dir = shift; 
655.
	my $path_to_file = $upload_dir . $file_name; 
656.
 
657.
	if(-e $path_to_file && -f $path_to_file){ 
658.
		if($file_name =~ /(.*)_(\d*)\.(.*)/){ 
659.
			# Already renamed so count on 
660.
			$count = $2 + 1; 
661.
			$file_name =~ s/(.*)_(\d*)\.(.*)/$1_$count\.$3/; 
662.
663.
		else{ 
664.
			# Not renamed so start counting 
665.
			$file_name =~ s/(.*)\.(.*)/$1_$count\.$2/; 
666.
667.
		&rename_filename($file_name, $count, $upload_dir); 
668.
669.
	else{ return $file_name; } 
670.
671.
 
672.
####################### 
673.
# Normalize file name 
674.
###################### 
675.
sub normalize_filename{ 
676.
	my $file_name = shift; 
677.
	my $delimiter = shift; 
678.
	my $max_file_length = shift; 
679.
 
680.
	$file_name =~ s/^\s+//;   # Trim left 
681.
	$file_name =~ s/\s+$//;   # Trim right 
682.
 
683.
	# Check the length of the file name and cut if neseccary 
684.
	if(length($file_name) > $max_file_length){ $file_name = substr($file_name, length($file_name) - $max_file_length); } 
685.
 
686.
	# Search and replace illegal file name characters 
687.
	$file_name =~ s/[^a-zA-Z0-9\_\.\-]/$delimiter/g; 
688.
 
689.
	return $file_name; 
690.
691.
 
692.
######################### 
693.
# Generate Randon String 
694.
######################### 
695.
sub generate_random_string{ 
696.
	my $length_of_randomstring = shift; 
697.
	my @chars=('a'..'z', '0'..'9'); 
698.
	my $random_string; 
699.
 
700.
	for(my $i = 0; $i < $length_of_randomstring; $i++){ $random_string .= $chars[int(rand(36))]; } 
701.
 
702.
	return $random_string; 
703.
704.
 
705.
##################################################################### 
706.
# Print config, driver settings and 'Environment Variables' to screen 
707.
##################################################################### 
708.
sub debug{ 
709.
	my $config = shift; 
710.
	my $uber_version = shift; 
711.
	my $this_version = shift; 
712.
	my $multi_configs_enabled = shift; 
713.
	my ($msg, $temp_dir_state, $upload_dir_state, $param_dir_state) = (); 
714.
 
715.
	if(!-d $config->{'temp_dir'}){ $temp_dir_state = "<font color='red'>$config->{'temp_dir'}<\/font>"; } 
716.
	else{ $temp_dir_state = "<font color='green'>$config->{'temp_dir'}<\/font>"; } 
717.
 
718.
	if(!-d $config->{'upload_dir'}){ $upload_dir_state = "<font color='red'>$config->{'upload_dir'}<\/font>"; } 
719.
	else{ $upload_dir_state = "<font color='green'>$config->{'upload_dir'}<\/font>"; } 
720.
 
721.
	$msg .= "<u><b>UBER UPLOADER CONFIG SETTINGS<\/b><\/u><br>\n"; 
722.
 
723.
	my $perlversion = $]; 
724.
	my $cgiversion = $CGI::VERSION; 
725.
	my $filecopyversion = $File::Copy::VERSION; 
726.
 
727.
	$msg .= "UBER UPLOADER VERSION = <b>$uber_version<\/b><br>\n"; 
728.
	$msg .= "UU_UPLOAD = <b>$this_version<\/b><br>\n"; 
729.
	$msg .= "CONFIG_FILE = <b>$config->{'config_file_name'}<\/b><br>\n"; 
730.
	$msg .= "PERL VERSION = <b>$perlversion<\/b><br>\n"; 
731.
	$msg .= "CGI.PM VERSION = <b>$cgiversion<\/b><br>\n"; 
732.
	$msg .= "FILE::COPY VERSION = <b>$filecopyversion<\/b><br>\n"; 
733.
 
734.
	if($multi_configs_enabled){ $msg .= "MULTI_CONFIGS_ENABLED = <b><font color='green'>enabled</font><\/b><br>\n"; } 
735.
	else{ $msg .= "MULTI_CONFIGS_ENABLED = <b><font color='red'>disabled</font><\/b><br>\n"; } 
736.
 
737.
	$msg .= "TEMP_DIR = <b>$temp_dir_state<\/b><br>\n"; 
738.
	$msg .= "UPLOAD_DIR = <b>$upload_dir_state<\/b><br>\n"; 
739.
	$msg .= "MAX_UPLOAD = <b>" . format_bytes($config->{'max_upload'}, 99) . "<\/b><br>\n"; 
740.
	$msg .= "GET_DATA_SPEED = <b>$config->{'get_data_speed'}<\/b><br>\n"; 
741.
 
742.
	if($config->{'unique_upload_dir'}){ 
743.
		$msg .= "UNIQUE_UPLOAD_DIR = <b><font color='green'>enabled</font><\/b><br>\n"; 
744.
		$msg .= "UNIQUE_UPLOAD_DIR_LENGTH = <b>$config->{'unique_upload_dir_length'} chars<\/b><br>\n"; 
745.
746.
	else{ $msg .= "UNIQUE_UPLOAD_DIR = <b><font color='red'>disabled</font><\/b><br>\n"; } 
747.
 
748.
	if($config->{'unique_file_name'}){ 
749.
		$msg .= "UNIQUE_FILE_NAME = <b><font color='green'>enabled</font><\/b><br>\n"; 
750.
		$msg .= "UNIQUE_FILE_NAME_LENGTH = <b>$config->{'unique_file_name_length'} chars<\/b><br>\n"; 
751.
752.
	else{ $msg .= "UNIQUE_FILE_NAME = <b><font color='red'>disabled</font><\/b><br>\n"; } 
753.
 
754.
	if($config->{'overwrite_existing_files'}){ $msg .= "OVERWRITE_EXISTING_FILES = <b><font color='green'>enabled</font><\/b><br>\n"; } 
755.
	else{ $msg .= "OVERWRITE_EXISTING_FILES = <b><font color='red'>disabled</font><\/b><br>\n"; } 
756.
 
757.
	if($config->{'normalize_file_names'}){ $msg .= "NORMALIZE_FILE_NAMES = <b><font color='green'>enabled</font><\/b><br>\n"; } 
758.
	else{ $msg .= "NORMALIZE_FILE_NAMES = <b><font color='red'>disabled</font><\/b><br>\n"; } 
759.
 
760.
	if($config->{'normalize_file_names'}){ $msg .= "NORMALIZE_FILE_LENGTH = <b>$config->{'normalize_file_length'} chars<\/b><br>\n"; } 
761.
 
762.
	if($config->{'normalize_file_names'}){ $msg .= "NORMALIZE_FILE_DELIMITER = <b>$config->{'normalize_file_delimiter'}<\/b><br>\n"; } 
763.
 
764.
	if($config->{'link_to_upload'}){ 
765.
		$msg .= "LINK_TO_UPLOAD = <b><font color='green'>enabled</font><\/b><br>\n"; 
766.
		$msg .= "PATH_TO_UPLOAD = <a href=\"$config->{'path_to_upload'}\">$config->{'path_to_upload'}</a><br>\n"; 
767.
768.
	else{ $msg .= "LINK_TO_UPLOAD = <b><font color='red'>disabled</font><\/b><br>\n"; } 
769.
 
770.
	if($config->{'send_email_on_upload'}){ 
771.
		$msg .= "SEND_EMAIL_ON_UPLOAD = <b><font color='green'><a href=\"mailto:$config->{'to_email_address'}?subject=Uber Uploader Email Test\">enabled</a></font><\/b><br>\n"; 
772.
		$msg .= "EMAIL_SUBJECT = <b>$config->{'email_subject'}<\/b><br>\n"; 
773.
 
774.
		if($config->{'html_email_support'}){ $msg .= "HTML_EMAIL_SUPPORT = <b><font color='green'>enabled</font><\/b><br>\n"; } 
775.
		else{ $msg .= "HTML_EMAIL_SUPPORT = <b><font color='red'>disabled</font><\/b><br>\n"; } 
776.
 
777.
		if($config->{'link_to_upload_in_email'}){ $msg .= "LINK_TO_UPLOAD_IN_EMAIL = <b><font color='green'>enabled</font><\/b><br>\n"; } 
778.
		else{ $msg .= "LINK_TO_UPLOAD_IN_EMAIL = <b><font color='red'>disabled</font><\/b><br>\n"; } 
779.
780.
	else{ $msg .= "SEND_EMAIL_ON_UPLOAD = <b><font color='red'>disabled</font><\/b><br>\n"; } 
781.
 
782.
	if($config->{'redirect_after_upload'}){ 
783.
		$msg .= "REDIRECT_AFTER_UPLOAD = <b><font color='green'>enabled</font><\/b><br>\n"; 
784.
		$msg .= "REDIRECT_URL = <a href=\"$config->{'redirect_url'}?cmd=about\">$config->{'redirect_url'}<\/a><br>\n"; 
785.
 
786.
		if(!-d $config->{'param_dir'}){ $param_dir_state = "<font color='red'>$config->{'param_dir'}<\/font>"; } 
787.
		else{ $param_dir_state = "<font color='green'>$config->{'param_dir'}<\/font>"; } 
788.
 
789.
		$msg .= "PARAM_DIR = <b>$param_dir_state<\/b><br>\n"; 
790.
 
791.
		if($config->{'pass_param_dir'}){ $msg .= "PASS_PARAM_DIR = <b><font color='green'>enabled</font><\/b><br>\n"; } 
792.
		else{ $msg .= "PASS_PARAM_DIR = <b><font color='red'>disabled</font><\/b><br>\n"; } 
793.
 
794.
		if($config->{'redirect_using_js_html'}){ $msg .= "REDIRECT_USING_JS_HTML = <b><font color='green'>enabled</font><\/b><br>\n"; } 
795.
		else{ $msg .= "REDIRECT_USING_JS_HTML = <b><font color='red'>disabled</font><\/b><br>\n"; } 
796.
 
797.
		if($config->{'redirect_using_html'}){ $msg .= "REDIRECT_USING_HTML = <b><font color='green'>enabled</font><\/b><br>\n"; } 
798.
		else{ $msg .= "REDIRECT_USING_HTML = <b><font color='red'>disabled</font><\/b><br>\n"; } 
799.
 
800.
		if($config->{'redirect_using_js'}){ $msg .= "REDIRECT_USING_JS = <b><font color='green'>enabled</font><\/b><br>\n"; } 
801.
		else{ $msg .= "REDIRECT_USING_JS = <b><font color='red'>disabled</font><\/b><br>\n"; } 
802.
 
803.
		if($config->{'redirect_using_location'}){ $msg .= "REDIRECT_USING_LOCATION = <b><font color='green'>enabled</font><\/b><br>\n"; } 
804.
		else{ $msg .= "REDIRECT_USING_LOCATION = <b><font color='red'>disabled</font><\/b><br>\n"; } 
805.
806.
	else{ $msg .= "REDIRECT_AFTER_UPLOAD = <b><font color='red'>disabled</font><\/b><br>\n"; } 
807.
 
808.
	if($config->{'log_uploads'}){ 
809.
		$msg .= "LOG_UPLOADS = <b><font color='green'>enabled</font><\/b><br>\n"; 
810.
 
811.
		if($config->{'log_params'}){ $msg .= "LOG_PARAMS = <b><font color='green'>enabled</font><\/b><br>\n"; } 
812.
		else{ $msg .= "LOG_PARAMS = <b><font color='red'>disabled</font><\/b><br>\n"; } 
813.
 
814.
		if(!-d $config->{'log_dir'}){ $msg .= "LOG_DIR = <b><font color='red'>$config->{'log_dir'}<\/font><\/b><br>\n"; } 
815.
		else{ $msg .= "LOG_DIR = <b><font color='green'>$config->{'log_dir'}<\/font><\/b><br>\n"; } 
816.
 
817.
818.
	else{ $msg .= "LOG_UPLOADS = <b><font color='red'>disabled</font><\/b><br>\n"; } 
819.
 
820.
	$msg .= "<br><u><b>ENVIRONMENT VARIABLES<\/b><\/u><br>\n"; 
821.
 
822.
	foreach my $key (sort keys(%ENV)){ $msg .= "$key = <b>$ENV{$key}<\/b><br>\n"; } 
823.
 
824.
	&kak($msg, 1, __LINE__); 
825.
}
Mitglied: 58502
06.12.2007 um 21:43 Uhr
Reife Leistung, 942 Code Zeilen im Beitrag!

Hier fehlt ein Smiley.........
Bitte warten ..
Mitglied: 35801
06.12.2007 um 22:05 Uhr
Sorry....

Ich weiß leider nicht welcher Teil für die Verzeichnis-Erstellung zuständig ist...

Ich hoffe jemand hat die Muse und reißt mich aus dem Schlamessel raus...

Ach ja...
Hätt ich fast vergessen...


... Ein Smiley... NUR für dich!
Bitte warten ..
Mitglied: Dani
06.12.2007 um 22:05 Uhr
Abend,
also das ne ich mal n Perl-Script. Direkt kann ich dir leider im Moment nicht weiterhelfen, da ich das CMS o.ä. nicht komplett kenne. Aber diese Zeilen sollten dir weiterhelfen:
01.
# Create a unique directory inside the upload directory if config setting 'unique_upload_dir' is enabled 
02.
if($main::config->{'unique_upload_dir'}){ 
03.
	$unique_dir = &generate_random_string($main::config->{'unique_upload_dir_length'}); 
04.
	$main::config->{'upload_dir'} .= $unique_dir . '/'; 
05.
 
06.
	if($main::config->{'link_to_upload'} || $main::config->{'link_to_upload_in_email'}){ $main::config->{'path_to_upload'} .= $unique_dir . '/'; } 
07.
}
Ansonsten muss ich mir das mal in Ruhe anschauen.


Grüße
Dani
Bitte warten ..
Mitglied: 35801
06.12.2007 um 22:09 Uhr
Glaubst du die könnte funzen:

$main::config->{'upload_dir'} .= $unique_dir . '/' . $pd. '/'; ???


Danke,
Peter
Bitte warten ..
Neuester Wissensbeitrag
Windows 10

Powershell 5 BSOD

(8)

Tipp von agowa338 zum Thema Windows 10 ...

Ähnliche Inhalte
JavaScript
AngularJS Variable über Input in Funktion ausführen

Frage von badkilla zum Thema JavaScript ...

Batch & Shell
Batch-Variable nach Stichworten aus TXT Datei durchsuchen (3)

Frage von Markus5579 zum Thema Batch & Shell ...

Batch & Shell
gelöst Selected Gridview Value in Variable schreiben (4)

Frage von reissaus73 zum Thema Batch & Shell ...

Heiß diskutierte Inhalte
Microsoft
Ordner mit LW-Buchstaben versehen und benennen (21)

Frage von Xaero1982 zum Thema Microsoft ...

Windows Update
Treiberinstallation durch Windows Update läßt sich nicht verhindern (17)

Frage von liquidbase zum Thema Windows Update ...

Windows Tools
gelöst Aussendienst Datensynchronisierung (12)

Frage von lighningcrow zum Thema Windows Tools ...

Windows Server
RODC über VPN - Verbindung weg (10)

Frage von stefan2k1 zum Thema Windows Server ...