Problems with XP publish & PunBB bridge Problems with XP publish & PunBB bridge
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Problems with XP publish & PunBB bridge

Started by Laffo, July 19, 2006, 03:23:39 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Laffo

I have my gallery bridged with PunBB, and everything else works other than this.

Originally, When I try to login with the XP wizzard, I kept getting login errors. So I took a gander at the code, and deduced this was happening because CPG wasn't hashing the password properly.

So I edited the punbb bridge file, wrote a new login() function which did the hashes the same as PunBB. My new code detects wrong user name and password correctly, but when the correct username and password is used, I just get directed back to the login page ?!

This is the function I wrote:
function login($username = null, $password = null, $remember = false)
{

if (function_exists('sha1')) // Only in PHP 4.3.0+
$pw = sha1($password);
else if (function_exists('mhash')) // Only if Mhash library is loaded
$pw = bin2hex(mhash(MHASH_SHA1, $password));
else
$pw = md5($password);

// Check for user in users table
$sql = 'SELECT id, group_id, password, save_pass FROM '.$this->db['prefix'].'users '.
'WHERE username=\''.mysql_escape_string($username).'\'';
echo $sql;

$result = cpg_db_query($sql);
if(mysql_num_rows($result) == 0)
{
echo "No Rows";
return false;
}

$row = mysql_fetch_assoc($result);

if($row['password'] != $pw)
{
echo "Password not equal: $pw != $db_password_hash";
return false;
}

$USER_DATA['user_id'] = $row['id'];
$USER_DATA['user_name'] = $username;

return $USER_DATA;
}

Nibbler

Don't login via the publisher, login with IE and then use the publisher.

Laffo

Ahhh, that wasn't working before I wrote my own login(), but now it is!

Any Idea why login through the xp publish doesn't work?

thanks!

Joachim Müller

Ask Microsoft, it's them who created the Publisher.

Nibbler

When you login that way you authenticate yourself with Coppermine via the bridge. This works for that page but further pages expect to authenticate from a punbb cookie which doesn't get set since you don't actually login via punbb during the process.