. */ // basename should make sure we can't escape this directory $u = basename($_GET['resource']); if (!strpos($u, '@')) { throw new Exception('Bad resource'); exit(1); } if (mb_strpos($u, 'acct:')===0) { $u = substr($u, 5); } // Just to be a little bit safer, you know, with all the unicode stuff going on $u = filter_var($u, FILTER_SANITIZE_EMAIL); $f = $u . ".xml"; if (file_exists($f)) { header('Content-Disposition: attachment; filename="'.urlencode($f).'"'); header('Content-type: application/xrd+xml'); echo file_get_contents($f); }