#!/usr/bin/perl #################################################################################### # people Script (links.cgi) Copyright 2000 Brian Lozier (lozier@bigfoot.com). # # Do not distribute this file without the readme.html file that was included in # # the zip! Please read the readme.html file - it includes important installation # # instructions as well as copyright information. # #################################################################################### # Declare variables. ############################################### # people database file: $db = "links.dat"; # Category File: $cat_file = "categories.dat"; # Title: $title = "Pirate4x4.com 2002 Rubicon Cleanup"; # Background Color: $bgcolor = "black"; # Background Image: $bgimage = ""; # Text Color: $text = "#ffffff"; # Link Color: $link = "#ffffff"; # Visited Link Color: $vlink = "#00FF00"; # Active Link Color: $alink = "#ffffff"; # Font Face: $font = "Arial, Helvetica, sans-serif"; # Font Size: $size = "2"; # Top Variable: $top_variable = ""; # Bottom Variable: $bottom_variable = ""; # Check for Duplicate people? (Options are yes/no) $check_links = "no"; # Display Copyright Notice? (Options are yes/no) $copyright_notice = "yes"; # Disclaimer: # This is the text that displays when someone is adding a Person. # Please don't use any special characters, or it may break the # script. Only modify the text, don't mess with any code! sub Disclaimer { print<<"END";

Pirate4x4.com Cleanup 2002!

END } # End Disclaimer # Define the data type for the browser. ############################################### print "Content-type: text/html\n\n"; # Parse the incoming data. ############################################### &ReadParse; # Get the Query from the Environment Variables. ############################################### if ($in{'action'} eq '') { $in{'action'} = "print_main"; } # End if # Function: print_main: ############################################### if ($in{'action'} eq 'print_main') { &PrintMainHeader; # Get number of people in each category: ############################################### open(links,"$db") or &dienice("Could not open file: $db.\n"); @links = ; close(links); foreach $line (@links) { chomp($line); ($Person_num, $name, $cat_num, $url, $description) = split(/\|/,$line); $count{"$cat_num"}++; } # End foreach # List categories: ############################################### open(CATS,"$cat_file") or &dienice("Could not open file: $cat_file.\n"); @cats = ; close(CATS); print "\n"; &PrintFooter; } # End print_main # Function: view_cat: ############################################### elsif ($in{'action'} eq 'view_cat') { &PrintSubHeader; open(CATS,"$cat_file") or &dienice("Could not open file: $cat_file.\n"); @cats = ; close(CATS); foreach $line (@cats) { chomp($line); ($cat_num, $category, $cat_descrip) = split(/\|/,$line); if ($in{'category'} eq $cat_num) { print "Viewing Category: $category\n"; } # End if } # End foreach open(links,"$db") or &dienice("Could not open file: $db.\n"); @links = ; close(links); print "
    \n"; # Get all people in category foreach $line (@links) { chomp($line); ($Person_num, $name, $cat_num, $url, $description) = split(/\|/,$line); if ($in{'category'} eq $cat_num) { $new_line = join('|', $name, $url, $description); push @new_links, $new_line; } # End if } # End foreach # Sort the people @new_links = sort @new_links; # Spit out the alphabetized list foreach $line (@new_links) { chomp($line); ($name, $url, $description) = split(/\|/,$line); print "
  • $name - $description
  • \n"; } # End foreach print "
\n"; &PrintFooter; } # End view_cat # Function: add_Person: ############################################### elsif ($in{'action'} eq 'add_Person') { &PrintSubHeader; print "\n"; &Disclaimer; print "\n"; # List categories: ############################################### open(CATS,"$cat_file") or &dienice("Could not open file: $cat_file.\n"); @cats = ; close(CATS); print<<"END";
Please choose a category:

END foreach $line (@cats) { chomp($line); ($cat_num, $category, $cat_descrip) = split(/\|/,$line); print "$category
\n"; } # End foreach print<<"END";
Please type your name:


If you have a website type the url here:


Please type a short description of what you will be bringing or what type of work you prefer to do (trail maintenance, trash cleanup, turd patrol, etc.):


END &PrintFooter; } # End add_Person # Function: post_Person: ############################################### elsif ($in{'action'} eq 'post_Person') { &PrintSubHeader; unless ($in{'name'} and $in{'cat_num'} and $in{'url'} and $in{'description'}) { &dienice("You forgot to fill in all the fields, please use your [Back] button.\n"); } # End unless open(links,"$db") or &dienice("Could not open file: $db.\n"); @links = ; close(links); # Check for duplicate people if ($check_links eq "yes") { foreach $line (@links) { chomp($line); ($Person_num, $name, $cat_num, $url, $description) = split(/\|/,$line); if ($in{'url'} eq $url) { &dienice("We're sorry, but a Person with that URL already exists in our database."); } # End if } # End foreach } # End if $old_record = $links[0]; chomp($old_record); ($Person_num, $name, $cat_num, $url, $description) = split(/\|/,$old_record); if($Person_num) { $Person_num++; } # End if else { $Person_num = 1; } # End else $record = join('|', $Person_num, $in{'name'}, $in{'cat_num'}, $in{'url'}, $in{'description'}); open(links,">$db") or &dienice("Could not open file: $db.\n"); flock(links, 2) or &dienice("Could not lock file: $db.\n"); print links "$record\n"; foreach $line (@links) { chomp($line); print links "$line\n"; } # End foreach close(links); print<<"END"; Your Person was successfully added! END &PrintFooter; } # End post_Person #################################################################################### # Subroutine to print main header. # #################################################################################### sub PrintMainHeader { print<<"END"; $title $title
$top_variable

