| 
    =**************************************
    = Name: Calender
    = Description:Displays a calender using 
    =     tables, It highlights the current date &
    =     shows day, month, year...
    = By: Jeff Mills
    =
    = Inputs:No input parameters...
    =
    = Returns:Current calender display...
    =
    = Side Effects:No known buggs/side effec
    =     ts...
    =
    =This code is copyrighted and has    = limited warranties.Please see http://w
    =     ww.Planet-Source-Code.com/vb/scripts/Sho
    =     wCode.asp?txtCodeId=553&lngWId;=6    =for details.    =**************************************
    
    #!/usr/bin/perl
    #=== VARIABLES ===#
    $cal_prog="/usr/bin/cal";#cal program is usually /bin/cal or /usr/bin/cal
    $inner="#D3D3D3"; #Inside table color
    $width="WIDTH=\"30\"";#Inside table cell width
    $align="ALIGN=\"RIGHT\""; #Table cell align
    $color="COLOR=\"#003CBA\"";#The current date color
    @MONTH=(Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec);
    @DAY= (Sun,Mon,Tue,Wed,Thu,Fri,Sat);
    #=== GET DATE & ADJUST ===#
    (undef,undef,undef,$mday,$mon,$year,$wday,undef,undef) = localtime(time);
    $year += 1900;#ADJUST YEAR FROM 103 TO 2003
    if($mday<10) {$mday="0$mday";}#ADJUST DATE IF LESS THAN 10
    $mo_num=$mon+1;
    #=== START CALENDER TABLE ===#
    print <<HEADER;
    Content-type: text/html
    <TABLE BORDER=1 BGCOLOR=$inner>
    <TH><FONT $color>$DAY[$wday]  $MONTH[$mon] $mday  $year</FONT></TH>
    <TR><TD>
    <TABLE BORDER=1 BGCOLOR=$inner>
    <TR>
    HEADER
    for($cnt=0;$cnt<7;$cnt++) {
    print "<TD $align $width>$DAY[$cnt]</TD>\n";
    }
    print "</TR>";
    #=== START DATES ON EACH DAY ===#
    #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_prog: $!";
    $cnt=1;
    while($in_line = <INCAL>)
    {
    if($cnt > 2 && $in_line ge " ")
    {
    chop $in_line;
    $sun=substr($in_line,0,2);
    $mon=substr($in_line,3,2);
    $tue=substr($in_line,6,2);
    $wed=substr($in_line,9,2);
    $thu=substr($in_line,12,2);
    $fri=substr($in_line,15,2);
    $sat=substr($in_line,18,2);
    print "<TR>\n";
    if($sun eq $mday) {print "<TD $align><FONT $color><B>$mday</B></FONT></TD>\n";}
    else{print "<TD $align>$sun</TD>\n";}
    if($mon eq $mday) {print "<TD $align><FONT $color><B>$mday</B></FONT></TD>\n";}
    else{print "<TD $align>$mon</TD>\n";}
    if($tue eq $mday) {print "<TD $align><FONT $color><B>$mday</B></FONT></TD>\n";}
    else{print "<TD $align>$tue</TD>\n";}
    if($wed eq $mday) {print "<TD $align><FONT $color><B>$mday</B></FONT></TD>\n";}
    else{print "<TD $align>$wed</TD>\n";}
    if($thu eq $mday) {print "<TD $align><FONT $color><B>$mday</B></FONT></TD>\n";}
    else{print "<TD $align>$thu</TD>\n";}
    if($fri eq $mday) {print "<TD $align><FONT $color><B>$mday</B></FONT></TD>\n";}
    else{print "<TD $align>$fri</TD>\n";}
    if($sat eq $mday) {print "<TD $align><FONT $color><B>$mday</B></FONT></TD>\n";}
    else{print "<TD $align>$sat</TD>\n";}
    print "</TR>\n";
    }
    $cnt++;
    }
    #=== END CALENDER TABLE ===#
    print <<FOOTER;
    </TABLE>
    </TD></TR>
    </TABLE>
    FOOTER
    close(INCAL);
    exit(0);
    #=== EOF jmills73@yahoo.com ===# |