mirror of
https://github.com/thewesker/greptweet.git
synced 2025-12-22 13:01:06 -05:00
Temporarily restore grep.php since I've noticed some clients not
refreshing main.js
This commit is contained in:
16
grep.php
Normal file
16
grep.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
header('Content-type: application/json');
|
||||
if (empty($_GET['q'])) { die(); }
|
||||
|
||||
// Is this the correct way to sanitise args to shell from PHP?
|
||||
$QUERY=urldecode(escapeshellarg(urlencode($_GET['q'])));
|
||||
|
||||
// Debug Logging
|
||||
//$fp = fopen('debug.log', 'a');
|
||||
//fwrite($fp, $_GET['q'] . " : " . $QUERY . "\n");
|
||||
//fclose($fp);
|
||||
|
||||
exec("grep -hi $QUERY tweets.txt", $array);
|
||||
$data = json_encode($array);
|
||||
echo $_GET['jsoncallback'] . '(' . $data . ');';
|
||||
?>
|
||||
Reference in New Issue
Block a user