#!/usr/bin/perl use DBI; require "table.pl"; $dbh = DBI->connect( $database, $dbuser, $dbpass ); $column1 = ""; $cnt = 0; $sponsored = 0; #@clauses = ("grade='?' OR grade='' ORDER BY childName", "grade='PK' ORDER BY childName", "grade='K' ORDER BY childName", "grade >= 1 ORDER BY grade,childName"); #"grade='PK' ORDER BY childName" #"grade='?' OR grade='' ORDER BY childName" $cursor = $dbh->prepare( "SELECT * FROM $table ORDER BY age*1" ); $cursor->execute; while ( @field = $cursor->fetchrow ) { if ( $field[$sponsoridx] == 1 ) { $row = qq | $field[$nameidx]
$field[$gradeidx]
$field[$ageidx]
$field[$genderidx]
$field[$jobidx]
$field[$favecoloridx]
$field[$favebookidx]
$field[$funidx]
|; $sponsored++; } else { $row = qq | $field[$nameidx]
$field[$gradeidx]
$field[$ageidx]
$field[$genderidx]
$field[$jobidx]
$field[$favecoloridx]
$field[$favebookidx]
$field[$funidx]
|; } $column1 .= $row; $cnt++; } $cursor->finish; $dbh->disconnect; $remaining = $cnt - $sponsored; $out = qq | $column1
First Name Grade Age Gender When I Grow Up I Want to Be... Favorite Color Favorite Book For Fun I...
|; open( PIPE, "/bin/date +%j |" ); while ( ) { chomp; $doy = int( $_ ); } close( PIPE ); $daysleft = $deadline - $doy; if ( $daysleft < 0 ) { $daysleft = 0; } if ( $daysleft == 1 ) { $phrase = "ONE DAY"; } else { $phrase = "$daysleft days"; } print qq |Content-type: text/html Thank you for your interest in sponsoring a student this holiday season! There are $remaining children who are not yet sponsored. To sponsor a student, simply click on the student's name, complete the sponsorship form, and purchase gifts from their wish list. Our goal is to provide at least three gifts per child. Previously sponsored children will be shaded out on the list. If you need additional gift ideas, click here for a list of recommended books by grade level, and help support the schools' emphasis on increasing reading proficiency.

Unwrapped gifts will be accepted through $deadlineText by the Little Match Girl Foundation, Monday through Friday between 9am and 5pm, at the offices of Gerber Ciano (70 Niagara Street, Suite 211, Buffalo, NY 14202). Volunteers from the Little Match Girl Foundation will then wrap the gifts and ensure their delivery to the students in time for Christmas.

Donations of wrapping paper, tape, and bows also are welcome!

We have $phrase left in the $year Buffalo Christmas Wishes drive.

$out |; sub parse_form_data { local( *FORM_DATA ) = @_; local( $request_method, $query_string, @key_value_pairs, $key_value, $key, $value ); $request_method = $ENV{'REQUEST_METHOD'}; if ( $request_method eq "GET" ) { $query_string = $ENV{'QUERY_STRING'}; } elsif ( $request_method eq "POST" ) { read( STDIN, $query_string, $ENV{'CONTENT_LENGTH'} ); } else { &return_error( 500, "Server Error", "Server uses unsupported method" ); } @key_value_pairs = split( /&/, $query_string ); foreach $key_value ( @key_value_pairs ) { ( $key, $value ) = split( /=/, $key_value ); $value =~ tr/+/ /; $value =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack ("C", hex ($1))/eg; if ( defined($FORM_DATA{$key}) ) { $FORM_DATA{$key} = join( ", ", $FORM_DATA{$key}, $value ); } else { $FORM_DATA{$key} = $value; } } } sub return_error { local( $status, $keyword, $message ) = @_; print "Content-type: text/html", "\n"; print "Status: ", $status, " ", $keyword, "\n\n"; print <CGI Program - Unexpected Error

$keyword


$message Please contact $webmaster for more information. End_of_Error exit( 1 ); } sub hexit { local( $string ) = @_; $string =~ s/\W/'%' . unpack( "H2", $& )/eg; return( $string ); }