#!/usr/bin/perl # # What ANIMAL are You? # # This script asks the user 40 multiple choice questions, then determines # which animal the user will be. # # # VERSION NOTES # # 3/20/2004 # # # &parse_form; # change web form into variables we can use &variables; # assigns variable names to questions $LogFile = "/var/www/vhosts/jokesandhumor.com/httpdocs/tests/animalsuccess.txt"; $mailprog = '/usr/sbin/sendmail'; if ($FORM{'step'} eq "") { print "Content-type: text/html\n\n"; &print_header; print qq~ Error ~; &print_footer; } #end step 1 elsif ($FORM{'step'} eq "1") { print "Content-type: text/html\n\n"; &print_header; print qq~ $heading

Step 1 of 4

What Animal Are You? We will now find out! Simply answer 30 multiple choice questions (it takes most people under 3 minutes) and then you will find out what animal you are!

First, if we could have your first name so we know what to refer you as:

Name:

Your Gender: Male Female

Maybe a bear?

Woof Woof

$bottom ~; #&print_footer; } #end step 1 elsif ($FORM{'step'} eq "2") { print "Content-type: text/html\n\n"; &print_header; print qq~ $heading

Step 2 of 4

Okay, $hisname, we will now ask you some questions to determine which animal you would really be! There will be 30 very quick questions, remember this test will not be accurate unless you answer the questions with 100% honestly! Have fun!

1. How much do you eat a day?
1 or 2 meals, I'm on a diet
Usually 3
At least 3, including a lot of snacks

2. Do you ever watch wrestling on TV?
never
Rarely or Sometimes
Often

3. Which of the following would you rather do:
Golf
Go Bowling
Swim

4. Have you ever been to Europe?
Not yet
Yes, vacation there
I live(d) there

5. Would you consider yourself a "risk-taker"?
Yes, definitely
I can be, once in a while
No, I'm rarely ever a risk-taker

6. Are you good at taking pictures?
Yes, mine turn out well
No, usually blurry or bad
No, I don't even have a camera

7. The longest you've ever gone without taking a bath or shower?
1 day
2-3 days
I've gone more than a week before

8. How many times have you seen the movie, "Tommy Boy"?
More than a few times! Good movie!
Once or twice
Actually, I haven't ever seen it!

9. Which of these 3 Disney movies do you like best?
The Lion King
Beauty and the Beast
Aladdin

10. If you had to eat one of these, it would be:
Sweet and Sour Chicken
Sausage and Pepperoni Pizza
Tacos and Tortilla Chips

Maybe an elephant?

Bird
$bottom ~; } # end step 2 elsif ($FORM{'step'} eq "3") { print "Content-type: text/html\n\n"; &print_header; print qq~ $heading

Step 3 of 4

$hisname, you are almost done! Our computers are hard at work determining which animal you really are. Please continue!

11. Have you ever caught fireflies?
Yes when I was a kid
Yes once in a while when they're out
No, or what's a firefly?

12. Do you know what country the city Venice is in?
France
Italy
Austria

13. What do you think about Britney Spears
She is lame
She is talented
She is pretty

14. How good are you at fishing?
I've never caught a fish
I'm not very good, but have caught fish before
I am pretty good at fishing

15. Would you consider yourself shy or quiet?
Yes, definitely
I can be, once in a while
No, I'm definitely not

16. Are you a good cook?
Yes, my food turns out well
Sometimes yes, othertimes yuck
No way... Let someone else cook!

17. Have you ever gone skinny dipping?
Yes!
Haven't done it yet
What is skinny dipping?

18. In the last 3 months, how many times have you slipped and fallen on your butt?
More than a few times...
Once or twice
Haven't fell recently

19. Are you a fast runner?
Yes, a track star
I can keep up
No, not very fast

20. Have you ever camped overnight in the woods?
Sure, I love camping
Yes once or twice
No camping for me

Maybe a cat?

Frog
$bottom ~; # &print_footer; } # end step 3 elsif ($FORM{'step'} eq "4") { print "Content-type: text/html\n\n"; &print_header; print qq~ $heading

Step 4 of 4

$hisname, here are the FINAL QUESTIONS! After answering these you will then know which animal you really are!

21. Would you eat and swallow a worm on a dare for $100?
Yes, even if not for $100
Yes, but only for the money
No, it would take a lot more than that!

22. Which candy bar would you eat first?
Snickers
Hersheys
Baby Ruth

23. Have you ever been skydiving?
Yes!
No, but would like to
No, too scary

24. Which one word would your friends use to describe you?
Dependable
Funny
Crazy

