#!/usr/bin/perl # fill in amount with needed # really need the fully/partially deal? # make database-ready and invoice ready output use Mysql; unshift(@INC,"/usr/local/etc/httpd/sites/virtualfoundation.org/admin"); require('cgisettings.pl'); $email_donation_msg_to = ("webmaster\@ecologia.org", "ecologia\@igc.apc.org" ); # connect to the DB -- we'll need this no matter what $dbh = Mysql->connect(undef, "foundation", "vf", "virtualfoundation"); #debug $process_delay = "1"; #debug # check for id to process, and process it (spooled at job) if ($ARGV[0] =~ /^\d{10}$/) { &process_donation($ARGV[0]); exit; } &parse_input; &tweak_input(%stdin); if (!$stdin{'step'}) { if ($argv{'project_id'} =~ /^.{10}$/) { &get_project_info($argv{'project_id'}); } elsif ($ENV{'HTTP_REFERER'} =~ m#/proposals/(.{10})\.(html|cgi)#) { &get_project_info($1); } unless ($stdin{'project_name'}) { $stdin{'project_name'} = "Project Name"; } &first_page; &project_stuff; &first_pageb; } elsif ($stdin{'step'} eq "2") { &assign_id; &record_info; if ( ($stdin{'how'} eq "fully" || $stdin{'how'} eq "partially") && ( !$stdin{'project_name'} || $stdin{'project_name'} eq "Project Name" ) ) { &error_page("need_project_name"); exit; } if ( !$stdin{'amount'} || $stdin{'amount'} !~ /^\d+$/ ) { &error_page("need_amount"); exit; } &second_page; } elsif ($stdin{'step'} eq "3") { #$time = `date +%y%m%d%H%M`; chop($time); #if ( $time > ( $stdin{'id'} + $process_delay ) ) { # &assign_id; # &fork_processor; #} &fork_processor; &record_info; &fix_amount; if ( !$stdin{'name'} ) { &error_page("need_name"); exit; } unless ($stdin{'phone'} || $stdin{'email'} || $stdin{'address'}) { &error_page("need_contact"); exit; } if ( $stdin{'email'} && $stdin{'email'} !~ /.+\@.+/ ) { &error_page("invalid_email"); exit; } if ( $stdin{'phone'} ) { if ( $stdin{'phone'} =~ /(\d{3}).*(\d{3}).*(\d{4})/ ) { $stdin{'phone'} = "($1) $2-$3"; } else { &error_page("invalid_phone"); exit; } } &third_page; } exit; sub assign_id { $stdin{'id'} = `date +%y%m%d%H%M`; chop($stdin{'id'}); } sub get_project_info { local($project_id = $_[0],%hash); #so we don't drag that around # if ( $project_id =~ /^.{10}$/ ) { # connect to the DB $dbh = Mysql->connect(undef, $database_name, "vf", "virtualfoundation"); unless ($sth_select = $dbh->query("SELECT * FROM main WHERE id = '$project_id'") ) { print "Select query failed."; die "Select query failed.

"; } %hash = $sth_select->fetchhash; $stdin{'project_name'} = $hash{'title'}; $stdin{'amount'} = $hash{'budget'} - $hash{'collected'}; # } } ###################### ### Page Functions ### ###################### # # sub first_page { print < Virtual Foundation Donation

The Virtual Foundation - your donation makes it happen


Donating to the Virtual Foundation

Please complete the form and then click "Proceed to the Next Page".

I would like to:
Fully fund this project:

Partially fund this project:

