add_action('init', 'redirect_resources_check'); function redirect_resources_check() { $request_uri = filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_URL); $segments = explode('/', trim($request_uri, '/')); // Handling the resources URL logic if (in_array('resources', $segments)) { $resource_type = isset($segments[array('resources', $segments) + 1]) ? $segments[array('resources', $segments) + 1] : ''; if (!is_user_logged_in() && !current_user_can('administrator') && $resource_type != 'blogs') { if (!isset($_COOKIE['freeaccess']) || $_COOKIE['freeaccess'] !== 'true') { $resource_url = "https://" . $_SERVER['HTTP_HOST'] . $request_uri; setcookie('resourcedownload', $resource_url, time() + (30 * 24 * 60 * 60), "/"); wp_redirect('https://ethisphere.com/access-free-resources/'); exit; } } } $getvariable = filter_input(INPUT_GET, 'freersaccess', FILTER_SANITIZE_URL); // If user is on the "thank-you" page if ($getvariable == 'true') { // Set the "freeaccess" cookie to "true" setcookie('freeaccess', 'true', time() + (30 * 24 * 60 * 60), "/"); // Use WordPress's filter_input to retrieve the cookie value $resourcedownload = filter_input(INPUT_COOKIE, 'resourcedownload', FILTER_SANITIZE_URL); // Clear the cookie by setting its expiration to a past date setcookie('resourcedownload', '', time() - 3600, "/"); // Redirect the user back to the saved URL wp_redirect($resourcedownload); exit; } } Ethisphere Resource Center - Page 0 Skip to content

Francisco Partners Assessments

$0.00$1,000.00

SKU: N/A Category: Tag: