decoder.php 380 B

123456789101112131415161718
  1. <?php
  2. require_once 'config.php';
  3. $url = $_GET["q"];
  4. try {
  5. $db = new PDO("sqlite:$sqlitedb") or die("fail to connect db");
  6. }
  7. catch (Exception $e) {
  8. die($e);
  9. }
  10. $result = $db->query("SELECT * from main where shortened='$url' LIMIT 0, 1");
  11. while ($row = $result->fetchObject()) {
  12. $res = $row->url;
  13. header("location:" . $res);
  14. }
  15. ?>