Cannot Login Cannot Login
 

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

Cannot Login

Started by windwind, October 30, 2003, 10:48:04 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

windwind

I have integrated the Coppermine gallery into PHPBB (sharing the user DB). It was working fine and users are able to login and upload photos.

However, users cannot login to Coppermine (even admin) after they logged in from PHPBB. i did not change the setting of PHPBB cookie or anything in control panel. It just doesn't work suddenly. Can you please help?

PHPBB: http://www.hktennisclub.com/forum
Gallery: http://www.hktennisclub.com/gallery

Login: test
Password: test

Mahalo!!

Joachim Müller

I can confirm that it doesn't work. Could you post the first part of your bridge file and a screenshot of your config (the part around the cookie at the bottom?). Your page is loading awfully slow. Are you self-hosted?

GauGau

windwind

Thanks so much for helping!

Can you tell me which files i should looked at? inlcude/config.inc.php and bridge/phpbb.inc.php?

the reason of the slow loading probably becuase it's hosted at Hong Kong ISP  :wink:  :wink:

Joachim Müller

yeah, bridge/phpbb.inc.php is the right bridge file, but I didn't mean the config file, but the config settings (that are actually stored in the database). Just make a screenshot when you're logged in as admin and view the "config" (admin menu!).
It seems like my ISP has problems with asian sites in general - sometimes, there's even no dns resolution to big asian sites, so you're probably not to blame for the slow page load...

GauGau

windwind

Quote// database configuration
define('PHPBB_DB_NAME', 'tennis'); // The name of the database used by the board
define('PHPBB_BD_HOST', 'localhost'); // The name of the database server
define('PHPBB_DB_USERNAME', 'tennis'); // The username to use to connect to the database
define('PHPBB_DB_PASSWORD', 'tennis'); // The password to use to connect to the database

// The web path to your phpBB directory
// In this example http://yoursite_name.com/phpBB2/
define('PHPBB_WEB_PATH', '/forum/');
// ------------------------------------------------------------------------- //
// You can keep the default values below if your instalation is standard
// ------------------------------------------------------------------------- //
// The prefix for the phpBB cookies
define('PHPBB_COOKIE_PREFIX', 'phpbb2mysql'); // The prefix used for board cookies

// Prefix and names for the database tables
define('PHPBB_TABLE_PREFIX', 'phpbb_'); // The prefix used for the DB tables
define('PHPBB_USER_TABLE', 'users'); // The members table
define('PHPBB_SESSION_TABLE', 'sessions'); // The session table
define('PHPBB_GROUP_TABLE', 'groups'); // The groups table
define('PHPBB_UGROUP_TABLE', 'user_group'); // The group/user table

