File showing problem 
Author Message
 File showing problem

Hi everybody,

I have a tiny problem
I made below script, but I want it to show the content of the file, not the
filename.
Can someone help me?

--

#!/usr/bin/perl
$cardurl = "/home/data/cards/store/";

&get_form;
&set_var;

print "Content-type: text/html\n\n";
print "<HTML>\n";
print "$cardurl$card\n\n";
print "</HTML>\n";

sub set_var {
$job       =&get_var('job'      ,'\n|?');
$fromname  =&get_var('fromname' ,'\n|?');
$fromemail =&get_var('fromemail','\n|?');
$toname    =&get_var('toname'   ,'\n|?');
$toemail   =&get_var('toemail'  ,'\n|?');
$card      =&get_var('card'     ,'\n|?');
$midi      =&get_var('midi'     ,'\n|?');
$backcolor =&get_var('backcolor','\n|?');
$wordcolor =&get_var('wordcolor','\n|?');
$subject   =&get_var('subject'  ,'\n|?');
$subject   =~ s/\"/'/g;
$message   =&get_var('message'  ,'?');

Quote:
}



  ($name,$value) = split(/=/, $_);
  &setvaluetoform($name, $value);

Quote:
}



  ($name, $value) = split(/=/, $_);
  &setvaluetoform($name, $value);

Quote:
}
}

sub setvaluetoform {
$name=$_[0];
$value=$_[1];
$name=&decode($name);
$name=&filterhtml($name);
$value=&decode($value);
$value=&filterhtml($value);
if ($FORM{$_[0]}) {$FORM{$_[0]}="$FORM{$_[0]}?$_[1]";}
else {$FORM{$_[0]}=$_[1];}

Quote:
}

sub decode {
local($return)=$_[0];
$return =~ tr/+/ /;
$return =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
return $return;

Quote:
}

sub filterhtml {
local($return)=$_[0];
$return =~ s/<!--(.|\n)*-->//g;
if ($allow_html != 1) {
   $return =~ s/<([^>]|\n)*>//g;
   $return =~ s/<//g;

Quote:
}

return $return;

Quote:
}

sub get_var {
local($return)="";
$return="$FORM{$_[0]}" if ($FORM{$_[0]});
$return=~ s/$_[1]//g;
return $return;

Quote:
}

sub get_var {
local($return)="";
$return="$FORM{$_[0]}" if ($FORM{$_[0]});
$return=~ s/$_[1]//g;
return $return;

Quote:
}

exit;


Mon, 17 Jun 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Problems with MSIE in combination with MAC not showing Perl generated HTML

2. Perl Test Problem - show-shebang

3. Parse::RecDescent problem, $::RD_TRACE showing something very odd.

4. show() problem!!

5. LabEntry problem - label not showing in 5.5.3

6. Problem to show a progress bar working

7. CGI: How to display the contents of a file regardless of type without showing their location

8. SRC: pmload - show what files a module loads

9. SRC: plxload -- show what files a perl program loads

10. showing a Gif file

11. Can Perl make Web Browser show arbitrary file?

12. Show files for download

 

 
Powered by phpBB® Forum Software