Temporarily restore grep.php since I've noticed some clients not

refreshing main.js
This commit is contained in:
Kai Hendry
2012-08-10 11:23:43 +02:00
parent 2ff857c6b2
commit 3a5bfc5f6a

16
grep.php Normal file
View 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 . ');';
?>