Use this for the second one:
PHP Code:
// redirect
if ($visible && !$returntowhere) {
$goto="showthread.php?s=$session[sessionhash]&postid=$postid&goto=newpost";
} else {
if ($returntowhere=="forumhome") {
$goto="index.php?s=$session[sessionhash]";
} elseif ($returntowhere=="thread") {
$goto="showthread.php?s=$session[sessionhash]&postid=$postid&goto=newpost";
} else {
$goto="forumdisplay.php?s=$session[sessionhash]&forumid=$threadinfo[forumid]";
}
}
@header ("Location: $goto")
exit;