Wikka : WikkaWithphpBB

HomePage :: Categories :: Index :: Changes :: Comments :: Documentation :: Blog :: Login/Register
Most recent edit on 2008-05-12 18:47:21 by WebHorn

Additions:
Note: these methods are used to integrate phpBB 2.x. For phpBB 3.x, see Using Wikka with phpBB3

Deletions:

Using PHPBB 2.x





Edited on 2008-05-12 18:46:01 by WebHorn

Additions:


Deletions:




Edited on 2008-05-12 18:40:52 by WebHorn

Additions:


Deletions:
WikkaWithphpBB3



Edited on 2008-05-12 18:25:24 by WebHorn

Additions:
WikkaWithphpBB3



Edited on 2008-05-12 18:24:12 by WebHorn

Deletions:

Using PHPBB 3.x

Contributed by Paul Young, using the example code by JeremyCoates in Method 2 below.
phpBB3 changed its user authentication mechanism. phpBB3 no longer stores MD5 hashes of passwords; instead it does a "true" one-way, one-time, non-recoverable hash of the password using [http://www.openwall.com/phpass/|phpass]. The output of the hash is different each time, so you can't just select the password in the phpBB database and do a compare against a MD5 of the submitted password anymore - you have to algorithmically compare them using phpass. They also changed how and where they indicate if a user is active or inactive.
It's not difficult, but you will need to bring in code from phpBB to your Wikka files.
One final note, this code works for me on my server, but could stand to be further tested. Feel free to correct if you find a bug.
/
* PHPBB Integration
*
* function LoadUser($name, $password = 0) { return $this->LoadSingle("select * from ".$this->config['table_prefix']."users where name = '".mysql_real_escape_string($name)."' ".($password 34)
return (_hash_crypt_private($password, $hash, $itoa64) $hash) ? true : false;
return (md5($password)

$hash) ? true : false;

}
/
* Generate salt for hash generation
*/
function _hash_gensalt_private($input, &$itoa64, $iteration_count_log2 = 6)
{
if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31)
$iteration_count_log2 = 8;
$output = '$H$';
$output .= $itoa64[min($iteration_count_log2 + ((PHP_VERSION >= 5) ? 5 : 3), 30)];
$output .= _hash_encode64($input, 6, $itoa64);
return $output;
}
/

* Encode hash
*/
function _hash_encode64($input, $count, &$itoa64)
{
$output = ;
$i = 0;
do
$value = ord($input[$i]);
$output .= $itoa64[$value & 0x3f];
if ($i < $count)
{
$value |= ord($input[$i])
8;
$output .= $itoa64[($value
6) & 0x3f];
if ($i >= $count)
{
break;
if ($i < $count)
{
$value |= ord($input[$i])
16;
$output .= $itoa64[($value
12) & 0x3f];
if ($i >= $count)
{
break;
$output .= $itoa64[($value
18) & 0x3f];
while ($i < $count);
return $output;
}
/
* The crypt function/replacement
*/
function _hash_crypt_private($password, $setting, &$itoa64)
{
$output = '*';
Check for correct hash
if (substr($setting, 0, 3) != '$H$')
return $output;
$count_log2 = strpos($itoa64, $setting[3]);
if ($count_log2 < 7 || $count_log2 > 30)
return $output;
$count = 1
$count_log2;
$salt = substr($setting, 4, 8);
if (strlen($salt) != 8)
return $output;
* We're kind of forced to use MD5 here since it's the only
* cryptographic primitive available in all versions of PHP
* currently in use. To implement our own low-level crypto
* in PHP would result in much worse performance and
* consequently in lower iteration counts and hashes that are
* quicker to crack (by non-PHP code).
*/
if (PHP_VERSION >= 5)
$hash = md5($salt . $password, true);
do
{
$hash = md5($hash . $password, true);
while (--$count);
else
$hash = pack('H*', md5($salt . $password));
do
{
$hash = pack('H*', md5($hash . $password));
while (--$count);
$output = substr($setting, 0, 12);
$output .= _hash_encode64($hash, 16, $itoa64);
return $output;
}
/

* Return unique id
* @param string $extra additional entropy
*/
function unique_id($extra = 'c')
{
static $dss_seeded = false;
global $config;
$val = $config['rand_seed'] . microtime();
$val = md5($val);
/*
$config['rand_seed'] = md5($config['rand_seed'] . $val . $extra);
if ($dss_seeded !
true && ($config['rand_seed_last_update'] < time() - rand(1,10)))
set_config('rand_seed', $config['rand_seed'], true);
set_config('rand_seed_last_update', time(), true);
$dss_seeded = true;
*/
return substr($val, 4, 16);
}
 default: // input is valid
				* PHPBB Integration
				*
				* Insert the user into the Wakka users table
				*/
				* End PHPBB Integration
				*/
 
case (md5($_POST['password']) != $existingUser['password']):					
	$error = ERROR_WRONG_PASSWORD;
		$password_highlight = INPUT_ERROR_STYLE;
	break;

Replace With:
case (!phpbb_check_hash($_POST['password'],$existingUser['password'])):
$error = ERROR_WRONG_PASSWORD;
$password_highlight = INPUT_ERROR_STYLE;
break;%%




Edited on 2008-05-12 18:22:39 by WebHorn

Additions:
This is a very simple hack to get Wikka to read from the users table of a phpBB database rather than its own. It is assuming that you have installed your Wikka into the same database as phpBB and that your phpBB tables are prefixed with "phpbb_" ("phpbb3_" for the v3.0 examples) and that their names have not been edited.

Using PHPBB 3.x

Contributed by Paul Young, using the example code by JeremyCoates in Method 2 below.
phpBB3 changed its user authentication mechanism. phpBB3 no longer stores MD5 hashes of passwords; instead it does a "true" one-way, one-time, non-recoverable hash of the password using [http://www.openwall.com/phpass/|phpass]. The output of the hash is different each time, so you can't just select the password in the phpBB database and do a compare against a MD5 of the submitted password anymore - you have to algorithmically compare them using phpass. They also changed how and where they indicate if a user is active or inactive.
It's not difficult, but you will need to bring in code from phpBB to your Wikka files.
One final note, this code works for me on my server, but could stand to be further tested. Feel free to correct if you find a bug.
/
* PHPBB Integration
*
* function LoadUser($name, $password = 0) { return $this->LoadSingle("select * from ".$this->config['table_prefix']."users where name = '".mysql_real_escape_string($name)."' ".($password 34)
return (_hash_crypt_private($password, $hash, $itoa64) $hash) ? true : false;
return (md5($password)


Deletions:
This is a very simple hack to get Wikka to read from the users table of a phpBB database rather than its own. It is assuming that you have installed your Wikka into the same database as phpBB and that your phpBB tables are prefixed with "phpbb_" and that their names have not been edited.



Edited on 2008-01-28 00:14:02 by BrianKoontz [Modified links pointing to docs server]

No differences.


Edited on 2007-04-19 09:14:49 by BrianKoontz [Restored]

Additions:
$i;
$str .= "<td>$i. </td>";
$str .= '<td>'. $this->Format( $row["username"] ) .'</td>';
$str .= '<td> </td>';
$str .= '<td> </td>';
$str .= '<td>'.$row["cnt"].'</td>';
$str .= '<td> </td>';
$str .= '<td>'. round( ($row["cnt"]/$total)*100, 2).'% </td>';
$str .= '</tr>';
print( $str );
}
print( "</table></blockquote>" );
?>
<<>>
====Method 2====
Added by JeremyCoates
Advantages over Method 1:
	- Better SQL reduces number of code changes required
	- Still allows use of Wakka user settings
	- Shows how to enforce Wiki Names in phpBB code
(php)
/
* PHPBB Integration
*
* function LoadUser($name, $password = 0) { return $this->LoadSingle("select * from ".$this->config['table_prefix']."users where name = '".mysql_real_escape_string($name)."' ".($password Added on July 29, 2005 by EniBevoli
I still have to make a easily readable diff output (such as "Find" - "Replace with" above; I already translated some text strings to German, so diff'ing is currently a mess) so that other users can edit their own files, but since I have finally come to a solution outlined below, I thought it would be a beneficial for others to simply post my results right away. The existing work on the Wikka Wiki / phpBB integration was a big starting point; without this information, I wouldn't even had a clue what to do. :)
Features / How it works:
  • Wikka uses phhBB for user logins, i.e. name and password of users are authenticated against the phpBB database
  • Users can configure some Wikka-specific settings via the User Settings page (for some settings, there is no point in changing them at the User Settings page; e.g., the email or the password field: the user should change this in his phpBB profile)
  • Whenever an existing phpBB user logs into Wikka, a Wikka user with the same name is created - if it does not already exist - for storing Wikka-specific settings (such as show_comments) as there is no counterpart for such settings in phpBB (and I don't want to alter the phpBB table structure)
Requirements:
- After the integration of Wikka Wiki and phpBB is done, user registration via Wikka Wiki must be disabled, new accounts should only be added via phpBB; see UserRegistration for more information about how to disable user registration
It took me quite some time to figure out why turning off "double click edit" didn't work - it is a bug with Wikka Wiki 1.1.6.0. :) I don't include the bug fix here, since it is already outlined in WikkaBugs.
Changed files:
  • wikka.php
  • handlers/page/acls.php
  • handlers/page/show.php (to fix the double click edit bug)
  • actions/usersettings.php
  • actions/highscore.php
As I said, I'm still compiling the changes in an easily readable format and will update this page when I'm done.
To Do / Questions / Open Issues:
  • phpBB users with non-camelcase usernames (e.g., "John") seem to work flawlessly on my installation even though I expected problems; any comments from the developers?
  • I am quite sure that the code quality is...ahm..."suboptimal". I basically tried to get it to work in the first place (I downloaded WikkaWiki today for the first time), so please don't flame me; instead, help to fix it!

CategoryUserContributions


Deletions:
$i ;
$str .= "<td>$i.




Edited on 2007-04-19 08:32:00 by PvgEo0

Additions:
$i ;
$str .= "<td>$i.


Deletions:
$i;
$str .= "<td>$i.  </td>";
$str .= '<td>'. $this->Format( $row["username"] ) .'</td>';
$str .= '<td> </td>';
$str .= '<td>    </td>';
$str .= '<td>'.$row["cnt"].'</td>';
$str .= '<td>    </td>';
$str .= '<td>'. round( ($row["cnt"]/$total)*100, 2).'% </td>';
$str .= '</tr>';
print( $str );
}
print( "</table></blockquote>" );
?>
<<>>
====Method 2====
Added by JeremyCoates
Advantages over Method 1:
	- Better SQL reduces number of code changes required
	- Still allows use of Wakka user settings
	- Shows how to enforce Wiki Names in phpBB code
(php)
/
* PHPBB Integration
*
* function LoadUser($name, $password = 0) { return $this->LoadSingle("select * from ".$this->config['table_prefix']."users where name = '".mysql_real_escape_string($name)."' ".($password Added on July 29, 2005 by EniBevoli
I still have to make a easily readable diff output (such as "Find" - "Replace with" above; I already translated some text strings to German, so diff'ing is currently a mess) so that other users can edit their own files, but since I have finally come to a solution outlined below, I thought it would be a beneficial for others to simply post my results right away. The existing work on the Wikka Wiki / phpBB integration was a big starting point; without this information, I wouldn't even had a clue what to do. :)
Features / How it works:
  • Wikka uses phhBB for user logins, i.e. name and password of users are authenticated against the phpBB database
  • Users can configure some Wikka-specific settings via the User Settings page (for some settings, there is no point in changing them at the User Settings page; e.g., the email or the password field: the user should change this in his phpBB profile)
  • Whenever an existing phpBB user logs into Wikka, a Wikka user with the same name is created - if it does not already exist - for storing Wikka-specific settings (such as show_comments) as there is no counterpart for such settings in phpBB (and I don't want to alter the phpBB table structure)
Requirements:
- After the integration of Wikka Wiki and phpBB is done, user registration via Wikka Wiki must be disabled, new accounts should only be added via phpBB; see UserRegistration for more information about how to disable user registration
It took me quite some time to figure out why turning off "double click edit" didn't work - it is a bug with Wikka Wiki 1.1.6.0. :) I don't include the bug fix here, since it is already outlined in WikkaBugs.
Changed files:
  • wikka.php
  • handlers/page/acls.php
  • handlers/page/show.php (to fix the double click edit bug)
  • actions/usersettings.php
  • actions/highscore.php
As I said, I'm still compiling the changes in an easily readable format and will update this page when I'm done.
To Do / Questions / Open Issues:
  • phpBB users with non-camelcase usernames (e.g., "John") seem to work flawlessly on my installation even though I expected problems; any comments from the developers?
  • I am quite sure that the code quality is...ahm..."suboptimal". I basically tried to get it to work in the first place (I downloaded WikkaWiki today for the first time), so please don't flame me; instead, help to fix it!

CategoryUserContributions




Edited on 2007-01-25 04:13:33 by JeremyCoates [Minor correction to call constructor for hack function]

Additions:
function WakkaPHPBBHack($config) {


Deletions:
function WakkaHack($config) {




Edited on 2007-01-17 11:56:00 by JeremyCoates [SQL example change: only work with active users]

Additions:
where p.username = '".mysql_real_escape_string($name)."' ".($password

0 ? "" : "and p.user_password = '".mysql_real_escape_string($password)."'")." and p.user_active = 1 limit 1");

where p.user_active = 1


Deletions:
where p.username = '".mysql_real_escape_string($name)."' ".($password

0 ? "" : "and p.user_password = '".mysql_real_escape_string($password)."'")." limit 1");





Edited on 2007-01-16 12:56:25 by JeremyCoates [Added new improved integration method]

Additions:

Method 1


Method 2

Added by JeremyCoates
Advantages over Method 1:
  • Better SQL reduces number of code changes required
  • Still allows use of Wakka user settings
  • Shows how to enforce Wiki Names in phpBB code
    /**
    * PHPBB Integration
    *
    * function LoadUser($name, $password = 0) { return $this->LoadSingle("select * from ".$this->config['table_prefix']."users where name = '".mysql_real_escape_string($name)."' ".($password === 0 ? "" : "and password = '".mysql_real_escape_string($password)."'")." limit 1"); }
    */

    function LoadUser($name, $password = 0) { $user = $this->LoadSingle("select
        p.username as name
        ,p.user_password as password
        ,p.user_email as email
        ,p.user_regdate as signuptime
        ,w.revisioncount
        ,w.changescount
        ,w.doubleclickedit
        ,w.show_comments
        from "
.phpbb_."users p
        left join "
. $this->config['table_prefix'] . "users w ON p.username = w.name
        where p.username = '"
.mysql_real_escape_string($name)."' ".($password === 0 ? "" : "and p.user_password = '".mysql_real_escape_string($password)."'")." limit 1");
        if (isset($user['signuptime'])) {
            $user['signuptime'] = date('Y-m-d H:i:s', $user['signuptime']);
        }
        return $user;
    }

    /**
    * PHPBB Integration
    *
    * function LoadUsers() { return $this->LoadAll("select * from ".$this->config['table_prefix']."users order by name"); }
    */

    function LoadUsers() { $users = $this->LoadAll("select
        p.username as name
        ,p.user_password as password
        ,p.user_email as email
        ,p.user_regdate as signuptime
        ,w.revisioncount
        ,w.changescount
        ,w.doubleclickedit
        ,w.show_comments
        from "
.phpbb_."users p
        left join "
. $this->config['table_prefix'] . "users w ON p.username = w.name
        order by username"
);
        foreach ($users as $key => $user) {
            if (isset($user['signuptime'])) {
                $user['signuptime'] = date('Y-m-d H:i:s', $user['signuptime']);
            }
            $users[$key] = $user;
        }
        return $users;
    }
default: input is valid
$this->Query('UPDATE '.$this->config['table_prefix'].'users SET '.
"email = '".mysql_real_escape_string($email)."', ".
"doubleclickedit = '".mysql_real_escape_string($doubleclickedit)."', ".
"show_comments = '".mysql_real_escape_string($show_comments)."', ".
"revisioncount = '".mysql_real_escape_string($revisioncount)."', ".
"changescount = '".mysql_real_escape_string($changescount)."' ".
"WHERE name = '".$user['name']."' LIMIT 1");
			default: // input is valid
				/**
				 * PHPBB Integration
				 *
				 * Insert the user into the Wakka users table
				 */
				$tmpUser = $this->LoadUser($user['name']);
				if (is_null($tmpUser['show_comments'])) {
					$this->Query("INSERT INTO ".$this->config['table_prefix']."users SET ".
						"signuptime = '".mysql_real_escape_string($user['signuptime'])."',".
						"name = '".mysql_real_escape_string($user['name'])."', ".
						"email = '".mysql_real_escape_string($user['email'])."'");
				}
				/**
				 * End PHPBB Integration
				 */
				$this->Query('UPDATE '.$this->config['table_prefix'].'users SET '.
					"email = '".mysql_real_escape_string($email)."', ".
					"doubleclickedit = '".mysql_real_escape_string($doubleclickedit)."', ".
					"show_comments = '".mysql_real_escape_string($show_comments)."', ".
					"revisioncount = '".mysql_real_escape_string($revisioncount)."', ".
					"changescount = '".mysql_real_escape_string($changescount)."' ".
					"WHERE name = '".$user['name']."' LIMIT 1");
$str = 'SELECT Count(*) AS cnt, `name` FROM ';
$str .= $this->config["table_prefix"] . 'users, ' ;
$str .= "WHERE `name` = `owner` AND `latest` = 'Y' GROUP BY name ORDER BY cnt DESC;";
	$str = 'SELECT Count(*) AS cnt, `username` AS name  FROM phpbb_users, ' ;
	$str .= "WHERE `username` = `owner` AND `latest` = 'Y' GROUP BY username ORDER BY cnt DESC;";
Configuration to disable UserRegistration is still required, either patch for 1.1.6.2 or update config setting in 1.1.6.3 (or later) see UserRegistration for more details.

PHPBB 2.0.x

If you want to force Wiki names in PHPBB logins (it will save pain later!)
/includes/functions_validate.php
Find (in function validate_username):
Don't allow " and ALT-255 in username.
if (strstr($username, '"') || strstr($username, '"') || strstr($username, chr(160)))
{
return array('error' => true, 'error_msg' => $lang['Username_invalid']);
return array('error' => false, 'error_msg' => );
	// Don't allow " and ALT-255 in username.
	if (strstr($username, '"') || strstr($username, '&quot;') || strstr($username, chr(160)))
	{
		return array('error' => true, 'error_msg' => $lang['Username_invalid']);
	/**
	 * Wikka Integration
	 * Wiki Username validation
	 */
	$include_path = get_include_path();
	set_include_path(get_include_path() . PATH_SEPARATOR . realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'));
	include_once('wikka.config.php');
	include_once('libs/Wakka.class.php');
	class WakkaPHPBBHack extends Wakka {
		function WakkaHack($config) {
			parent::Wakka($config);
			ob_start();
			include_once('actions/usersettings.php');
			ob_end_clean();
		}
	$wakka = new WakkaPHPBBHack($wakkaConfig);
	set_include_path($include_path);
	// Check for wiki names
	if (!$wakka->IsWikiName($username)) {
		return array('error' => true, 'error_msg' => preg_replace('`[#"]`', '', ERROR_WIKINAME));
	// Check for reserved pages in wiki
	if ($wakka->ExistsPage($username)) {
		return array('error' => true, 'error_msg' => ERROR_RESERVED_PAGENAME);
	/**
	 * End Wikka integration
	 */
	return array('error' => false, 'error_msg' => '');

 




Edited on 2006-11-20 09:40:44 by Jack063

Additions:
Please note that for suggested changes phpBB and wikka should use the same database - otherwise it is necessary to give rights to wikka's database to read phpBB's database - and to write name of phpBB's database before its tables.
function SetUser($user) { $_SESSION["user"] = $user; $this->SetPersistentCookie("user_name", $user["name"]); $this->SetPersistentCookie("pass", $user["password"]); }

function SetUser($user) { $_SESSION["user"] = $user; $this->SetPersistentCookie("user_name", $user["username"]); $this->SetPersistentCookie("pass", $user["user_password"]); }

echo "\t".'<option value="'.$this->htmlspecialchars_ent($user['name']).'">'.$user['name'].'</option>'."\n";

echo "\t".'<option value="'.$this->htmlspecialchars_ent($user['username']).'">'.$user['username'].'</option>'."\n";

case (md5($_POST['password']) != $existingUser['password']):

case (md5($_POST['password']) != $existingUser['user_password']):

<td>Hello, <?php echo $this->Link($user['name']) ?>!</td>

<td>Hello, <?php echo $this->Link($user['username']) ?>!</td>


Deletions:
function SetUser($user) { $_SESSION["user"] = $user; $this->SetPersistentCookie("wikka_user_name", $user["name"]); $this->SetPersistentCookie("wikka_pass", $user["password"]); }

function SetUser($user) { $_SESSION["user"] = $user; $this->SetPersistentCookie("wikka_user_name", $user["username"]); $this->SetPersistentCookie("wikka_pass", $user["user_password"]); }

print("<option value=\"".$this->htmlspecialchars_ent($user["name"])."\">".$user["name"]."</option>\n");

print("<option value=\"".$this->htmlspecialchars_ent($user["username"])."\">".$user["username"]."</option>\n");

check password
if ($existingUser["password"]
md5($_POST["password"]))
 			// check password
			if ($existingUser["user_password"] == md5($_POST["password"]))
<td>Hello, <?php echo $this->Link($user["name"]) ?>!</td>
			<td>Hello, <?php echo $this->Link($user["username"]) ?>!</td>




Edited on 2006-06-23 14:08:52 by YodaHome

Additions:
/Wikka.php (in Wikka 1.1.6.2 its /libs/Wakka.class.php)


Deletions:
/Wikka.php




Edited on 2005-07-29 15:37:38 by EniBevoli [Missed to include acls.php in the list of files to change]

Additions:
  • handlers/page/acls.php




Edited on 2005-07-29 15:35:28 by EniBevoli

Additions:

Wikka Wiki and phpBB: using phpBB user information and allow Wikka-specific user settings

Added on July 29, 2005 by EniBevoli
I still have to make a easily readable diff output (such as "Find" - "Replace with" above; I already translated some text strings to German, so diff'ing is currently a mess) so that other users can edit their own files, but since I have finally come to a solution outlined below, I thought it would be a beneficial for others to simply post my results right away. The existing work on the Wikka Wiki / phpBB integration was a big starting point; without this information, I wouldn't even had a clue what to do. :)
Features / How it works:
  • Wikka uses phhBB for user logins, i.e. name and password of users are authenticated against the phpBB database
  • Users can configure some Wikka-specific settings via the User Settings page (for some settings, there is no point in changing them at the User Settings page; e.g., the email or the password field: the user should change this in his phpBB profile)
  • Whenever an existing phpBB user logs into Wikka, a Wikka user with the same name is created - if it does not already exist - for storing Wikka-specific settings (such as show_comments) as there is no counterpart for such settings in phpBB (and I don't want to alter the phpBB table structure)
Requirements:
- After the integration of Wikka Wiki and phpBB is done, user registration via Wikka Wiki must be disabled, new accounts should only be added via phpBB; see UserRegistration for more information about how to disable user registration
It took me quite some time to figure out why turning off "double click edit" didn't work - it is a bug with Wikka Wiki 1.1.6.0. :) I don't include the bug fix here, since it is already outlined in WikkaBugs.
Changed files:
  • wikka.php
  • actions/usersettings.php
  • actions/highscore.php
  • handlers/page/show.php (to fix the double click edit bug)
As I said, I'm still compiling the changes in an easily readable format and will update this page when I'm done.
To Do / Questions / Open Issues:
  • phpBB users with non-camelcase usernames (e.g., "John") seem to work flawlessly on my installation even though I expected problems; any comments from the developers?
  • I am quite sure that the code quality is...ahm..."suboptimal". I basically tried to get it to work in the first place (I downloaded WikkaWiki today for the first time), so please don't flame me; instead, help to fix it!




Edited on 2005-07-29 12:16:01 by EniBevoli [fix to show the name of the user again in the User Settings page]

Additions:
added by EniBevoli - fix to show the name of the user again in the User Settings page
<td>Hello, <?php echo $this->Link($user["name"]) ?>!</td>
			<td>Hello, <?php echo $this->Link($user["username"]) ?>!</td>




Edited on 2005-07-24 17:12:23 by DarTar [adding seealso box]

Additions:
See also:
 
$i;
$str = '<tr>';
$str .= "<td>$i.  </td>";
$str .= '<td>'. $this->Format( $row["username"] ) .'</td>';
$str .= '<td> </td>';
$str .= '<td>    </td>';
$str .= '<td>'.$row["cnt"].'</td>';
$str .= '<td>    </td>';
$str .= '<td>'. round( ($row["cnt"]/$total)*100, 2).'% </td>';
$str .= '</tr>';
print( $str );


Deletions:
$i;
$str = '<tr>';
$str .= "<td>$i.  </td>";
$str .= '<td>'. $this->Format( $row["username"] ) .'</td>';
$str .= '<td> </td>';
$str .= '<td>    </td>';
$str .= '<td>'.$row["cnt"].'</td>';
$str .= '<td>    </td>';
$str .= '<td>'. round( ($row["cnt"]/$total)*100, 2).'% </td>';
$str .= '</tr>';
print( $str );




Edited on 2005-05-22 03:59:15 by KiltanneN

Additions:
I changed several things in the highscores.php code. Mostly they were changing the "name" to "username" but there was also the table prefix thing that had to be fixed up. Here's the full code:
/actions/highscores.php
<?php
# highscores.php
1.  DarTar    186    11.76%
2.  JavaWoman    103    6.51%
3.  NilsLindenberg    80    5.06%
4.  JsnX    58    3.67%
5.  BrianKoontz    46    2.91%
6.  PivWan    35    2.21%
7.  YanB    32    2.02%
8.  ChristianBarthelemy    30    1.9%
9.  GmBowen    29    1.83%
10.  DotMG    19    1.2%
11.  DomBonj    17    1.07%
12.  OnegWR    14    0.88%
13.  DennyShimkoski    13    0.82%
14.  MasinAlDujaili    12    0.76%
15.  DreckFehler    11    0.7%
16.  DanWest    9    0.57%
17.  JasonHuebel    8    0.51%
18.  NickDamoulakis    7    0.44%
19.  IntElf    7    0.44%
20.  CimNine    7    0.44%
21.  YodaHome    6    0.38%
22.  MarkHissinkMuller    6    0.38%
23.  GeorgePetsagourakis    5    0.32%
24.  RenatoSabbatini    5    0.32%
25.  TimoK    5    0.32%
26.  KlenWell    5    0.32%
27.  AdSamweis    5    0.32%
28.  Pierre79    4    0.25%
29.  DavePreston    4    0.25%
30.  YvesFischer    4    0.25%
31.  MonstoBrukes    4    0.25%
32.  RichardTerry    4    0.25%
33.  AndreaRossato    4    0.25%
34.  MiKolar    4    0.25%
35.  SamuelDr    4    0.25%
36.  GiorgosKontopoulos    4    0.25%
37.  PaulBelgian    3    0.19%
38.  RolandStens    3    0.19%
39.  OtTo    3    0.19%
40.  GregorLindner    3    0.19%
41.  OlivierBorowski    3    0.19%
42.  YuisHope    3    0.19%
43.  BarkerJr    3    0.19%
44.  FishPete    3    0.19%
45.  MariHedbom    3    0.19%
46.  AixosUser    3    0.19%
47.  KenFairclough    3    0.19%
48.  WikiSpit    3    0.19%
49.  FrankChestnut    3    0.19%
50.  DaC    3    0.19%
51.  TormodHaugen    3    0.19%
52.  RomanIvanov    3    0.19%
53.  KrzysztofTrybowski    3    0.19%
54.  EltharielHdh    3    0.19%
55.  AleOkada    3    0.19%
56.  IanAndolina    3    0.19%
57.  RichardMartinNielsen    3    0.19%
58.  ChiWaWa    3    0.19%
59.  JavierWilson    2    0.13%
60.  DigitalNomad    2    0.13%
61.  KoG    2    0.13%
62.  LaurentBurgbacher    2    0.13%
63.  ThomasSalomon    2    0.13%
64.  PieDeAtleta    2    0.13%
65.  PolVazo    2    0.13%
66.  RobertLeckie    2    0.13%
67.  SpifFin    2    0.13%
68.  RichardBerg    2    0.13%
69.  FreekNL    2    0.13%
70.  WigAnt    2    0.13%
71.  SparkOut    2    0.13%
72.  HenkDaalder    2    0.13%
73.  DavidReisner    2    0.13%
74.  ZaiTon    2    0.13%
75.  DewJoy    2    0.13%
76.  PooPer    2    0.13%
77.  SpectreMoo    2    0.13%
78.  XyzzyB    2    0.13%
79.  TestWikiUser    2    0.13%
80.  AnthonyPetrillo    2    0.13%
81.  SuFu    2    0.13%
82.  CaryCollett    2    0.13%
83.  ChewBakka    2    0.13%
84.  MreimeR    2    0.13%
85.  KyAnh    2    0.13%
86.  SdfdsfaSdasd    2    0.13%
87.  FernandoBorcel    2    0.13%
88.  MovieLady    2    0.13%
89.  PgpTag    2    0.13%
90.  CyneBeald    2    0.13%
91.  AdaAn    2    0.13%
92.  StevenTan    2    0.13%
93.  HillarAarelaid    2    0.13%
94.  DavidCollantes    2    0.13%
95.  KarmaTester    2    0.13%
96.  JordaPolo    2    0.13%
97.  ChuckPheatt    2    0.13%
98.  TomEk    2    0.13%
99.  RyeBread    2    0.13%
100.  SteveB    2    0.13%
101.  AdminUser    2    0.13%
102.  AndreasTengicki    2    0.13%
103.  MytWm    2    0.13%
104.  AdamCrews    2    0.13%
105.  PedroM    2    0.13%
106.  FrankK    2    0.13%
107.  QuetzalRieur    2    0.13%
108.  BoinkFella    2    0.13%
109.  PradeepKishoreGowda    2    0.13%
110.  DbieL    2    0.13%
111.  RaffaR    2    0.13%
112.  FilippL    2    0.13%
113.  JfDelesse    2    0.13%
114.  SalwaH    2    0.13%
115.  MyTreo    2    0.13%
116.  EmeraldIsland    2    0.13%
117.  JeffWhite    2    0.13%
118.  CrystalHawk    2    0.13%
119.  RedFoot    2    0.13%
120.  KenBeyond    2    0.13%
121.  TestTest    2    0.13%
122.  IanHayhurst    2    0.13%
123.  BulletCard    2    0.13%
124.  BenMatt    2    0.13%
125.  SmaugDragon    2    0.13%
126.  GerdAmi    2    0.13%
127.  SamClayton    2    0.13%
128.  WazoO    2    0.13%
129.  KiltanneN    2    0.13%
130.  DocXoc    2    0.13%
131.  WikiOm    2    0.13%
132.  RubenOlsen    2    0.13%
133.  IamBack    1    0.06%
134.  RobertDaeley    1    0.06%
135.  WulfgaR    1    0.06%
136.  WikiJakob    1    0.06%
137.  AnsFans    1    0.06%
138.  TpH    1    0.06%
139.  DrahtKnäuel    1    0.06%
140.  RichardGagnon    1    0.06%
141.  PascalHendrikx    1    0.06%
142.  SlavaBarbash    1    0.06%
143.  VerbunRo    1    0.06%
144.  WikiStalin    1    0.06%
145.  AlessandroRonchi    1    0.06%
146.  MtGoat    1    0.06%
147.  NiallB    1    0.06%
148.  FabriceFrassaint    1    0.06%
149.  MeiJianFang    1    0.06%
150.  CyClope    1    0.06%
151.  ShoTanaka    1    0.06%
152.  YvesMettler    1    0.06%
153.  LordofHaha    1    0.06%
154.  CharlesQin    1    0.06%
155.  WikiHelrub    1    0.06%
156.  RuudMekkes    1    0.06%
157.  BeleBele    1    0.06%
158.  SiddharthUpmanyu    1    0.06%
159.  LiaoCh    1    0.06%
160.  EnejMe    1    0.06%
161.  GoNorvin    1    0.06%
162.  RajkoAlbrecht    1    0.06%
163.  CsillagKristof    1    0.06%
164.  AlainPluquet    1    0.06%
165.  WolfgangWitt    1    0.06%
166.  RobertLender    1    0.06%
167.  TromboneFreakus    1    0.06%
168.  HansCheng    1    0.06%
169.  MirRodriguez    1    0.06%
170.  JeJeOfLoVe    1    0.06%
171.  MvKozyrev    1    0.06%
172.  HansEric    1    0.06%
173.  NiehLe    1    0.06%
174.  ThoMas    1    0.06%
175.  AlBux    1    0.06%
176.  TestPik    1    0.06%
177.  CatIvan    1    0.06%
178.  AlexJarvis    1    0.06%
179.  MikeShaffer    1    0.06%
180.  Nick1    1    0.06%
181.  RobertoG    1    0.06%
182.