0) { $old_referer = $_SERVER['HTTP_REFERER']; parse_str(parse_url($old_referer, PHP_URL_QUERY)); $old_referer = "http://" . parse_url($old_referer , PHP_URL_HOST); $old_referer .= "?q=" . $q; } $sql = "SELECT forumid FROM {$tableprefix}forum WHERE importforumid={$old_id}"; $link = @mysql_connect($server, $user, $password); $db_selected = @mysql_select_db($database, $link); $result = @mysql_query($sql); $row = @mysql_fetch_row($result); $new_id = $row[0]; @mysql_free_result($result); @mysql_close($link); if (empty($new_id)) { if (empty($old_referer)) { $new_url = "/"; } else { $new_url = "/" . "?referer=" . $old_referer; } } else { if (empty($old_referer)) { $new_url = "/forumdisplay.php?f=" . $new_id; } else { $new_url = "/forumdisplay.php?f=" . $new_id . "&referer=" . $old_referer; } } # echo "\n"; # echo "

debug

\n"; # echo "URL = $url
\n"; # echo "old id = $old_id
\n"; # echo "sql = $sql
\n"; # echo "new id = $new_id
\n"; # echo "new url = $new_url
\n"; # echo "\n"; # header("HTTP/1.1 301 Moved Permanently"); header("Location: $new_url"); exit(); ?>