News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

[Tool] phpBB Redirection

Started by Spaceman-Spiff, May 08, 2004, 07:32:18 PM

Previous topic - Next topic

Spaceman-Spiff

phpBB Redirection
Version: 1.0

About
I decided to write this after finding a dead link to an old topic at Coppermine forum. They just recently converted to SMF and there were still some links pointing to the old phpBB forum, links like: viewtopic.php?t=4623

These very simple scripts should redirect old phpBB links to SMF.
Will be very useful after you've converted your forum from phpBB to
SMF.

Instructions
Just put the files in your forum directory. The most important ones are viewforum.php and viewtopic.php, you can upload only those two or ignore the other files if you like.

DO NOT USE index.php if your new forum is still on the same directory
as the old phpBB's one.
You'll need to edit redirect-settings.php

Redirection List
- viewforum.php?f=x  ==>  index.php?board=x
- viewtopic.php?t=x  ==>  index.php?topic=x
- profile.php?mode=viewprofile&u=x  ==>  index.php?action=profile;u=x
- profile.php?mode=editprofile  ==>  index.php?action=profile
- index.php  ==>  index.php
- search.php?search_id=egosearch  ==>  index.php?action=profile;sa=showPosts
- search.php?search_id=newposts  ==>  index.php?action=unread
- search.php?search_author=x  ==>  index.php?action=profile;sa=showPosts;user=x
- viewonline.php  ==>  index.php?action=who
- memberlist.php  ==>  index.php?action=mlist
- faq.php  ==>  index.php?action=help

Reply below if you want me to add more stuff to redirect.

V@no

Hi!
thanks for this tool.
but viewtopic.php?t=x  does not work it always fedirects to index.php?board=x

when I looked in it, I dont see anything that would redirect to the appropriate topic.
The code should look like this:@include 'redirect-settings.php';
$t = (int) $_REQUEST['t'];
$x = (int) $_REQUEST['f'];
if ($t)
  header ('Location: ' . $forumurl . 'index.php?topic=' . $t);
else
  header ('Location: ' . $forumurl . 'index.php?board=' . $x);

Well, that's the easy part.
How about urls viewtopic.php?p=x ? where p= is a reply id
any sollutions?

Thank you.

Oldiesmann

Use if($t != '') instead. The way you've got it set up now, it's acting like a boolean statement. It will redirect to the appropriate topic, but only if $t is 1 (1 = 'true')...

V@no

#3
I'm not quet sure what difference it makes, "t" has to be bigger then 0 otherwise its not valid topic ID anyway...

[Unknown]

#4
Please try the attached version for f, t, and p.

Quote from: Oldiesmann on April 03, 2005, 04:48:17 PM
Use if($t != '') instead. The way you've got it set up now, it's acting like a boolean statement. It will redirect to the appropriate topic, but only if $t is 1 (1 = 'true')...

That's not true, Oldiesmann.  This:

if (5)

Is equivalent to:

if ((bool) 5)

And, anything that isn't 0 casts down to 1 in bool - even negative numbers.  It works the same way in C.

-[Unknown]

V@no

I still dont see what is the problem...if "t" is set and its a number other then 0 then use "topic=" otherwise use "board="...if u are saying that someone could post negative value for "t=", then hell with it, I'd rether see the message that no topic found, then being redirected to the index page...see what I mean?

As of the attached viewtopic.php - it works great! thank you very much!

one little addition might be helpfull:
if (!empty($topic))
{
  $topic .= ".msg".$msg."#msg".$msg;
}

Below mysql_free_result($request);

You guys are always fast with the responces here! great job :D

[Unknown]

You won't believe me now, but I *did* think of that and mean to do it.  Sorry.

Attached is a better one.

As for t, it's not really an issue since SMF will validate the value anyway.  Casting it to an int will make it clean for the database, too, so we're cool.

-[Unknown]

Celtland

Would it be possible to add redirection for attachments, also?
Is maith an scáthán súil carad.

A friends eye is a good mirror.

internetbrother

isn't there any way we can fix this throguh SQL?

Advertisement: