Home >>
#!/usr/bin/perl use DBI; $dbh = DBI->connect("DBI:mysql:author_sf2aboard:localhost","author_sf2aboard","brookwood"); #Make sure the path to perl is correct and that it is the very #first line in the script. # Place into the public domain by Bruce Gronich (BigNoseBird.Com) # on an AS IS basis for educational purposes. It comes with NO # guarantees or warranties of any type- including those of missed # appointments! #THINGS YOU CAN CHANGE ############################################# $run_as= "CGI"; #If you must use CGI, REMOVE THE '#' at #at the start of the $run_as line $cal_prog= "/usr/bin/cal"; #where your cal program is #usually /bin/cal or /usr/bin/cal $in_color= "#003366"; #Inside Table Color $out_color= "#FFFFFF"; #Outside Table Color $day_color= "#FF0000"; #The current date color $title_color="#BBBBBB"; #The heading line color $heading= "SF2A Events"; #The heading line #################################################################### #This part takes care of figuring out what today is $date=localtime(time); ($day, $month, $num, $time, $year) = split(/\s+/,$date); ($hour, $min, $sec)=split(/:/,$time); if ($hour > 12) {$hour-=12;$am="pm"} else {$am="am"}; #Pad the current day number with a leading space if needed if (length($num)<2){$num=" $num"}; #From the character month, get the number because the unix #cal program needs a month number, not a name! if ($month eq "Jan") {$mo_num=1}; if ($month eq "Feb") {$mo_num=2}; if ($month eq "Mar") {$mo_num=3}; if ($month eq "Apr") {$mo_num=4}; if ($month eq "May") {$mo_num=5}; if ($month eq "Jun") {$mo_num=6}; if ($month eq "Jul") {$mo_num=7}; if ($month eq "Aug") {$mo_num=8}; if ($month eq "Sep") {$mo_num=9}; if ($month eq "Oct") {$mo_num=10}; if ($month eq "Nov") {$mo_num=11}; if ($month eq "Dec") {$mo_num=12}; my $mo_num_u = $mo_num; my $last = $mo_num_u + 5; for my $mo_num ( $mo_num_u .. $last) { if ($mo_num == 13) {$mo_num = 1}; if ($mo_num == 1) {$month="Jan"}; if ($mo_num == 2) {$month="Feb"}; if ($mo_num == 3) {$month="Mar"}; if ($mo_num == 4) {$month="Apr"}; if ($mo_num == 5) {$month="May"}; if ($mo_num == 6) {$month="Jun"}; if ($mo_num == 7) {$month="Jul"}; if ($mo_num == 8) {$month="Aug"}; if ($mo_num == 9) {$month="Sep"}; if ($mo_num == 10) {$month="Oct"}; if ($mo_num == 11) {$month="Nov"}; if ($mo_num == 12) {$month="Dec"}; #OKAY- HERE COMES THE CAL #IF being run as a CGI, print the proper header if ($run_as eq "CGI" && $mo_num == $mo_num_u) {print "content-type: text/html\n\n"}; print "\n"; print "\n"; print "
\n"; print "
\n"; print "$heading $month $year
\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; #THE 'if' below tosses out the first two lines and the last empty one # open(INCAL,"$cal_prog $mo_num $year | ") or die "Can't run cal program..."; $cnt=1; while ($in_line = ) { my @week; if ($cnt > 2 && $in_line ge " ") { chop $in_line; $week[1]=substr($in_line,0,2); $week[2]=substr($in_line,3,2); $week[3]=substr($in_line,6,2); $week[4]=substr($in_line,9,2); $week[5]=substr($in_line,12,2); $week[6]=substr($in_line,15,2); $week[7]=substr($in_line,18,2); for my $i (1 .. 7 ) { if (($week[$i] == 3 || $week[$i] == 17) && $mo_num == 3) { $week[$i] = "$week[$i]
Regular Meeting"; } elsif (($week[$i] == 7 || $week[$i] == 21)&& $mo_num == 4) { $week[$i] = "$week[$i]
Regular Meeting" . (( $week[$i] == 7 ) ? " and Elections" : ""); } elsif (($week[$i] == 5 )&& $mo_num == 5) { $week[$i] = "$week[$i]
Regular Meeting" . (( $week[$i] == 7 ) ? " and Elections" : ""); } elsif (($week[$i] == 25 )&& $mo_num == 8) { $week[$i] = "$week[$i]
First Fall Meeting" . (( $week[$i] == 7 ) ? "" : ""); } else { $week[$i] = "$week[$i]
 "; } } print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } $cnt++; } print "
   Sunday
   Monday
  Tuesday
Wednesday
 Thursday
   Friday
 Saturday
$week[1]$week[2]$week[3]$week[4]$week[5]$week[6]$week[7]
Move your mouse over an event in the calendar and information on that event will display here! \n"; print "
"; close(INCAL); } exit;