coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 upload => Topic started by: Laffo on July 19, 2006, 03:23:39 PM

Title: Problems with XP publish & PunBB bridge
Post by: Laffo on July 19, 2006, 03:23:39 PM
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;
}
Title: Re: Problems with XP publish & PunBB bridge
Post by: Nibbler on July 19, 2006, 04:06:33 PM
Don't login via the publisher, login with IE and then use the publisher.
Title: Re: Problems with XP publish & PunBB bridge
Post by: Laffo on July 19, 2006, 04:31:14 PM
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!
Title: Re: Problems with XP publish & PunBB bridge
Post by: Joachim Müller on July 19, 2006, 04:57:24 PM
Ask Microsoft, it's them who created the Publisher.
Title: Re: Problems with XP publish & PunBB bridge
Post by: Nibbler on July 19, 2006, 06:07:09 PM
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.