EOF } sub first_pageb{ print <
Give to the Projects Fund:
we direct your contribution to the projects with the greatest need
Give to the Development Fund:
this supports operational needs of the Virtual Foundation

Amount: \$.00    
Method: I would like to make an encrypted credit card donation through a secure server
Please bill me
I will send a check


If you have any trouble with this form or would feel more comfortable speaking to someone, please don't hesitate to call us at (888)801-7101.
EOF } sub project_stuff{ print < EOF &gen_project("","Please Choose a Project"); &gen_project("Albanian Biologists Mending the Past, Training for the Future","Albanian Biologists Mending the Past, Training for the Future"); &gen_project("All Aboard! Children and Books To Ride Train To Uzbek Environmental Library","All Aboard! Children and Books To Ride Train To Uzbek Environmental Library"); &gen_project("Asian Russia Journal","Asian Russia Journal"); &gen_project("Beijing Students Monitor Water Supply","Beijing Students Monitor Water Supply"); &gen_project("Biodiversity: Creation of a National Park in Tajikistan","Biodiversity: Creation of a National Park in Tajikistan"); &gen_project("Biosphere to Cleanup Water in Tajikistan","Biosphere to Cleanup Water in Tajikistan"); &gen_project("Brontosaurus to Bring Sheep to Carpathian Mountain Meadows","Brontosaurus to Bring Sheep to Carpathian Mountain Meadows"); &gen_project("Campaign Against Rostov Nuclear Power Plant","Campaign Against Rostov Nuclear Power Plant"); &gen_project("Chinese American Friendship Forest","Chinese American Friendship Forest"); &gen_project("Chinese Women Link their Environmental Initiatives","Chinese Women Link their Environmental Initiatives"); &gen_project("Clarifying the Green Message:Finding Common Ground Among Ourselves and With the Public","Clarifying the Green Message:Finding Common Ground Among Ourselves and With the Public"); &gen_project("Cleaning a Small Lake Will Make a Big Difference in Lithuania","Cleaning a Small Lake Will Make a Big Difference in Lithuania"); &gen_project("Clean Rivers, Clean Soul","Clean Rivers, Clean Soul"); &gen_project("Computer Assistance for Environmental Youth Organization in Central Asia","Computer Assistance for Environmental Youth Organization in Central Asia"); &gen_project("Connect Russian Activist Fighting Toxic Pollution to A Support Network","Connect Russian Activist Fighting Toxic Pollution to A Support Network"); &gen_project("Conservation of Five Rare and Endangered Plants in Georgia","Conservation of Five Rare and Endangered Plants in Georgia"); &gen_project("Creation of an Environmental Education Center","Creation of an Environmental Education Center"); &gen_project("Czech and Greek Naturalists to Open Museum","Czech and Greek Naturalists to Open Museum"); &gen_project("Czech Students To Use Film To Teach Other Students About the Environment","Czech Students To Use Film To Teach Other Students About the Environment"); &gen_project("Demonstration of Sustainable Development in Rural Hungary","Demonstration of Sustainable Development in Rural Hungary"); &gen_project("Developing and Marketing Organic Agriculture in Eastern Slovakia","Developing and Marketing Organic Agriculture in Eastern Slovakia"); &gen_project("Development of Rainbow Keepers Newspaper","Development of Rainbow Keepers Newspaper"); &gen_project("Domesticated Animals: Neglected Victims in Transition Economies","Domesticated Animals: Neglected Victims in Transition Economies"); &gen_project("Ecology through Television","Ecology through Television"); &gen_project("Eco-Minded Youth to Clean Up Beach in Kazakstan","Eco-Minded Youth to Clean Up Beach in Kazakstan"); &gen_project("Ecoschool 'Ant Hill'","Ecoschool 'Ant Hill'"); &gen_project("Education for Life: Help Others Manage Diabetes","Education for Life: Help Others Manage Diabetes"); &gen_project("E-mail Computer for the Kvant School Club","Email Computer for the Kvant School Club"); &gen_project("E-mail to Link Environmental Education Center to Regional and International Partners","E-mail to Link Environmental Education Center to Regional and International Partners"); &gen_project("E-mail Supports Mapping Of Russian Far East Wildlife Preserve","E-Mail Supports Mapping Of Russian Far East Wildlife Preserve"); &gen_project("Empowering Ukrainian Greens With A Computer","Empowering Ukrainian Greens With A Computer"); &gen_project("Environmental Notebook of the Novinsk Scientific Center","Environmental Notebook of the Novinsk Scientific Center"); &gen_project("Extinct Species Memorial in China","Extinct Species Memorial in China"); &gen_project("Finding the Forest Among The Trees in Hungary","Finding the Forest Among The Trees in Hungary"); &gen_project("Frigate Preserving Ecological Heritage on Russian Island","Frigate Preserving Ecological Heritage on Russian Island"); &gen_project("Georgians Preserving the Natural and Cultural Heritage of Mt.Mkinvartsveri","Georgians Preserving the Natural and Cultural Heritage of Mt. Mkinvartsveri") &gen_project("Help for Hungarian Environmental Youth Group in Zemplen Mountains","Help for Hungarian Environmental Youth Group in Zemplen Mountains"); &gen_project("Helping Roma Families in Slovak Village to Start Cottage Industries","Helping Roma Families in Slovak Village to Start Cottage Industries"); &gen_project("Herb Gardening as a Substitute for Gathering Endangered Plants in Russia","Herb Gardening as a Substitute for Gathering Endangered Plants in Russia"); &gen_project("Home for Stray Animals in Hungary","Home for Stray Animals in Hungary"); &gen_project("Houses Built of Stray","Houses Built of Straw"); &gen_project("Involving Teens in Local Environmentalism","Involving Teens in Local Environmentalism"); &gen_project("Let the Voices of Greens In Central Siberia Be Heard","Let the Voices of Greens In Central Siberia Be Heard"); &gen_project("Let's save the Pine Forest","Let's save the Pine Forest"); &gen_project("Magnolia, Fish Owl and Japanese Crane To Benefit from Email","Magnolia, Fish Owl and Japanese Crane To Benefit from Email"); &gen_project("Mapping Nuclear and Industrial Pollution in Kazakstan","Mapping Nuclear and Industrial Pollution in Kazakstan"); &gen_project("Monitoring of Anthropogenic Effect on Wilderness with the Help of a Network of Hunter-Correspondents","Monitoring of Anthropogenic Effect on Wilderness with the Help of a Network of Hunter-Correspondents"); &gen_project("Newsletter to Network Energy Activists in Slovakia","Newsletter to Network Energy Activists in Slovakia"); &gen_project("Ornithological Group Seeks Computer For Efforts to Protect Rare Species","Ornithological Group Seeks Computer For Efforts to Protect Rare Species"); &gen_project("People to People Diplomacy Seeks to Mend Shattered Relations With China","People to People Diplomacy Seeks to Med Shattered Relations With China"); &gen_project("Preserving History and Nature's Beauty","Preserving History and Nature's Beauty"); &gen_project("Project: Our Children","Project: Our Children"); &gen_project("Promoting Alternative Energy to Prevent Deforestation in Tajikistan","Promoting Alternative Energy to Prevent Deforestation in Tajikistan"); &gen_project("Promoting Ecotourism in the Tien Shan Mountains of Uzbekistan","Promoting Ecotourism in the Tien Shan Mountains of Uzbekistan"); &gen_project("Protecting the White Stork in The Czech Republic","Protecting the White Stork in The Czech Republic"); &gen_project("Providing Information for Visitors to Beijing's Bird Garden","Providing Information for Visitors to Beijing's Bird Garden"); &gen_project("Publication of Taiga Lives Forever To Support Forest Preserve Effort","Publication of Taiga Lives Forever To Support Forest Preserve Effort"); &gen_project("'Ringed Seal': An Environmental Film for Russian Children","'Ringed Seal': An Environmental Film for Russian Children"); &gen_project("Save the Czech Republic's Threatened Forests","Save the Czech Republic's Threatened Forests"); &gen_project("Save the Green Treasure","Save the Green Treasure"); &gen_project("Seeking Books, Not Money, for Library in Kazakstan","Seeking Books, Not Money, for Library in Kazakstan"); &gen_project("Sharing the Water, We Will Survive Together","Sharing the Water, We Will Survive Together"); &gen_project("Students Monitor Air in Beijing","Students Monitor Air in Beijing"); &gen_project("Students Patrol and Protect National Park in Romania","Students Patrol and Protect National Park in Romania"); &gen_project("Students Preserve Russia's Nature Reserves","Students Preserve Russia's Nature Reserves"); &gen_project("Students Prevent Poaching of Endangered Plants","Students Prevent Poaching of Endangered Plants"); &gen_project("Support The Verkhnii Pereval Environmental Museum and Education Center In Russia's Far East","Support The Verkhnii Pereval Environmental Museum and Education Center In Russia's Far East"); &gen_project("Survey of the Oka Valley","Survey of the Oka Valley"); &gen_project("Sustainable Living Weekend Workshops","Sustainable Living Weekend Workshops"); &gen_project("Teaching Biointensive Mini-Farming in Russia","Teaching Biointensive Mini-Farming in Russia"); &gen_project("Tree Farming by Youth Rescues Forests in Russia's North","Tree Farming by Youth Rescues Forests in Russia's North"); &gen_project("Thanka Painting School Supports Community in Nepal","Thanka Painting School Supports Community in Nepal"); &gen_project("Translation of A Sand County Almanac","Translation of A Sand County Almanac"); &gen_project("Tree Planting in Tbilisi, Georgia: Ecological and Social Renewal","Tree Planting in Tbilisi, Georgia: Ecological and Social Renewal"); &gen_project("Trees for Life - Grow a Tree (second year)","Trees for Life - Grow a Tree (second year)"); &gen_project("Using the Mass Media to Help Clean Osh City","Using the Mass Media to Help Clean Osh City"); &gen_project("The Virtual Foundation Heals Rift With China After Belgrade Bombing","The Virtual Foundation Heals Rift With China After Belgrade Bombing"); &gen_project("The White Seacoast, View from the Sea","The White Seacoast, View from the Sea"); &gen_project("WHOOOOO will Protect Europe's Endangered Barn Owl?","WHOOOOO will Protect Europe's Endangered Barn Owl?"); &gen_project("Windows on Nature","Windows on Nature"); &gen_project("'Young Leopards' Provide Hope for Life Near a Vanishing Sea","'Young Leopards' Provide Hope for Life Near a Vanishing Sea"); print "\n"; } sub gen_project { local($tmp); $tmp = "