Example #1
0
function loadDirectory($dir)
{
    $dh = opendir($dir) or die("ERROE APERTURA DIRECTORY");
    $content = array();
    while (($file = readdir($dh)) != FALSE) {
        if (!is_dir($file) && checkFormat($file)) {
            $content[] = $file;
        }
    }
    closedir($dh);
    return $content;
}
Example #2
0
function valDate($date, $req = false)
{
    if ($req == TRUE && $date == NULL) {
        echo "Error: date field is missing";
        exit;
    } else {
        //***************************************************************************
        // Checks format of date
        if (!checkFormat($date)) {
            echo "Error: incorrect format<br>All dates should match YYYY-MM-DD";
            exit;
        }
        //end inner if
        //***************************************************************************
        // Checks for a valid date
        if (!isDate($date)) {
            echo "Error: invalid date";
            exit;
        }
        //end inner if
        //***************************************************************************
        // Checks if date is either in the past or today
        if (!isBeforeTom($date)) {
            echo "Error: invalid date range";
            exit;
        } else {
            $date = trim($date);
            return $date;
        }
        //end inner if
    }
    //end outer if
}