added "my ip", "my user agent" special queries, settings set via parameters now persist, changed "type" to "t" for consistency

This commit is contained in:
hnhx
2022-10-25 13:02:01 +02:00
parent 47c9bc2573
commit ddaceff4e5
9 changed files with 76 additions and 16 deletions
+3 -3
View File
@@ -4,11 +4,11 @@
if (!isset($_REQUEST["q"]))
{
echo "<p>Example API request: <a href=\"./api.php?q=gentoo&p=2&type=0\">./api.php?q=gentoo&p=2&type=0</a></p>
echo "<p>Example API request: <a href=\"./api.php?q=gentoo&p=2&t=0\">./api.php?q=gentoo&p=2&t=0</a></p>
<br/>
<p>\"q\" is the keyword</p>
<p>\"p\" is the result page (the first page is 0)</p>
<p>\"type\" is the search type (0=text, 1=image, 2=video, 3=torrent)</p>
<p>\"t\" is the search type (0=text, 1=image, 2=video, 3=torrent)</p>
<br/>
<p>The results are going to be in JSON format.</p>
<p>The API supports both POST and GET requests.</p>";
@@ -19,7 +19,7 @@
$query = $_REQUEST["q"];
$query_encoded = urlencode($query);
$page = isset($_REQUEST["p"]) ? (int) $_REQUEST["p"] : 0;
$type = isset($_REQUEST["type"]) ? (int) $_REQUEST["type"] : 0;
$type = isset($_REQUEST["t"]) ? (int) $_REQUEST["t"] : 0;
$results = array();