redirect.php 634 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. require('config.php');
  3. $db = new PDO($osu_db);
  4. if (!$db) {
  5. die($sqliteerror);
  6. }
  7. if (isset($_GET["id"]))
  8. $id = preg_replace("/[^a-fA-F0-9]/", "", $_GET["id"]);
  9. else
  10. $id = 0;
  11. $row = $db->query("SELECT rowid,* FROM sessions WHERE id='$id'")->fetch();
  12. if ($row == false) {
  13. die("Session not found");
  14. }
  15. $uri = $row['redirect_uri'];
  16. header("Location: $uri", true, 302);
  17. $user = $row['user'];
  18. $realm = $row['realm'];
  19. $db->exec("INSERT INTO eventlog(user,realm,sessionid,timestamp,notes) " .
  20. "VALUES ('$user', '$realm', '$id', " .
  21. "strftime('%Y-%m-%d %H:%M:%f','now'), " .
  22. "'redirected after user input')");
  23. ?>