MyBB Community Forums

Full Version: Redirect
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Regular Expression:
\[redirect=([0-60]+)\](.*?)\[/redirect\]
(change the 60 to what you want the max number of seconds to wait untill the redirect)

Replacement:
<meta http-equiv="refresh" content="$1;URL='$2'">


MyCode Text:
[redirect=5]http://mybb.com[/redirect]

HTML Result:
<meta http-equiv="refresh" content="5;URL='http://mybb.com'">

Actual Result:
Won't work because HTML is disabled.

You can add permissions like what forums it can be used in and what groups it can be used in with this plugin. "http://mods.mybb.com/view/advanced-mycode-permissions"
The meta tag is only supposed to work within the head section, so your code shouldn't work for compliant browsers.

Secondly, you are extremely brave to allow users to redirect to other sites. From a security stand-point, I'd prefer to use the existing url tag and have your user click on it.
[redirect=0]http://badsite.com/malware.php[/redirect]

This definitely isn't a good idea.
With the plugin specified above you can make it so that only moderators and admins can use it.