25. Do you enjoy gambling?
Yes, bring me to Vegas
It's okay in moderation
No, Don't like it or Not old enough

26. Do you chew gum?
Yes, almost always gum in my mouth
Sometimes, maybe after a meal
Not much of a gum chewer

27. What do you think of rap music?
It's pretty cool!
Some of it is okay
You can't have "crap" without rap

28. Which movie would you watch right now if you had to?
Top Gun
Forrest Gump
Finding Nemo

29. Are you afraid of scary bugs and spiders?
Yes, keep them away
I can handle them
No, I gladly pick them up

30. Which sport is the most fun to watch?
Football
Baseball
Gymnastics

Maybe an ostrich?

Duck
$bottom ~; # &print_footer; } # end step 4 elsif ($FORM{'step'} eq "5") { print "Content-type: text/html\n\n"; &print_header; print qq~ $heading

Last Step

$hisname, we have your results. Before we share them with you, you may want to consider joining one of our free fun lists (totally optional):

Email:
Daily Adult Jokes Clean Jokes Word of the Day
Weekly Riddles Weekly Jokes

Maybe an ostrich?

Rat1
$bottom ~; # &print_footer; } # end step 5 elsif ($FORM{'step'} eq "6") { &emailforlists; $totalq = $q1 + $q2 + $q3 + $q4 + $q5 + $q6 + $q7 + $q8 + $q9 + $q10 + $q11 + $q12 + $q13 + $q14 + $q15 + $q16 + $q17 + $q18 + $q19 + $q20 + $q21 + $q22 + $q23 + $q24 + $q25 + $q26 + $q27 + $q28 + $q29 + $q30; $newtotal = $totalq + 2; if ($newtotal >= 0) { $youranimal = "Rabbit"; $animaltext = "The shy rabbit always tries to avoid danger, but can be quick. You are very studious and smart, you may not overpower your foes but you can outwit and outsmart them."; $animalfile = "res-rabbit.jpg"; } if ($newtotal >= 34) { $youranimal = "Humming Bird"; $animaltext = "You are a humming bird! You are very small, the smallest bird of them all, but you are also very quick. You can spot red from miles away and you are generally very well liked."; $animalfile = "res-hummingbird.jpg"; } if ($newtotal >= 40) { $youranimal = "Frog"; $animaltext = "You are a Frog! You are very small, love the water, and like to be kissed! Some may think you do not have outer beauty, only inner beauty. However, the frog is one of the cutest creatures. People are always trying to catch you because you are quite important. You are also the star of a video game called Frogger..."; $animalfile = "res-frog.jpg"; } if ($newtotal >= 46) { $youranimal = "Butterfly"; $animaltext = "You are a Butterfly! You are a rare one indeed! People view butterflies as beautiful and it is usually frowned upon to hurt one. You are caring and carefree. Almost everyone likes a butterfly!"; $animalfile = "res-butterfly.jpg"; } if ($newtotal >= 52) { $youranimal = "Caterpillar"; $animaltext = "You are a Catterpillar! Many people are often envious and jealous of a caterpillar. Caterpillars may not be quick, but they are quite wise and often think about things before they do them.!"; $animalfile = "res-caterpillar.jpg"; } if ($newtotal >= 57) { $youranimal = "Unicorn"; $animaltext = "You are a Unicorn! Some people think unicorns are a myth... You are one of the most rare animals. Less than 2 percent of people that take this test are the unicorn. Unicorns are good an almost everything they do, and are very well liked!"; $animalfile = "res-unicorn.jpg"; } if ($newtotal >= 62) { $youranimal = "Bumble Bee"; $animaltext = "You are a Bumble Bee! A beautiful insect that is good at working with teams and produces something many want: honey! A bumble bee commands great respect, and will respond to a bad situation with a quick sting! Bumble bees are serious and very wise."; $animalfile = "res-bee.jpg"; } if ($newtotal >= 68) { $youranimal = "Whitetail Deer"; $animaltext = "You are a Whitetail Deer! Whitetail deer are beautiful and plentiful. They are usually quiet and do not bother people. They are playful yet cautious. Many respect the deer. Deer are usually underestimated..."; $animalfile = "res-deer.jpg"; } if ($newtotal >= 74) { $youranimal = "Tiger"; $animaltext = "You are a Tiger! Watch out! Tigers are not to be messed with. A Tiger will usually seek out what they want instead of waiting for things to just happen. Tigers command great respect. Tigers are also very alert and can be very friendly if approached correctly..."; $animalfile = "res-tiger.jpg"; } if ($newtotal >= 79) { $youranimal = "Dolphin"; $animaltext = "You are a Dolphin! The dolphin is the smartest animal and this is reflected in you. Dolphins also have excellent communications skills and are usually regarded very highly by their friends. Dolphins are playful and fun, and usually learn quickly from any mistakes made..."; $animalfile = "res-dolphin.jpg"; } if ($newtotal >= 85) { $youranimal = "Grizzly Bear"; $animaltext = "You are a Grizzly Bear! The Grizzly is a very feared animal, but also very respectable. The Grizzly Bear knows how to please, but also how to have fun. Grizzly Bears can be lazy, and like to sleep in. When it is crunch time though, the Grizzly Bear always comes through!"; $animalfile = "res-grizzlybear.jpg"; } print "Content-type: text/html\n\n"; &print_header; print qq~ $heading