// ------------------------------------------------------------------------- //
// Nothing to edit below this line
// ------------------------------------------------------------------------- //
// Group definitions
define('PHPBB_ADMIN_GROUP', 1);
define('PHPBB_MEMBERS_GROUP', 2);
define('PHPBB_GUEST_GROUP', 3);
define('PHPBB_BANNED_GROUP', 4);
// Authenticate a user using cookies
function udb_authenticate()
{
    global $HTTP_COOKIE_VARS, $USER_DATA, $UDB_DB_LINK_ID, $UDB_DB_NAME_PREFIX, $CONFIG;
    // For error checking
    $CONFIG['TABLE_USERS'] = '**ERROR**';

    $default_group = array('group_id' => PHPBB_GUEST_GROUP,
        'group_name' => 'Unknown',
        'has_admin_access' => 0,
        'can_send_ecards' => 0,
        'can_rate_pictures' => 0,
        'can_post_comments' => 0,
        'can_upload_pictures' => 0,
        'can_create_albums' => 0,
        'pub_upl_need_approval' => 1,
        'priv_upl_need_approval' => 1,
        );
    // Retrieve cookie stored login information
    if (!isset($HTTP_COOKIE_VARS[PHPBB_COOKIE_PREFIX . '_data'])) {
        $cookie_uid = 0;
        $cookie_pass = '*';
    } else {
        $sessiondata = unserialize($HTTP_COOKIE_VARS[PHPBB_COOKIE_PREFIX . '_data']);
        if (is_array($sessiondata)) {
            $cookie_uid = (isset($sessiondata['userid'])) ? intval($sessiondata['userid']) : 0;
            $cookie_pass = (isset($sessiondata['autologinid'])) ? addslashes($sessiondata['autologinid']) : '*';
        } else {
            $cookie_uid = 0;
            $cookie_pass = '*';
        }
    }
    // If autologin was not selected, we need to use the sessions table
    if ($cookie_uid && !$cookie_pass && isset($HTTP_COOKIE_VARS[PHPBB_COOKIE_PREFIX . '_sid'])) {
        $session_id = addslashes($HTTP_COOKIE_VARS[PHPBB_COOKIE_PREFIX . '_sid']);

        $sql = "SELECT user_id, username as user_name, user_level " . "FROM " . $UDB_DB_NAME_PREFIX . PHPBB_TABLE_PREFIX . PHPBB_SESSION_TABLE . " " . "INNER JOIN " . $UDB_DB_NAME_PREFIX . PHPBB_TABLE_PREFIX . PHPBB_USER_TABLE . " ON session_user_id = user_id " . "WHERE session_id='$session_id' AND session_user_id ='$cookie_uid'";
    } else {
        $sql = "SELECT user_id, username as user_name, user_level " . "FROM " . $UDB_DB_NAME_PREFIX . PHPBB_TABLE_PREFIX . PHPBB_USER_TABLE . " " . "WHERE user_id='$cookie_uid' AND user_password='$cookie_pass'";
    }
    $result = db_query($sql, $UDB_DB_LINK_ID);

    if (mysql_num_rows($result)) {
        $USER_DATA = mysql_fetch_array($result);
        mysql_free_result($result);

        define('USER_ID', (int)$USER_DATA['user_id']);
        define('USER_NAME', $USER_DATA['user_name']);
        // Define the basic groups
        if ($USER_DATA['user_level'] == 1) {
            $user_group_set = PHPBB_ADMIN_GROUP . ',' . PHPBB_MEMBERS_GROUP . ',';
        } else {
            $user_group_set = PHPBB_MEMBERS_GROUP . ',';
        }
        // Retrieve the groups the user is a member of
        $sql = "SELECT (ug.group_id + 5) as group_id " . "FROM " . $UDB_DB_NAME_PREFIX . PHPBB_TABLE_PREFIX . PHPBB_UGROUP_TABLE . " as ug " . "LEFT JOIN " . $UDB_DB_NAME_PREFIX . PHPBB_TABLE_PREFIX . PHPBB_GROUP_TABLE . " as g ON ug.group_id = g.group_id " . "WHERE user_id = " . USER_ID . " AND user_pending = 0 AND group_single_user = 0";
        $result = db_query($sql);
        while ($row = mysql_fetch_array($result)) {
            $user_group_set .= $row['group_id'] . ',';
        }
        mysql_free_result($result);

        $user_group_set = '(' . substr($user_group_set, 0, -1) . ')';
        // Default group data
        $USER_DATA['group_quota'] = 1;
        $USER_DATA['can_rate_pictures'] = 0;
        $USER_DATA['can_send_ecards'] = 0;
        $USER_DATA['can_post_comments'] = 0;
        $USER_DATA['can_upload_pictures'] = 0;
        $USER_DATA['can_create_albums'] = 0;
        $USER_DATA['pub_upl_need_approval'] = 1;
        $USER_DATA['priv_upl_need_approval'] = 1;

        $sql = "SELECT  group_quota as gq, " . "                can_rate_pictures as crp, " . "                can_send_ecards as cse, " . "                can_post_comments as cpc, " . "                can_upload_pictures as cup, " . "                can_create_albums as cca, " . "                pub_upl_need_approval as puna, " . "                priv_upl_need_approval as pruna " . "FROM {$CONFIG['TABLE_USERGROUPS']} " . "WHERE group_id IN " . $user_group_set;
        $result = db_query($sql);

Please take a look!  and i got no way to login as a admin in coppermine. however, i found out the config in database are default setting. how come? should i run install.php again?

Joachim Müller

OK, here's what I want you to do:
  • temporarily remove the integration of coppermine and phpbb: edit /include/init.inc.php and comment out the line define('UDB_INTEGRATION', 'phpbb');by putting to slashes in front of it. Save and upload.
  • login to coppermine and check if everything is working
  • make the screenshot I asked you to make
  • uncomment the line in init.inc.php again and re.upload
  • edit /bridge/phpbb.inc.php and modify the phpbb_web_path constant as shown in the example from// The web path to your phpBB directory [/li][/list]
    // In this example http://yoursite_name.com/phpBB2/
    define('PHPBB_WEB_PATH', '/forum/');
    to// The web path to your phpBB directory
    // In this example http://yoursite_name.com/phpBB2/
    define('PHPBB_WEB_PATH', 'http://www.hktennisclub.com/forum/');
    and upload it.
  • delete all cookies
  • log into your forum
  • go to your coppermine folder and force-refresh ([Shift]+[f5])
  • report if this helped fixing the situation
  • if it doesn't fix it, go to your forum config and check the cookie name. Are you really using "phpbb2mysql"? If not, edit /bridge/phpbb.inc.php once more and change // The prefix for the phpBB cookies [/li][/list]
    define('PHPBB_COOKIE_PREFIX', 'phpbb2mysql'); // The prefix used for board cookies
    accordingly
  • log out of your forum, delete all cookies again, log in and try once again[/list:u]
    GauGau

windwind

the setting of the config is (in PHPMYADMIN)



album_list_cols        2
display_pic_info        0
alb_list_thumb_size        30
allowed_file_extensions        GIF/PNG/JPG/JPEG/TIF/TIFF
allowed_img_types        JPG/GIF/PNG/TIFF
allow_private_albums        1
allow_user_registration        0
allow_duplicate_emails_addr        0
caption_in_thumbview        1
charset        language file
cookie_name        phpbb2mysql
cookie_path        /
debug_mode        0
default_dir_mode        0777
default_file_mode        0666
default_sort_order        na
ecards_more_pic_target        http://www.hktennisclub.com/gallery/
enable_smilies        1
filter_bad_words        0
forbiden_fname_char        $/\\:*?"'<>|`
fullpath        albums/
gallery_admin_email        webmaster@hktennisclub.com
gallery_description        Our online photo album
gallery_name        Photo Gallery
im_options        -antialias
impath        
jpeg_qual        80
keep_votes_time        30
lang        english
main_page_layout        breadcrumb/catlist/alblist/random,4
main_table_width        100%
make_intermediate        1
max_com_lines        10
max_com_size        512
max_com_wlength        38
max_img_desc_length        512
max_tabs        12
max_upl_size        1024
max_upl_width_height        2048
min_votes_for_rating        1
normal_pfx        normal_
picture_table_width        600
picture_width        400
randpos_interval        1067585524
read_exif_data        0
reg_requires_valid_email        0
subcat_level        2
theme        hardwired
thumbcols        4
thumbrows        4
thumb_method        im
thumb_pfx        thumb_
thumb_width        100
userpics        userpics/


windwind

I have tried different cookie config

cookie name: phpbb2mysql
cookie path: /

but it still doesn't work. please help!

thanks so much!

Joachim Müller

use a differnt cookie name in coppermine config!

GauGau