1<?php 2 $delay = "1"; // in seconds 3 4 $url = urldecode($_SERVER["QUERY_STRING"]); 5 6 // only allow http/https urls 7 /*$pat = '/^http(s)?/i'; 8 if (!preg_match($pat, $url)) { 9 die("Invalid request."); 10 }*/ 11 12 // preventing XSS 13 $url = str_replace("\"", "%22", $url); 14 $url = str_replace("'", "%27", $url); 15 16 // truncate for title 17 $title = (strlen($url) > 55) ? substr($url, 0, 51) . "[..]" : $url; 18 $title = htmlentities($title, ENT_QUOTES); 19?> 20<!DOCTYPE html> 21 22<html> 23 <head> 24 <meta charset="utf-8" /> 25 <meta http-equiv="refresh" content="<?=$delay?>; URL='<?=$url?>'" /> 26 <title>Redirect</title> 27 </head> 28 <body> 29 30 <div style="background: #DADADA; position: absolute; width: 500px; height: 80px; line-height: 40px; left: 50%; top: 50%; margin-left: -250px; margin-top: -40px; border: 1px dotted #000000; text-align: center;"> 31 <div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; color: #000000"> 32 You are now leaving DokuWiki.<br> 33 <b><i><?=$title?></i></b> 34 </div> 35 </div> 36 </body> 37</html> 38