image.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. $url = "";
  3. $loc = "US";
  4. if( isset( $_GET['loc'] ) ) {
  5. $loc = strtoupper($_GET["loc"]);
  6. }
  7. //get the image url
  8. if (isset( $_GET['i'] ) ) {
  9. $url = $_GET[ 'i' ];
  10. } else {
  11. exit();
  12. }
  13. //we can only do jpg and png here
  14. if (strpos($url, ".jpg") && strpos($url, ".jpeg") && strpos($url, ".png") != true ) {
  15. echo strpos($url, ".jpg");
  16. echo "Unsupported file type :(";
  17. exit();
  18. }
  19. //image needs to start with http
  20. if (substr( $url, 0, 4 ) != "http") {
  21. echo("Image failed :(");
  22. exit();
  23. }
  24. ?>
  25. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 2.0//EN">
  26. <html>
  27. <head>
  28. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  29. <link rel="stylesheet" type="text/css" href="/main.css">
  30. <title>
  31. 68k.news Image Viewer
  32. </title>
  33. </head>
  34. <body">
  35. <small><a href="<?php echo $_SERVER['HTTP_REFERER'] . '?loc=' . strtoupper($loc) ?>">< Back to article</a> | <a href="/index.php"><font color="#9400d3">68k.news</font> front page</a></small>
  36. <p><small><b>Viewing image:</b> <?php echo $url ?></small></p>
  37. <img src="/image_compressed.php?i=<?php echo $url; ?>">
  38. <br><br>
  39. <small><a href="<?php echo $_SERVER['HTTP_REFERER'] . '?loc=' . strtoupper($loc) ?>">< Back to article</a> | <a href="/index.php"><font color="#9400d3">68k.news</font> front page</a></small>
  40. </body>
  41. </html>