#!/usr/bin/perl -T # Copyright (c) 1998 Moogle Stuffy, Inc. All rights reserved. # This program is free software; you can redistribute it and/or # modify it under the same terms as Perl itself. # Input: # noframes: 1|0 # No frames? # cookie: Kupo!|0 # Set cookie? $|++; use lib qw(../lib); use CGI; my $q = new CGI; # Delete stray name/value pairs. my %keep = map {$_, 1} qw[noframes text sort size cookie]; for ($q->param) { $keep{$_} or $q->delete($_); } # Check 'preference' cookie. if ($q->param('cookie')) { # Set cookie = query. $q->delete('cookie'); my %pref = map {@_ = $q->param($_); $_, $#_ ? \@_ : $_[0]} $q->param; $cookie = $q->cookie( -name => 'LTM art preferences', -value => \%pref, -expires => '+1y', ); } else { # Set query = cookie || query. my %pref = $q->cookie('LTM art preferences'); $q = new CGI(\%pref) if %pref; } # Save query. my $query_string = $q->query_string; # Send HTML. if ($q->param('noframes')) { # Redirect to ./gallery.cgi my ($base_url) = map {m!^(.+)/!s} $q->url; print $q->redirect( -cookie => $cookie, -uri => "$base_url/gallery.cgi?$query_string", ); } else { # Print a frameset. my $art_side = $q->cookie('LTM art_side') || 'contents.cgi'; print $q->header(-cookie => $cookie) if $ENV{'SERVER_NAME'}; print <