Warning! The code will fail in some cases (General)

by Auge, Monday, July 20, 2009, 17:14 (5404 days ago) @ hunter

Hello

find code into file: register.inc.php
change from
$lang['new_user_email_txt'] = str_replace("[activate_link]", $settings['forum_address'] ."index.php?mode=register&id=".$new_user_id."&key=".$activate_code, $lang['new_user_email_txt']);

to:

$lang['new_user_email_txt'] = str_replace("[activate_link]","http://". $_SERVER['SERVER_NAME'] ."/index.php?mode=register&id=".$new_user_id."&key=".$activate_code, $lang['new_user_email_txt']);

What's the reason to do it?

In many cases the forum is not installed in the root of a domain but in a subfolder. Thatswhy $settings['forum_address'] contains the full path to the forum folder. In your case the forum has to be directly installed in example.com so the URL has to be http://example.com/index.php. But what is when the forum is installed in the subfolder "forum"? The correct URL is http://example.com/forum/index.php. But that will fail with your code that generates http://example.com/index.php?mode=register....

Tschö, Auge


Complete thread:

 RSS Feed of thread