<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/wp-config.php';
if (!isset($_GET['material_id'])) {
    //header('location: '.get_site_url());
    exit;
} else {
    include get_template_directory() . '/page-templates/members-area/classes/Class_MembersArea.php';
    $class_members = new MembersArea();
    //$course_material_dir = SECURE_MEMBERS_DIR.'/course-materials/';
    //$course_folders = array_filter(glob($course_material_dir.'*'), 'is_dir');
    $download_to_check = $_GET['material_id'];
    echo json_encode($class_members->countCourseDownloads($download_to_check));
}