Note These links will take you off the RonMaxwell.com site. Do not be alarmed.
Their content is not authorized by RonMaxwell, and these links are provided as a visitor service only.
If you have any difficulty with the links below, or have any suggestions for other links you\'d like to
see here, please let us know.
|;
my %hash = %{&read_cat_file};
if ($ENV{'SCRIPT_FILENAME'} =~ /dev/) {
if (param()) {
my %inhash;
open LOG, ">/home/ronmaxwe/www/dev/links.log";
for (param()) {
next unless (param($_));
/(\d+)\_href/ and do {$inhash{$1}->{'href'} = param($_); print LOG "set href for $1 to $inhash{$1}->{'href'}\n";next;};
/(\d+)\_cat/ and do {$inhash{$1}->{'category'} = param($_);print LOG "set cat for $1 to $inhash{$1}->{'category'}\n";next;};
/(\d+)\_img/ and do {$inhash{$1}->{'img'} = param($_);print LOG "set img for $1 to $inhash{$1}->{'img'}\n";next;};
/(\d+)\_text/ and do {$inhash{$1}->{'text'} = param($_);print LOG "set text for $1 to $inhash{$1}->{'text'}\n";next;};
/(\d+)\_delete/ and do {delete $inhash{$1}; &pclear($1); print LOG "deleted $1 from inhash\n"; next;}; # if (param($_) eq 'on')
next;
}
&write_cat_file(\%inhash);
close LOG;
}
%hash = %{&read_cat_file};
print h3("Edit Links Form");print startform;
print "| Category | Link URL, Link Text, and (optional) Image URL | | ";
for (sort keys %hash) {
for $ln (@{$hash{$_}->{links}}) {
$ct++;
param("${ct}_cat",$hash{$_}->{category});
$catlen = length($hash{$_}->{category});
param("${ct}_href",$ln->{'href'});
$hreflen = length($ln->{'href'});
param("${ct}_img", $ln->{'img'});
$imglen = length($ln->{'img'}) || 25;
param("${ct}_text", $ln->{'text'});
$textlen = length($ln->{'text'});
print '| '.textfield(-name=>"${ct}_cat", -size => $catlen).
' | LINK: '.textfield(-name=>"${ct}_href", -size => $hreflen).
' TEXT: '.textfield(-name=>"${ct}_text", -size => $textlen).
' IMAGE: '.textfield(-name=>"${ct}_img", -size => $imglen).
' | '.checkbox(-name=>"${ct}_delete",-label=>'Delete Link').' | ';
}
}
$ct++;
print '| '.textfield(-name=>"${ct}_cat").
' | LINK: '.textfield(-name=>"${ct}_href").
' TEXT: '.textfield(-name=>"${ct}_text").
' IMAGE: '.textfield(-name=>"${ct}_img").
' | Add New Link Here | ';
print ' '.submit(-value=>"Update Links Page").endform;
&footer;
} else {
for (sort keys %hash) {
print h3($hash{$_}->{category}).'';
for $ln (@{$hash{$_}->{links}}) {
my $href = $ln->{'href'};
my $img = $ln->{'img'};
my $text = $ln->{'text'};
my $imgtag = ($img) ? " " : ' ';
print qq|
| $imgtag | $text |
|;
}
print ' ';
}
&footer;
}
sub pclear {
my $key = shift;
param ("${key}_cat",'');
param ("${key}_href",'');
param ("${key}_img",'');
param ("${key}_text",'');
print LOG "cleared params for $key";
}
sub read_cat_file {
open FILE, "/home/ronmaxwe/www/dev/links.txt";
my %hash; my $ct = 0; my $oldcat;
while () {
chomp;
my %lhash;
my ($cat,$href,$img,$text) = split (/\|/,$_);
if ($cat ne $oldcat) {
$hash{++$ct}->{category} = $cat;
$oldcat = $cat;
}
chomp $text;
$lhash{'href'} = $href;
$lhash{'img'} = $img;
$lhash{'text'} = $text;
push @{$hash{$ct}->{'links'}},\%lhash;
}
close FILE;
return \%hash;
}
sub write_cat_file {
open FILE, ">/home/ronmaxwe/www/dev/links.txt";
my %hash = %{$_[0]};
for (sort {$a <=> $b} keys %hash) {
print FILE "$hash{$_}->{'category'}|$hash{$_}->{'href'}|$hash{$_}->{'img'}|$hash{$_}->{'text'}\n";
}
close FILE;
return \%hash;
}
sub footer {
print <
This Site is a member of the following web rings
EOPAGE
open FOOT, "/home/ronmaxwe/www/foot.html";
while () {print;}
close FOOT;
}
|