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