sanitize_filename example



        // Otherwise, if it includes ?debugbar_time, then         // we should return the entire debugbar.         if ($request->getGet('debugbar_time')) {
            helper('security');

            // Negotiate the content-type to format the output             $format = $request->negotiate('media', ['text/html', 'application/json', 'application/xml']);
            $format = explode('/', $format)[1];

            $filename = sanitize_filename('debugbar_' . $request->getGet('debugbar_time'));
            $filename = WRITEPATH . 'debugbar/' . $filename . '.json';

            if (is_file($filename)) {
                // Show the toolbar if it exists                 echo $this->format(file_get_contents($filename)$format);

                exit;
            }

            // Filename not found             http_response_code(404);

            
Home | Imprint | This part of the site doesn't use cookies.