search.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
  3. <head>
  4. <title> <?php echo $_REQUEST["q"]; ?> - LibreX</title>
  5. <meta http-equiv="Content-type" content="application/xhtml+xml;charset=utf-8"/>
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  7. <meta name="description" content="A privacy respecting meta search engine."/>
  8. <link rel="stylesheet" type="text/css" href="static/styles.css"/>
  9. <link title="LibreX search" type="application/opensearchdescription+xml" href="/opensearch.xml?method=POST" rel="search"/>
  10. </head>
  11. <body>
  12. <form class="small-search-container" method="post">
  13. <a href="/"><h1>LibreX</h1></a>
  14. <input type="hidden" name="p" value="0">
  15. <input type="text" name="q"
  16. <?php
  17. session_start();
  18. $query = trim($_REQUEST["q"]);
  19. if (1 > strlen($query) || strlen($query) > 256)
  20. {
  21. header("Location: /");
  22. die();
  23. }
  24. echo "value=\"$query\"";
  25. $_SESSION["q"] = $query;
  26. $_SESSION["p"] = $_REQUEST["p"];
  27. $_SESSION["type"] = $_REQUEST["type"];
  28. ?>
  29. >
  30. <br>
  31. <?php
  32. $type = $_REQUEST["type"];
  33. echo "<input type=\"hidden\" name=\"type\" value=\"$type\"/>";
  34. ?>
  35. <button type="submit" style="display:none;"></button>
  36. <div class="result-change">
  37. <button name="type" value="0">Text results</button>
  38. <button name="type" value="1">Image results</button>
  39. </div>
  40. <hr>
  41. </form>
  42. <iframe src="search_frame.php" frameborder="0"></iframe>
  43. <div class="info-container">
  44. <a href="/">LibreX</a>
  45. <a href="https://github.com/hnhx/librex/" target="_blank">Source code &amp; Other instances</a>
  46. <a href="/donate.xhtml" id="right">Donate ❤️</a>
  47. </div>
  48. </body>
  49. </html>