From 96b02b10e501725c1a4ff7b577a265da533ce0a0 Mon Sep 17 00:00:00 2001 From: "Nicolas A. Tonne" Date: Thu, 12 Feb 2015 22:36:22 +0100 Subject: [PATCH] Redirect to correct chan name if invalid chars in chan --- index.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index 7e48401f..b2be6927 100755 --- a/index.php +++ b/index.php @@ -2,7 +2,11 @@ if(isset($_GET['chan'])) header('Location: '.$_GET['chan']); $list = explode("/", htmlspecialchars(strtolower($_SERVER["REQUEST_URI"]))); if($list[1]==""||!isset($list[1])||count($list)<=1){$list="";include('php/nochan.php');die();} - else $list=preg_replace('/[^\da-z]/i', '', urldecode($list[1])); + else if ($list[1] != preg_replace('/[^\da-z]/i', '', urldecode($list[1]))){ + header('Location: ../'.preg_replace('/[^\da-z]/i', '', urldecode($list[1]))); + exit; + } + else $list=$list[1]; ?>