Ok, look for:

$old = $_GET['old'];

delete that and everything after it and replace it with this:

Code
$topic = $_GET['t'];
$post = $_GET['p'];

if ($topic || $post) {
	
	if (!$topic) $topic = 0;
	if (!$post) $post = 0;
	
	if ($redirect == 301) {
		header("HTTP/1.1 301 Moved Permanently");
	} else {
		header("HTTP/1.1 302 Moved Temporarily");
	}
	header("Location: {$URL}/ubbthreads.php{$var_start}ubb{$var_eq}showflat{$var_sep}topic{$var_eq}$topic{$var_sep}Number{$var_eq}$post{$var_sep}site_id{$var_eq}$site_id#import");
	exit;
} else {
	if ($redirect == 301) {
		header("HTTP/1.1 301 Moved Permanently");
	} else {
		header("HTTP/1.1 302 Moved Temporarily");
	}
	header("Location: {$URL}/ubbthreads.php{$var_start}ubb{$var_eq}cfrm");
	exit;
}	
?>