|< 1 2 >| | 11 Einträge, 2 Seiten |
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/perl
use strict;
use warnings;
use CGI qw( :all );
use CGI::Carp qw(fatalsToBrowser);
my$cgi = new CGI;
#File einlesen und in ein Array speichern.
my $pfad = '/SAN/content/cgi-bin/links';
open(DATEI, '<', $pfad);
my @inhalt=<DATEI>;
close(DATEI);
#Ausgabe Header usw.
my $Autor = "Andre Hornig";
$cgi->default_dtd('-//W3C//DTD HTML 4.01 Transitional//EN');
print $cgi->header(),
$cgi->start_html('Linkit'),
$cgi->h1('Linkit'),
$cgi->p('Eine kleine Favoritenliste'),
$cgi->p({-style => 'color:red'}, "Verfasst von: ", $cgi->i($Autor)),
$cgi->hr({-noshade => undef, -size => '1'}),
$cgi->end_html();
#Verarbeitung des Files mit Ausgabe
my $link;
my $i = 0;
foreach my $zeile (@inhalt) {
if ($i == 0 ) {
$link = $zeile;
$i = $i + 1
}
else {
print $cgi->p('',$cgi->a({-href => $link},$zeile));
$i = 0;
}
}
#Ausgabe der Seite
print <<"EOF";
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Kommentarseite</title>
</head>
<body bgcolor="#99ccff">
<h1>Neuen Link eintragen</h1>
<form action="http://192.168.220.128/cgi-bin/comments.pl" method="post">
<p>Link:<br><input type="text" name="AnwenderName" size="40" maxlength="40"></p>
<p>Beschreibung:<br><textarea rows="5" cols="50" name="Kommentartext"></textarea></p>
<p><input type="submit" value="Absenden"></p>
</form>
</body>
</html>
EOF
1
2
3
open(my $fh,">>",$linkfile) or die $!;
print $fh $url,"\n",$linktext,"\n";
close $fh or die $!;
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
#!/usr/bin/perl
use strict;
use CGI::Carp qw(fatalsToBrowser);
read(STDIN, my $Daten, $ENV{'CONTENT_LENGTH'});
my @Formularfelder = split(/&/, $Daten);
my ($Feld, $Name, $Wert);
my %Formular;
foreach $Feld (@Formularfelder) {
(my $Name, my $Wert) = split(/=/, $Feld);
$Wert =~ tr/+/ /;
$Wert =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$Wert =~ s/</</g;
$Wert =~ s/>/>/g;
$Formular{$Name} = $Wert;
}
print "Content-type: text/html\n\n";
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">', "\n";
print "<html><head><title>Feedback</title></head>\n";
print "<body><h1>Feedback Ihrer Eingabe vom Programm <i>comments.pl</i></h1>\n";
print "<p><b>Link:</b> $Formular{links}</p>\n";
print "<p><b>Beschreibung:</b> $Formular{beschreibung}</p>\n";
print "</body></html>\n";
1
2
3
4
5
my $pfad = '/SAN/content/cgi-bin/links';
open(DATEI, '>>', $pfad);
print "$Formular\n";
print "$Formular\n";
close(DATEI);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/perl
use strict;
use warnings;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
my $cgi = CGI->new();
print $cgi->header();
my $linkfile = '/path/to/file.links';
my $url = $cgi->param('AnwenderName');
my $text = $cgi->param('Kommentartext');
$text =~ s/\r?\n/<br>/sg;
open(my $fh,">>",$linkfile) or die $!;
print $fh $url,"\n",$text,"\n";
close $fh or die $!;
print $cgi->b('Link wurde eingetragen');
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/perl
use strict;
use CGI::Carp qw(fatalsToBrowser);
read(STDIN, my $Daten, $ENV{'CONTENT_LENGTH'});
my @Formularfelder = split(/&/, $Daten);
my ($Feld, $Name, $Wert);
my %Formular;
foreach $Feld (@Formularfelder) {
(my $Name, my $Wert) = split(/=/, $Feld);
$Wert =~ tr/+/ /;
$Wert =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$Wert =~ s/</</g;
$Wert =~ s/>/>/g;
$Formular{$Name} = $Wert;
}
1
2
3
4
5
my $pfad = '/SAN/content/cgi-bin/links';
open(DATEI, '>>', $pfad);
print "$Formular\n";
print "$Formular\n";
close(DATEI);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/perl
use strict;
use warnings;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
my $cgi = CGI->new();
print $cgi->header();
my $pfad = '/SAN/content/cgi-bin/links';
my $url = $cgi->param('links');
my $text = $cgi->param('beschreibung');
$text =~ s/\r?\n/<br>/sg;
open(DATEI,'>>',$pfad) or die $!;
print DATEI "$url\n";
print DATEI "$text\n";
close (DATEI) or die $!;
print $cgi->b('Link wurde eingetragen');
<form action="http://192.168.220.128/cgi-bin/comments.pl" method="post">
$text =~ s/\r?\n/<br>/sg;
$text =~ s/\r?\n/<br>/sg;
<input type="hidden" name="action" value="1" />
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/perl
use strict;
use warnings;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
my $cgi = CGI->new();
my %params = $cgi->Vars();
print $cgi->header();
if($params{action} == 1){
# trage Link in die Datei ein
}
else{
# zeige die Links an
}
|< 1 2 >| | 11 Einträge, 2 Seiten |