#!/usr/bin/perl #################################### # gnu-web-tarot # # Michael Tracey # #################################### # # zoom.pl, gives card analysis # require "config.pl"; my($x,$line,@text); my (%params); my ($buffer)= $ENV{'QUERY_STRING'}; my (@pairs)= split(/&/, $buffer); my ($name,$value); foreach (@pairs){ s/\+/ /g; ($name, $value) = split(/=/,$_); ($name, $value) = split(/=/,$_); $name =~ s/%(..)/pack("c",hex($1))/ge; $value =~ s/%(..)/pack("c",hex($1))/ge; $params{$name} = $value; } print "Content-Type: text/html\n\n"; print "

Print Your Reading

"; for ($x=1;$x <= 10; $x++){ if ($params{"$x"}) { &print_card("$x"); } else { &no_card("$x"); } } sub print_card { my($x) = @_; print "\n"; print "\t\n"; open (GRABTEXT, "$data_path/t$params{$x}.txt") || die "Unable to open text file $data_path/t$params{$x}.txt, $!"; @text = ; close GRABTEXT; print "\t\n\t"; print "
\n"; print "\t
\n"; print "\t$x - "; print $meanings[($x-1)]; print "\n"; print "\t
"; $text[0] = "$text[0]"; # bold the first line foreach $line (@text){ chomp $line; if ($line eq "") { $line = "

"; }; print $line; } print "


"; } sub no_card { my($x) =@_; my($y); print "\n"; print "\t\n\t"; print "
\n"; print "\t
\n"; print "\t$x -"; print $meanings[($x -1)]; print "\n"; print "\t
"; print "\t
"; for ($y=1;$y <= 10; $y++){ if ($params{"$y"}){ print "\t\n"; } } print "No card chosen for this position
"; print ""; print "

"; }