phpBBHacks.com, the place for phpBB users

Bookmark and Share

Call to undefined function: phpbb_clean_username()

Call to undefined function: phpbb_clean_username()

Postby Spinebuster » May 6th 2005, 6:04 pm

Fatal error: Call to undefined function: phpbb_clean_username() in /home/user/public_html/phpBB2/login.php on line 57


This error normally happens when you install a hack that was coded for phpBB versions 2.0.11 and higher. If you're running an older version of phpBB and havent had the time to upgrade yet, simply adding this section of code to your includes/functions.php file will make the error message go away.

Code: Select all
// added at phpBB 2.0.11 to properly format the username
function phpbb_clean_username($username)
{
	$username = substr(htmlspecialchars(str_replace("\'", "'", trim($username))), 0, 25);
	$username = phpbb_rtrim($username, "\\");	
	$username = str_replace("'", "\'", $username);

	return $username;
}

// added at phpBB 2.0.12 to fix a bug in PHP 4.3.10 (only supporting charlist in php >= 4.1.0)
function phpbb_rtrim($str, $charlist = false)
{
	if ($charlist === false)
	{
		return rtrim($str);
	}
	
	$php_version = explode('.', PHP_VERSION);

	// php version < 4.1.0
	if ((int) $php_version[0] < 4 || ((int) $php_version[0] == 4 && (int) $php_version[1] < 1))
	{
		while ($str{strlen($str)-1} == $charlist)
		{
			$str = substr($str, 0, strlen($str)-1);
		}
	}
	else
	{
		$str = rtrim($str, $charlist);
	}

	return $str;
}
User avatar
Spinebuster
Dedicated User
 
Posts: 3379
Joined: April 21st 2003, 4:42 pm
Location: IN

Return to phpBB 2: Troubleshooting

Who is online

Users browsing this forum: No registered users and 0 guests