![]() |
|< 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
69
70
71
72
73
#!/usr/bin/perl
use strict;
use warnings;
use CGI qw( :all );
use CGI::Carp qw(fatalsToBrowser);
my $cgi = new CGI;
my %params = $cgi->Vars();
print $cgi->header();
my $Autor = "Andre Hornig";
print $cgi->default_dtd('-//W3C//DTD HTML 4.01 Transitional//EN'),
$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'});
if($params{action} == 1){
save_link(\%params);
}
show_links();
print $cgi->end_html();
sub save_link{
my ($paramref) = @_;
my $pfad = '/SAN/content/cgi-bin/links';
my $url = $paramref->{'links'};
my $text = $paramref->{'beschreibung'};
$text =~ s/\r?\n/<br>/sg;
open(DATEI,'>>',$pfad) or die $!;
print DATEI "$url\n";
print DATEI "$text\n";
close (DATEI) or die $!;
}
sub show_links{
#File einlesen und in ein Array speichern.
my $link;
my $pfad = '/SAN/content/cgi-bin/links';
open(DATEI, '<', $pfad) or die $!;
while(my $line = <DATEI>){
if($. % 2 == 0){
print $cgi->p('',$cgi->a({-href => $link},$zeile));
}
else{
$link = $line;
}
close(DATEI);
#Ausgabe der Seite
print <<"EOF";
<h1>Neuen Link eintragen</h1>
<form action="$dein_skript" 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>
<input type="hidden" name="action" value="1" />
</form>
EOF
}
![]() |
|< 1 2 >| | ![]() |
11 Einträge, 2 Seiten |