Results for $hisname

Your Animal is: $youranimal

$animaltext
You are a $youranimal

Thanks for taking the test! Would you like to SEND THIS PAGE TO A FRIEND?

Also feel free to check out some more Fun Pages:

Britney Spears NEW Boyfriend
GHETTO Voters
Tom Cruise BREAKUP
McDonalds Fat and Grease
Paris Hilton GAME
Job that SUCKS


SEND this to a FRIEND!

©   1998-2004 JokesAndHumor.com. All rights reserved.
  Contact Us: Here
View our online privacy statement.

~; # # LOGS and COUNTERS # # &get_date; open (COUNT,">>$LogFile"); print COUNT "$date2|$hisname|$email|$gender|$youranimal|$newtotal|$q1|$q2|$q3|$q4|$q5|$q6|$q7|$q8|$q9|$q10|$q11|$q12|$q13|$q14|$q15|$q16|$q17|$q18|$q19|$q20|$q21|$q22|$q23|$q24|$q25|$q26|$q27|$q28|$q29|$q30\n"; close (COUNT); # # # START COUNTER STUFF # $data_dir = "/var/www/vhosts/jokesandhumor.com/httpdocs/tests/"; $auto_create = "1"; $lock_sec = "3"; # Print Content Type Header For Browser #### print "Content-type: text/html\n\n"; # Get the page location from the DOCUMENT_URI environment variable. #$count_page = "$ENV{'DOCUMENT_URI'}"; $count_page = "ANIMAL.txt"; # Any characters that are not letters or numbers are turned into an underscore # $count_page =~ s/[^\w]/_/g; $lock_file = "$count_page\.lock"; # Check to see if file is locked by program already in use. &check_lock($lock_sec); # If the file exists, get the date and count out of it. Otherwise, if # auto_create is allowed, create a new account. If neither of these are # true, return an error. if (-e "$data_dir$count_page") { open(COUNT,"$data_dir$count_page"); $line = ; chop($line) if $line =~ /\n$/; close(COUNT); ($date,$count) = split(/\|\|/,$line); } elsif ($auto_create == 1) { &create; } else { &error('page_not_found'); } # Increment Count. $count++; $print_count = $count; # Get Count Length for use in padding. $count_length = length($count); # Print the Count, Link and Date depending on what user has specified # they wish to print. #if ($show_date == 1) { # if ($show_link =~ /http:\/\//) { # #} #else { # print "$print_count hits since $date"; #} #} #else { # if ($show_link =~ /http:\/\//) { # print "$print_count"; #} #else { # print "$print_count"; #} #} # Open the count file and write the new count that has been incremented. open(COUNT,">$data_dir$count_page") || &error('could_not_increment'); print COUNT "$date\|\|$count"; close(COUNT); # Remove Lock File for next time script is run on that HTML page. &clean_up; sub create { ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); @months = ("January","February","March","April","May","June","July", "August","September","October","November","December"); $year += 1900; $date = "$months[$mon] $mday, $year"; $count = "0"; open(COUNT,">$data_dir$count_page") || &error('count_not_created'); print COUNT "$date\|\|$count"; close(COUNT); } sub error { $error = shift(@_); if ($error eq 'page_not_found') { print "[TextCounter Fatal Error: This Page Not Found\; Auto-Create Option Disabled]"; } elsif ($error eq 'bad_uri') { print "[TextCounter Fatal Error: This Page Not In Valid URI]"; } elsif ($error eq 'count_not_created') { print "[TextCounter Fatal Error: Could Not Write to File $datadir$count_page]"; } elsif ($error eq 'could_not_increment') { print "[TextCounter Fatal Error: Could Not Increment Counter]"; } exit; } sub check_lock { $time = $_[0]; for ($i = 1;$i <= $time; $i++) { if (-e "$data_dir$lock_file") { sleep 1; } else { open(LOCK,">$data_dir$lock_file"); print LOCK "0"; close(LOCK); last; } } } sub clean_up { unlink("$data_dir$lock_file"); } # # END COUNTER STUFF # } # end step 6, the results step # # # VARIABLES, Etc # sub variables { if ($FORM{'hisname'}) { $hisname = "$FORM{'hisname'}"; $hisname =~ s/"//g; $hisname =~ s///g; $hisname =~ s/\&//g; } if ($FORM{'age'}) { $age = "$FORM{'age'}"; } if ($FORM{'email'}) { $email = "$FORM{'email'}"; } if ($FORM{'gender'}) { $gender = "$FORM{'gender'}"; } if ($FORM{'celebgender'}) { $celebgender = "$FORM{'celebgender'}"; } if ($FORM{'location'}) { $location = "$FORM{'location'}"; } if ($FORM{'q1'}) { $q1= "$FORM{'q1'}"; } if ($FORM{'q2'}) { $q2= "$FORM{'q2'}"; } if ($FORM{'q3'}) { $q3= "$FORM{'q3'}"; } if ($FORM{'q4'}) { $q4= "$FORM{'q4'}"; } if ($FORM{'q5'}) { $q5= "$FORM{'q5'}"; } if ($FORM{'q6'}) { $q6= "$FORM{'q6'}"; } if ($FORM{'q7'}) { $q7= "$FORM{'q7'}"; } if ($FORM{'q8'}) { $q8= "$FORM{'q8'}"; } if ($FORM{'q9'}) { $q9= "$FORM{'q9'}"; } if ($FORM{'q10'}) { $q10= "$FORM{'q10'}"; } if ($FORM{'q11'}) { $q11= "$FORM{'q11'}"; } if ($FORM{'q12'}) { $q12= "$FORM{'q12'}"; } if ($FORM{'q13'}) { $q13= "$FORM{'q13'}"; } if ($FORM{'q14'}) { $q14= "$FORM{'q14'}"; } if ($FORM{'q15'}) { $q15= "$FORM{'q15'}"; } if ($FORM{'q16'}) { $q16= "$FORM{'q16'}"; } if ($FORM{'q17'}) { $q17= "$FORM{'q17'}"; } if ($FORM{'q18'}) { $q18= "$FORM{'q18'}"; } if ($FORM{'q19'}) { $q19= "$FORM{'q19'}"; } if ($FORM{'q20'}) { $q20= "$FORM{'q20'}"; } if ($FORM{'q30'}) { $q30= "$FORM{'q30'}"; } if ($FORM{'q21'}) { $q21= "$FORM{'q21'}"; } if ($FORM{'q22'}) { $q22= "$FORM{'q22'}"; } if ($FORM{'q23'}) { $q23= "$FORM{'q23'}"; } if ($FORM{'q24'}) { $q24= "$FORM{'q24'}"; } if ($FORM{'q25'}) { $q25= "$FORM{'q25'}"; } if ($FORM{'q26'}) { $q26= "$FORM{'q26'}"; } if ($FORM{'q27'}) { $q27= "$FORM{'q27'}"; } if ($FORM{'q28'}) { $q28= "$FORM{'q28'}"; } if ($FORM{'q29'}) { $q29= "$FORM{'q29'}"; } if ($FORM{'recipient'}) { $recipient= "$FORM{'recipient'}"; } if ($FORM{'recipient2'}) { $recipient2= "$FORM{'recipient2'}"; } if ($FORM{'recipient3'}) { $recipient3= "$FORM{'recipient3'}"; } if ($FORM{'recipient4'}) { $recipient4= "$FORM{'recipient4'}"; } if ($FORM{'recipient5'}) { $recipient5= "$FORM{'recipient5'}"; } if ($FORM{'recipient6'}) { $recipient6= "$FORM{'recipient6'}"; } if ($FORM{'recipient7'}) { $recipient7= "$FORM{'recipient7'}"; } if ($FORM{'recipient8'}) { $recipient8= "$FORM{'recipient8'}"; } } # end sub variables sub parse_form { local($name,$value); # Get the input read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # Split the name-value pairs @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); # Un-Webify plus signs and %-encoding $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; # Remove any NULL characters, Server Side Includes $value =~ s/\0//g; $value =~ s///g; if ($allow_html != 1) { $value =~ s/<([^>]|\n)*>//g; } else { unless ($name eq 'body') { $value =~ s/<([^>]|\n)*>//g; } } $FORM{$name} = $value; } } sub print_header { open (HEAD, ") { $heading .= $_; } close HEAD; open (SIDE, ") { $sidebar .= $_; } close SIDE; open (BOTTOM, ") { $bottom .= $_; } close BOTTOM; print qq~ ~; # end of print header } #end of sub print_header sub print_footer { print qq~

