<?php
$urlArray = explode('/', $_SERVER['PHP_SELF']);
$threadArray = explode('-', filter_var($urlArray[3], FILTER_SANITIZE_NUMBER_INT));
$post = filter_var($_GET['p'], FILTER_SANITIZE_NUMBER_INT);
$thread = filter_var($_GET['t'], FILTER_SANITIZE_NUMBER_INT);

$threadNumber = $threadArray[0];
if ($thread > $threadNumber){
	$threadNumber = $thread;
}


$url = 'https://avclub.gr/index.php?threads/'.$threadNumber.'/#post-'.$post;
header('Location: '.$url);

?>