6th Annual 2002 Rubicon Cleanup

Join us at the 6th annual Rubicon Cleanup! Help us keep the Rubicon Trail clean and open! Click on the category below to add yourself. We will need several trailers in each group this year for trash bags and such, so if you can bring one, please bring it empty. Please dont forget to sign-in or you'll miss out on the raffle ticket and you must sign-in to get one. We will have the largest raffle to date at the cleanup, with fantastic prizes like a Warn 9000lb winch, and ARB airlocker, and more!

When: October 19, 2002

Where: Sign up will be between 8 and 9 am at the spillway, or on the slab above the little sluice depending on where your work location will be.

END } # End PrintMainHeader #################################################################################### # Subroutine to print sub header. # #################################################################################### sub PrintSubHeader { print<<"END"; $title $title $top_variable

$title


[Add a Person] [Back to Main]

END } # End PrintSubHeader #################################################################################### # Subroutine to print footer. # #################################################################################### sub PrintFooter { if($copyright_notice eq "yes") { print<<"END";


www.Pirate4x4.com


Some information on how the clean up will operate

Loon lake will be the main sign up area. Most of the groups will start from Loon lake. A small group will work from the Tahoe side (Buck Island), and the rest will work from Spider lake.

Loon lake: Jeff Fretwell and Ron Kirby will be assigning jobs Saturday morning from 8am-9ish. We will have about 10 groups leaving Loon from 8am-10am Saturday. There will be 4 bypass patrol groups. 1st to leave will be the Ellis to Walker Hill group led by Billy Bob and Johny Rotten, 2nd group will be the back side of Loon (Meadow area) led by Bill (WB), and the third group will be the gatekeeper area. This group will be the last to leave the spillway to keep the trail clear and will be led by Sean (Gearman).

The 4th Bypass patrol group will leave from Spider Lake Saturday morning and work from Spider to Walker. Crew leaders will be Bob Roggy and Vince Howdyshell.

There will be several other groups heading out of Loon which will be the slab clean up group led by Andy Plain (Krustkruiser). This group will most likely be split into two and work both sides of the slabs up to the back side of the lake.

Other groups will work from the back side of Loon (meadow area) to Ellis cleaning campsites and such. Each group will have anywhere from 15-30 people.

Spider Lake: Mike Overmeyer and Kevin Carey will be assigning jobs from there Saturday morning.

There will be 2 or 3 turd patrol groups led by Disco, Nasvik, and Kevin. Outhouse repair crews and plenty of trash and campsite crews.

Mike Vincent will lead the Canoe patrol and will need several volunteers for that task.

Buck Island: Look for Troy Muse at the dam Saturday morning to sign up with his group. This group will clean the campsites around Buck Island and work their way to Spider lake.

Organization: This year we’ve made some efforts to help things run a little smoother than in previous years. For starters we will be handing out color coded wrist bands to all volunteers which will match an antenna flag flown by their crew leader. This should assist a great deal with groups starting from Loon.

It is very important that you sign up and get your wrist band if you want to be eligible for the raffle (5pm @ Sluice box). When you sign up you will get a wristband, raffle ticket, dash plaque, and some other goodies.

T-shirts and foamies will be sold at the spillway Friday and Saturday, they will also be sold at Spider Lake. T-shirts $20, and foamies $5 I will also be selling last years clean up shirts as well as Carnage for the con shirts at the spillway for $10.

See you all at the clean up!
$bottom_variable END } # End if else { print<<"END";
$bottom_variable END } # End else } # End PrintFooter #################################################################################### # Subroutine to print an error message if the script dies. # #################################################################################### sub dienice { ($errmsg) = @_; print "Error\n"; print "

Error


\n"; print "$errmsg

\n"; print "\n"; exit; } # End dienice #################################################################################### # Adapted from cgi-lib.pl by S.E.Brenner@bioc.cam.ac.uk # # Copyright 1994 Steven E. Brenner # #################################################################################### sub ReadParse { local (*in) = @_ if @_; local ($i, $key, $val); if ( $ENV{'REQUEST_METHOD'} eq "GET" ) { $in = $ENV{'QUERY_STRING'}; } elsif ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN,$in,$ENV{'CONTENT_LENGTH'}); } else { # Added for command line debugging # Supply name/value form data as a command line argument # Format: name1=value1\&name2=value2\&... # (need to escape & for shell) # Find the first argument that's not a switch (-) $in = ( grep( !/^-/, @ARGV )) [0]; $in =~ s/\\&/&/g; } @in = split(/&/,$in); foreach $i (0 .. $#in) { # Convert plus's to spaces $in[$i] =~ s/\+/ /g; # Split into key and value. ($key, $val) = split(/=/,$in[$i],2); # splits on the first =. # Convert %XX from hex numbers to alphanumeric $key =~ s/%(..)/pack("c",hex($1))/ge; $val =~ s/%(..)/pack("c",hex($1))/ge; # Associate key and value. \0 is the multiple separator $in{$key} .= "\0" if (defined($in{$key})); $in{$key} .= $val; } return length($in); }