#!/usr/bin/perl -w $page_template = "daily-word-search-template.htm"; $puzzle_dir = "../daily-word-search/puzzles/"; $codebase = "/daily-word-search/"; @months = qw( January February March April May June July August September October November December ); @days = qw( Sunday Monday Tuesday Wednesday Thursday Friday Saturday ); ############################################################## push (@INC, '/cgi-bin'); use CGI $co = new CGI; print $co->header; ($mday,$mon,$year) = (localtime())[3,4,5]; $mon++; $year = $year + 1900; if ($mday < 10) { $day = "0$mday"; } else { $day = "$mday"; } if ($mon < 10) { $month = "0$mon"; } else { $month = "$mon"; } $puzz = $co->param('puzz'); if ($puzz eq "") { $puzz = "ws1-${year}-${month}-${day}"; } $puzzd = substr($puzz,4,7); $puzzfile1 = "${puzzle_dir}${puzzd}/${puzz}.txt"; $puzzfile2 = "${puzzle_dir}${puzzd}/${puzz}.htm"; $puzzyear = substr($puzz,4,4); $puzzmonth = $months[0 + substr($puzz,9,2) - 1]; $puzzday = substr($puzz,12,2); if ($puzzday lt "10") { $puzzday = substr($puzz,13,1); } $puzzdate = "${puzzmonth} ${puzzday}, ${puzzyear}"; open(HTML, $page_template); @buffer = ; close HTML; $buffer = join('',@buffer); # Adds in the includes while($buffer =~ m//g) { open(HTML, "/home/vhosts/thinks.com/docs${1}"); @data = ; close HTML; $data = join('',@data); $buffer =~ s/$&/$data/g; } ($part1,$part2) = split ('', $buffer); open (PUZZ, $puzzfile1); $title = readline(*PUZZ); $desc = readline(*PUZZ); $list = readline(*PUZZ); close PUZZ; chomp $title; chomp $desc; chomp $list; print $part1, "

${title}


", "

Word Search Puzzle for ${puzzdate}



"; if ($desc ne "") { print $desc, "

"; } print "", ""; print "

", "
", "Printable version", "Previous daily puzzles
Word Search Wizardry - more Word Search puzzles!", "
"; print $part2; exit;