Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Problems with XP publish & PunBB bridge  (Read 2395 times)

0 Members and 1 Guest are viewing this topic.

Laffo

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Problems with XP publish & PunBB bridge
« 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:
Code: [Select]
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;
}
« Last Edit: July 19, 2006, 03:35:49 pm by Laffo »
Logged

Nibbler

  • Guest
Re: Problems with XP publish & PunBB bridge
« Reply #1 on: July 19, 2006, 04:06:33 pm »

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

Laffo

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Problems with XP publish & PunBB bridge
« Reply #2 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!
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Problems with XP publish & PunBB bridge
« Reply #3 on: July 19, 2006, 04:57:24 pm »

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

Nibbler

  • Guest
Re: Problems with XP publish & PunBB bridge
« Reply #4 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.
Logged
Pages: [1]   Go Up
 

Page created in 0.016 seconds with 15 queries.