Thread Problem: Aus @ wird%40. (22 answers)
Opened by Gast at 2008-05-19 11:20

renee
 2008-05-19 11:58
#109900 #109900
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Wie moritz schon sagte, solltest Du CGI.pm verwendan, also anstatt
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);

# Un-Webify plus signs and %-encoding
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;

if ($allow_html != 1) {
$value =~ s/<([^>]|\n)*>//g;
}

$FORM{$name} = $value;
if ($name ne 'Submit')
{
print FILE $name;
print FILE "=";
print FILE $value;
print FILE "\n";
print HTMLFILE "<TR>\n";
print HTMLFILE "<TD>";
print HTMLFILE $name;
print HTMLFILE "</TD>\n";
print HTMLFILE "<TD>";
print HTMLFILE $value;
print HTMLFILE "</TD>\n";
print HTMLFILE "</TR>\n";
}
}


lieber das hier schreiben:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use CGI;

my %FORM = CGI::Vars();

if( $allow_html != 1 ){
    for my $key ( keys %FORM ){
        $FORM{$key} =~ s/<([^>]|\n)*>//g;
    }
}

while( my ($key,$value) = each %FORM ){
    next if( $key eq 'Submit' );
    print FILE $key, "=", $value, "\n";
    print HTMLFILE  "<tr>\n<td>$key</td>\n<td>$value</td>\n<tr>\n";
}


Edit: noch das "allow_html" hinzugefĆ¼gt
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread Problem: Aus @ wird%40.