Runing KISSmo Paste
";
$input = $_POST['query'];
$directory = getcwd()."/p/";
$txts= glob($directory. "*.txt") or DIE("Unable to open $directory");
$found = 0;
foreach ($txts as $txt){
$searchfor = $_POST['query'];
$file = $txt;
$contents = file_get_contents($file);
$pattern = preg_quote($searchfor, '/');
$pattern = "/^.*$pattern.*\$/m";
if (preg_match_all($pattern, $contents, $matches)) {
$path_parts = pathinfo($file);
$filename = $path_parts['basename'];
$link = "$filename
";
echo $link;
echo implode("
", $matches[0]);
echo '
';
echo '-----------------
';
$found = 1;
}
}
if($found == 0)
{
echo 'No match found';
}
echo "
";
}
?>
Paste | Archive
";
?>
30, // how many item to display for each page
'around' => 7, // how many page btn to show around the current page btn
'directory' => './p', // dir to scan for items
);
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$offset = ($page - 1) * $options['quantity']; // $page base index is 1
$filelist = array_diff(scandir($options['directory']), array('..', '.'));
//get subset of file array
$selectedFiles = array_slice($filelist, $offset, $options['quantity']);
foreach ($selectedFiles as $file) {
$path = $options['directory'] . '/' . $file;
$link = " $file
";
echo $link;
}
?>