phpBB2 Integration phpBB2 Integration
 

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]

Main Menu

phpBB2 Integration

Started by nautilussoftware, January 17, 2007, 05:11:20 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nautilussoftware


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

Nibbler

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


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


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.

Gephri

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

Nibbler

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

nautilussoftware

Quote from: Nibbler 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:


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


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

Gephri