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: phpBB2 Integration  (Read 4181 times)

0 Members and 1 Guest are viewing this topic.

nautilussoftware

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
phpBB2 Integration
« on: January 17, 2007, 05:11:20 pm »


I am running phpBB 2.0.22 and have coppermine integrated in. everything is working very well. However I would like to also show that the user of phpBB forum has gone to view the coppermine part of the site. that has to be done with adding phpbb sessions to the coppermine pages.

So I need to know if anyone has done that, and how do you do it having the defined('COPPERMINE', true); at the top of the scripts. PhpBB2 want's it's own there, defining PHPBB at the top.

Do you have an example of that. Also in asking in their forums they say you should append the SSID to the end of the URL to link over for security purposes. So there is a function for that. So I need to be able to include their sessions code in the cpg main Index.php page at minimum in a way that does not break cpg 1.4.10

thanks
-peter
« Last Edit: January 18, 2007, 12:34:26 pm by Nibbler »
Logged

Nibbler

  • Guest
Re: phpBB2 Integration
« Reply #1 on: January 17, 2007, 06:50:59 pm »

You should be able to modify the session_extraction() function to do this in bridge/phpbb2018.inc.php. Replace the function with this one:

Code: [Select]
function session_extraction()
{
if (isset($_COOKIE[$this->cookie_name . '_sid'])) {
$this->sid = addslashes($_COOKIE[$this->cookie_name . '_sid']);

$sql = "SELECT u.{$this->field['user_id']} AS user_id, u.{$this->field['password']} AS password, u.user_level FROM {$this->usertable} AS u, {$this->sessionstable} AS s WHERE u.{$this->field['user_id']}=s.session_user_id AND s.session_id = '{$this->sid}' AND u.user_id > 0";
$result = cpg_db_query($sql, $this->link_id);

if (mysql_num_rows($result)){

// Update page in sessions table
$sql = "UPDATE {$this->sessionstable} SET session_page = -123, session_time = UNIX_TIMESTAMP() WHERE session_id = '{$this->sid}'";
cpg_db_query($sql, $this->link_id);

$row = mysql_fetch_array($result);
$this->userlevel = $row['user_level'];
return $row;
} else {
    return false;
}
}
}

You would need to interpret the -123 (or whatever number you choose) as being 'gallery' in phpbb by adding a new case into the switch statement in viewonline.php

For example

Code: [Select]
case -123:
$location = 'Viewing the gallery';
$location_url = "../gallery/";
break;

Whenever you cross-post to another support board, please post a link to your other thread.
« Last Edit: January 18, 2007, 12:29:57 am by Nibbler »
Logged

Gephri

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 235
Re: phpBB2 Integration
« Reply #2 on: January 18, 2007, 12:24:45 am »

has anyone gotten this to work? For me, it just creates a blank page that says:
Fatal error :<br />

and not even a php error page.
I'm running cpg1.4.10 and the latest stable release of phpbb
Logged

Nibbler

  • Guest
Re: phpBB2 Integration
« Reply #3 on: January 18, 2007, 12:30:46 am »

Typo, sorry. I'm not able to test the code so I just typed it straight into the post. Corrected now.
Logged

nautilussoftware

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: phpBB2 Integration
« Reply #4 on: January 18, 2007, 02:35:27 am »

You should be able to modify the session_extraction() function to do this in bridge/phpbb2018.inc.php. Replace the function with this one:

Code: [Select]
function session_extraction()
{
if (isset($_COOKIE[$this->cookie_name . '_sid'])) {
$this->sid = addslashes($_COOKIE[$this->cookie_name . '_sid']);

$sql = "SELECT u.{$this->field['user_id']} AS user_id, u.{$this->field['password']} AS password, u.user_level FROM {$this->usertable} AS u, {$this->sessionstable} AS s WHERE u.{$this->field['user_id']}=s.session_user_id AND s.session_id = '{$this->sid}' AND u.user_id > 0";
$result = cpg_db_query($sql, $this->link_id);

if (mysql_num_rows($result)){

// Update page in sessions table
$sql = "UPDATE {$this->sessionstable} SET session_page = -123, session_time = UNIX_TIMESTAMP() WHERE session_id = '{$this->sid}'";
cpg_db_query($sql, $this->link_id);

$row = mysql_fetch_array($result);
$this->userlevel = $row['user_level'];
return $row;
} else {
    return false;
}
}
}

You would need to interpret the -123 (or whatever number you choose) as being 'gallery' in phpbb by adding a new case into the switch statement in viewonline.php

For example

Code: [Select]
case -123:
$location = 'Viewing the gallery';
$location_url = "../gallery/";
break;

Whenever you cross-post to another support board, please post a link to your other thread.



Awesome!! thanks a bunch.
I dropped it in. now to see if it works. What if I want to see if people are viewing different categories?
like c=1 or c=2?

-pete
Logged

Gephri

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 235
Re: phpBB2 Integration
« Reply #5 on: January 18, 2007, 11:05:36 am »

Thanks - smooth as silk!
Logged
Pages: [1]   Go Up
 

Page created in 0.014 seconds with 16 queries.