<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl

#Written by Adam Arakelian and Boris Volf
#Usage:
#      Install in Perl/lib/
#      In Script at head type: Use DateValidate qw(DateValidate);
#      To Call:  DateValidate($date);
#DateValidate.pm

package DateValidate;
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw();
@EXPORT_OK = qw(DateValidate);

sub DateValidate {
($date_validate) = @_;


$slash_count = ($date_validate =~ tr/\///);
if ($slash_count != 2) {
$slash_date_err = "false";
$url = "$ENV{'HTTP_REFERER'}";
print "location: $url\n\n";
exit;
}

@date_arry = "$date_validate";
foreach $i (@date_arry){
chomp($i);
($date_month,$date_day,$date_year) = split(/\//, $i);
}

$length_month = length($date_month);

$length_day = length($date_day);

$length_year = length($date_year);


if (($date_month &gt;= 1) and ($date_month &lt;= 12)) {
    if ((($date_month == 4) or ($date_month == 6) or ($date_month == 9) or ($date_month == 11)) and (($date_day == 31))){
        $month_too_many_days_date_err = "false";
        $url = "$ENV{'HTTP_REFERER'}";
        print "location: $url\n\n";
        exit;

}elsif (($date_month &gt;= 1) and ($date_month &lt;= 9)) {
       $date_month = '0'.$date_month;
   }

}elsif (($date_month &gt; 12) or ($date_month == 0)) {

        $month_greater_date_err = "false";
        $url = "$ENV{'HTTP_REFERER'}";
        print "location: $url\n\n";
        exit;
}


if (($date_day &gt;= 1) and ($date_day &lt;= 31)) {
   if ($length_day == 1) {
       $date_day = '0'.$date_day;

   }

}else{
        $day_out_range_date_err = "false";
        $url = "$ENV{'HTTP_REFERER'}";
        print "location: $url\n\n";
        exit;
}

if (($length_year != 2) and ($length_year != 4)) {

        $year_date_err = "false";
        $url = "$ENV{'HTTP_REFERER'}";
        print "location: $url\n\n";
        exit;

  }elsif (($length_year ==  2) and ($date_year &gt; 50)) {
          $date_year = '19'.$date_year;

}elsif ($date_year eq '00') {
          $date_year = '20'.$date_year;

}elsif ($date_year eq '0000') {
        $invalid_year_date_err = "false";
        $url = "$ENV{'HTTP_REFERER'}";
        print "location: $url\n\n";
        exit;
}

if (($date_month == 2) and ($date_day &gt; 29)) {
         $leap_year_date_err = "false";
         $url = "$ENV{'HTTP_REFERER'}";
         print "location: $url\n\n";
         exit;

}elsif (($date_month == 2) and ($date_year % 4) and ($date_year % 100 or $date_year % 400)){

        $invalid_leap_date_err = "false";
        $url = "$ENV{'HTTP_REFERER'}";
        print "location: $url\n\n";
        exit;
   }

}

</pre></body></html>