image_proxy.php 592 B

123456789101112131415161718192021222324
  1. <?php
  2. $config = require "config.php";
  3. require "misc/tools.php";
  4. $url = $_REQUEST["url"];
  5. $split_url = explode("/", $url);
  6. $base_url = $split_url[2];
  7. $base_url_main_split = explode(".", strrev($base_url));
  8. $base_url_main = strrev($base_url_main_split[1]) . "." . strrev($base_url_main_split[0]);
  9. $allowed_domains = array("qwant.com", "wikimedia.org", "brave.com");
  10. if (in_array($base_url_main, $allowed_domains))
  11. {
  12. $image = $url;
  13. $image_src = request($image);
  14. header("Content-Type: image/jpeg");
  15. echo $image_src;
  16. }
  17. ?>