$bottom ~; } #end of sub print_footer sub emailforlists { if ($recipient) { open(MAIL,"|$mailprog -t"); print MAIL "To: join-jokesandhumor\@list.netatlantic.com\n"; print MAIL "From: $email ($hisname)\n"; # Check for Message Subject print MAIL "Subject: SUBSCRIBE\n\n"; print MAIL "Subscribe Me\n"; print MAIL "($email) on $date\n"; print MAIL "-" x 75 . "\n\n"; } # end recipient if ($recipient2) { open(MAIL,"|$mailprog -t"); print MAIL "To: jokesandhumorweekly-subscribe\@topica.com\n"; print MAIL "From: $email ($hisname)\n"; # Check for Message Subject print MAIL "Subject: SUBSCRIBE\n\n"; print MAIL "Subscribe Me\n"; print MAIL "($email) on $date\n"; print MAIL "-" x 75 . "\n\n"; } # end recipient if ($recipient3) { open(MAIL,"|$mailprog -t"); print MAIL "To: hotbabedaily-subscribe\@topica.com\n"; print MAIL "From: $email ($hisname)\n"; # Check for Message Subject print MAIL "Subject: SUBSCRIBE\n\n"; print MAIL "Subscribe Me\n"; print MAIL "($email) on $date\n"; print MAIL "-" x 75 . "\n\n"; } # end recipient if ($recipient4) { open(MAIL,"|$mailprog -t"); print MAIL "To: riddlesjh-subscribe\@topica.com\n"; print MAIL "From: $email ($hisname)\n"; # Check for Message Subject print MAIL "Subject: SUBSCRIBE\n\n"; print MAIL "Subscribe Me\n"; print MAIL "($email) on $date\n"; print MAIL "-" x 75 . "\n\n"; } # end recipient if ($recipient5) { open(MAIL,"|$mailprog -t"); print MAIL "To: jokesandhumorclean-subscribe\@topica.com\n"; print MAIL "From: $email ($hisname)\n"; # Check for Message Subject print MAIL "Subject: SUBSCRIBE\n\n"; print MAIL "Subscribe Me\n"; print MAIL "($email) on $date\n"; print MAIL "-" x 75 . "\n\n"; } # end recipient if ($recipient6) { open(MAIL,"|$mailprog -t"); print MAIL "To: wordofthedayjh-subscribe\@topica.com\n"; print MAIL "From: $email ($hisname)\n"; # Check for Message Subject print MAIL "Subject: SUBSCRIBE\n\n"; print MAIL "Subscribe Me\n"; print MAIL "($email) on $date\n"; print MAIL "-" x 75 . "\n\n"; } # end recipient if ($recipient7) { open(MAIL,"|$mailprog -t"); print MAIL "To: drinksjh-subscribe\@topica.com\n"; print MAIL "From: $email ($hisname)\n"; # Check for Message Subject print MAIL "Subject: SUBSCRIBE\n\n"; print MAIL "Subscribe Me\n"; print MAIL "($email) on $date\n"; print MAIL "-" x 75 . "\n\n"; } # end recipient if ($recipient8) { open(MAIL,"|$mailprog -t"); print MAIL "To: freebiesjh-subscribe\@topica.com\n"; print MAIL "From: $email ($hisname)\n"; # Check for Message Subject print MAIL "Subject: SUBSCRIBE\n\n"; print MAIL "Subscribe Me\n"; print MAIL "($email) on $date\n"; print MAIL "-" x 75 . "\n\n"; } # end recipient } # end subroutine sub get_date { # Define arrays for the day of the week and month of the year. # @days = ('Sunday','Monday','Tuesday','Wednesday', 'Thursday','Friday','Saturday'); @months = ('January','February','March','April','May','June','July', 'August','September','October','November','December'); # Get the current time and format the hour, minutes and seconds. Add # # 1900 to the year to get the full 4 digit year. # ($sec,$min,$hour,$mday,$mon,$year,$wday) = (localtime(time))[0,1,2,3,4,5,6]; $time = sprintf("%02d:%02d:%02d",$hour,$min,$sec); $year += 1900; $mon2 = $mon + 1; # Format the date. # $date = "$days[$wday], $months[$mon] $mday, $year at $time"; $date2 = "$mon2/$mday/$year"; }