#! /usr/local/bin/perl use CGI qw(:all); print header; my $title = 'Ron Maxwell - external site links'; open HEAD, "/home/ronmaxwe/www/head.html"; while () { $_=~ s/().+(<\/title>)/\1$title\2/i; print $_; } close HEAD; print qq| <TABLE WIDTH="488" HEIGHT="356" BORDER="0" CELLSPACING="0" CELLPADDING= "0"> <TR> <P> <TD> <FONT SIZE=2><B>Note</B> 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 <A HREF="mailto:info\@ronmaxwell.com">let us know</A>.</FONT><HR SIZE=1 NOSHADE> <FONT FACE="Arial,Helvetica" SIZE=2> |; 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 "<TABLE BORDER=1 CELLSPACING=0><TR><TH>Category</TH><TH>Link URL, Link Text, and (optional) Image URL</TH><TH> </TH></TR>"; 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 '<TR><TD VALIGN=TOP>'.textfield(-name=>"${ct}_cat", -size => $catlen). '</TD><TD>LINK: '.textfield(-name=>"${ct}_href", -size => $hreflen). '<BR>TEXT: '.textfield(-name=>"${ct}_text", -size => $textlen). '<BR>IMAGE: '.textfield(-name=>"${ct}_img", -size => $imglen). '</TD><TD><FONT SIZE=1 FACE="Arial, Helvetica">'.checkbox(-name=>"${ct}_delete",-label=>'Delete Link').'</TD></TR>'; } } $ct++; print '<TR><TD>'.textfield(-name=>"${ct}_cat"). '</TD><TD>LINK: '.textfield(-name=>"${ct}_href"). '<BR>TEXT: '.textfield(-name=>"${ct}_text"). '<BR>IMAGE: '.textfield(-name=>"${ct}_img"). '</TD><TD NOWRAP><FONT SIZE=1>Add New Link Here</TD></TR>'; print '</TABLE>'.submit(-value=>"Update Links Page").endform; &footer; } else { for (sort keys %hash) { print h3($hash{$_}->{category}).'<P><TABLE BORDER=0>'; for $ln (@{$hash{$_}->{links}}) { my $href = $ln->{'href'}; my $img = $ln->{'img'}; my $text = $ln->{'text'}; my $imgtag = ($img) ? "<A HREF=\"$href\"><IMG HEIGHT=60 SRC=\"$img\" ALIGN=\"TEXTMIDDLE\" BORDER=\"0\"></A>" : ' '; print qq| <TR><TD ALIGN=RIGHT>$imgtag</TD><TD><FONT FACE="Arial,Helvetica" SIZE=2><A HREF="$href">$text</A></TD></TR> |; } print '</TABLE>'; } &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 (<FILE>) { 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 <<EOPAGE; <HR SIZE=1 NOSHADE> <A NAME="webrings"><H3> This Site is a member of the following web rings </H3> <P> <CENTER> <P><TABLE BORDER=10 CELLPADDING=3 CELLSPACING=3 WIDTH=500> <TR><TH> <FONT Size=2> <a href="http://www.geocities.com/Area51/Corridor/2651/cwring.html" target="_top"> <img src="http://www.geocities.com/Area51/Corridor/2651/cw1.gif" align="left" WIDTH=130 HEIGHT=130></a> <a href="http://www.webring.org/cgi-bin/webring?ring=stonewall;id=462;next" target="_top"> <img src="http://www.geocities.com/Area51/Corridor/2651/cw2.gif" align="right" WIDTH=130 HEIGHT=130></a> <FONT Size=2> This <a href="http://www.geocities.com/Area51/Corridor/2651/cwring.html" target="_top"> Civil War Heritage Ring</a> site is owned by <BR> <a href="mailto:info\@ronmaxwell.com"><FONT SIZE="2">Ron Maxwell</FONT></a>. <BR><BR> <FONT SIZE="2"> Enlist in the <A HREF="http://www.geocities.com/Area51/Corridor/2651/cwring.html" target="_top">Civil War Heritage Ring</A>!</FONT> </TH></TR> <TR><TH> <FONT Size=3> [<a href="http://www.webring.org/cgi-bin/webring?ring=stonewall;id=462;sprev" target="_top">Skip Prev</a>] [<a href="http://www.webring.org/cgi-bin/webring?ring=stonewall;id=462;prev" target="_top">Prev</a>] [<a href="http://www.webring.org/cgi-bin/webring?ring=stonewall;id=462;next" target="_top">Next</a>] [<a href="http://www.webring.org/cgi-bin/webring?ring=stonewall;id=462;skip" target="_top">Skip Next</a>] [<a href="http://www.webring.org/cgi-bin/webring?random;stonewall" target="_top">Random</a>] [<a href="http://www.webring.org/cgi-bin/webring?ring=stonewall;id=462;next5" target="_top">Next 5</a>] [<a href="http://www.webring.org/cgi-bin/webring?ring=stonewall;list" target="_top">List Sites</a>] </FONT> </TH></TR></TABLE> </CENTER> <P> <P> <P> </A> <HR NOSHADE SIZE=1> <table align=center border=7 cellspacing=7> <tr> <td align=middle> <font size=2> <a href="http://www.petesmoviepage.com/moviering.html" target="_top"> <img src="http://www.petesmoviepage.com/mring.gif" align=left alt="The Movie Ring" border=0></a> </td> <td align=middle> <center><br><h5> This <a href="http://www.petesmoviepage.com/moviering.html" target="_top">Movie Ring</a> site <br>is owned by <a href="mailto:info\@ronmaxwell.com">Ron Maxwell</a>. <br><br> [ <a href="http://www.webring.org/cgi-bin/webring?ring=moviering&id=930&prev" target="_top">Prev</a> | <a href="http://www.webring.org/cgi-bin/webring?ring=moviering&id=930&skip" target="_top">Skip It</a>| <a href="http://www.webring.org/cgi-bin/webring?ring=moviering&id=930&next5" target="_top">Next 5</a>| <a href="http://www.webring.org/cgi-bin/webring?ring=moviering&id=930&random" target="_top">Random</a>| <a href="http://www.webring.org/cgi-bin/webring?ring=moviering&id=930&next" target="_top">Next</a> ] <br><br> Want to join the ring? Get the <a href="http://www.petesmoviepage.com/moviering.html" target="_top">info</a>. <br><br></center></h5> </font> </td> <td align=middle> <a href="http://www.webring.org/cgi-bin/webring?ring=moviering&id=930&next" target="_top"> <img src="http://www.petesmoviepage.com/mring2.gif" align=right alt="Next page" border=0></a> </td> </tr> </table> <P> <HR NOSHADE SIZE=1> <table align=center cellpadding=6 border=1 bgcolor="#eeeeee" width="100%"> <tr align=center><td><a href="http://nav.webring.org/cgi-bin/navcgi?id=465&ring=movies&home"><img src="http://www.geocities.com/Hollywood/2464/mrr.gif" width=75 height=24 border=0 alt="mrr"></a> </td><td><font color="#000000"><center><font size=+2>The Movie Review Ring</font><br> This <a href="http://nav.webring.org/cgi-bin/navcgi?id=465&ring=movies&home">Movie Review Ring</a> site is owned by <a href="mailto:info\@ronmaxwell.com">Ron Maxwell</a>.<br> Want to join the ring? Click here for <a href="http://nav.webring.org/cgi-bin/navcgi?id=465&ring=movies&home">info</a>. <br> [ <a href="http://nav.webring.org/cgi-bin/navcgi?id=465&ring=movies&list">List All Sites</a> ] <br> [ <a href="http://nav.webring.org/cgi-bin/navcgi?id=465&ring=movies&prev5">Prev 5</a> | <a href="http://nav.webring.org/cgi-bin/navcgi?id=465&ring=movies&prev">Prev</a> | <b><a href="http://nav.webring.org/cgi-bin/navcgi?id=465&ring=movies&random">Random</a></b> | <a href="http://nav.webring.org/cgi-bin/navcgi?id=465&ring=movies&next">Next</a> | <a href="http://nav.webring.org/cgi-bin/navcgi?id=465&ring=movies&next5">Next 5</a> ]</font></center></td><td><a href="http://nav.webring.org/cgi-bin/navcgi?id=465&ring=movies&next"> <img src="http://www.geocities.com/Hollywood/2464/mrnext.gif" width=91 height=29 border=0 alt="next"></a></td></tr></table> <mind-it-ignore><!-- ENDCONTENT --> EOPAGE open FOOT, "/home/ronmaxwe/www/foot.html"; while (<FOOT>) {print;} close FOOT; }