Guest $USER_DATA array not loading with Bridge Guest $USER_DATA array not loading with Bridge
 

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

Guest $USER_DATA array not loading with Bridge

Started by the_todd, July 07, 2005, 11:59:12 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

the_todd

1.4.1 integrated with Invision 2.0.4 is not loading the $USER_DATA array for the guest user group, but works with the others. I've been looking in the bridge files for hours but haven't seen anything.

USER:
------------------
Array
(
    [ID] => d65ca61f3117f31923d905ad6793c38c
    [am] => 1
    [lang] => english
    [liv] => Array
        (
            [0] => 25
            [1] => 2
            [2] => 87
        )

)

==========================
USER DATA:
------------------
Array
(
    [user_id] => 0
    [user_name] => Guest
    [groups] => Array
        (
            [0] => 2
        )

    [group_quota] => 0
    [can_rate_pictures] =>
    [can_send_ecards] =>
    [can_post_comments] =>
    [can_upload_pictures] =>
    [can_create_albums] => 0
    [pub_upl_need_approval] =>
    [priv_upl_need_approval] =>
    [upload_form_config] =>
    [num_file_upload] =>
    [num_URI_upload] =>
    [custom_user_upload] =>
    [disk_max] =>
    [disk_min] =>
    [ufc_max] =>
    [ufc_min] =>
    [has_admin_access] => 0
    [group_name] =>
    [can_see_all_albums] => 0
    [group_id] => 2
    [testing] => true
)

==========================
Queries:
------------------
Array
(
    [0] => SELECT extension, mime, content, player FROM cpg140_filetypes; (0.007s)
    [1] => select * from cpg140_plugins order by priority asc; (0s)
    [2] => SELECT * FROM cpg140_bridge (0.008s)
    [3] => SELECT MAX(group_quota) as disk_max, MIN(group_quota) as disk_min, MAX(can_rate_pictures) as can_rate_pictures, MAX(can_send_ecards) as can_send_ecards, MAX(upload_form_config) as ufc_max, MIN(upload_form_config) as ufc_min, MAX(custom_user_upload) as custom_user_upload, MAX(num_file_upload) as num_file_upload, MAX(num_URI_upload) as num_URI_upload, MAX(can_post_comments) as can_post_comments, MAX(can_upload_pictures) as can_upload_pictures, MAX(can_create_albums) as can_create_albums, MAX(has_admin_access) as has_admin_access, MIN(pub_upl_need_approval) as pub_upl_need_approval, MIN( priv_upl_need_approval) as  priv_upl_need_approval FROM cpg140_usergroups WHERE group_id = (2) (0s)
    [4] => SELECT group_name FROM  cpg140_usergroups WHERE group_id= 2 (0s)
    [5] => SHOW TABLES LIKE 'cpg140_cms_config' (0.001s)
    [6] => SELECT * FROM cpg140_cms_config (0s)
    [7] => DELETE FROM cpg140_banned WHERE expiry < '2005-07-07 09:46:22' (0s)
    [8] => SELECT * FROM cpg140_banned WHERE (ip_addr='64.139.237.98' OR ip_addr='64.139.237.98' OR user_id=0) AND brute_force=0 (0s)
    [9] => SELECT aid FROM cpg140_albums WHERE visibility != '0' AND visibility !='10000' AND visibility NOT IN (2) (0s)
    [10] => SELECT aid FROM cpg140_albums WHERE category = 0 (0s)
    [11] => SELECT cid FROM cpg140_categories WHERE parent = '0' (0s)
    [12] => SELECT aid FROM cpg140_albums as a WHERE category>=10000 (0s)
    [13] => SELECT cid FROM cpg140_categories WHERE parent = '1' (0s)
    [14] => SELECT cid, name, description, thumb FROM cpg140_categories WHERE parent = ''  ORDER BY pos (0s)
    [15] => SELECT aid FROM cpg140_albums as a WHERE category>=10000 (0s)
    [16] => SELECT count(*) FROM cpg140_pictures as p, cpg140_albums as a WHERE p.aid = a.aid AND category >= 10000 (0s)
    [17] => SELECT cid, name, description, thumb FROM cpg140_categories WHERE parent = '1'  ORDER BY pos (0s)
    [18] => SELECT aid FROM cpg140_albums as a WHERE category = '0' (0s)
    [19] => SELECT count(*) FROM cpg140_albums as a WHERE 1 (0s)
    [20] => SELECT count(*) FROM cpg140_pictures as p LEFT JOIN cpg140_albums as a ON a.aid=p.aid WHERE 1 (0s)
    [21] => SELECT count(*) FROM cpg140_comments as c LEFT JOIN cpg140_pictures as p ON c.pid=p.pid LEFT JOIN cpg140_albums as a ON a.aid=p.aid WHERE 1 (0s)
    [22] => SELECT count(*) FROM cpg140_categories WHERE 1 (0s)
    [23] => SELECT sum(hits) FROM cpg140_pictures as p LEFT JOIN cpg140_albums as a ON p.aid=a.aid WHERE 1 (0s)
    [24] => SELECT COUNT(*) FROM cpg140_pictures WHERE approved = 'NO' (0.006s)
    [25] => SELECT * FROM cpg140_cms WHERE conid='0' AND type='0' ORDER BY cpos (0.006s)
    [26] => SELECT count(*) FROM cpg140_albums as a WHERE category = '0' (0s)
    [27] => SELECT COUNT(*) from cpg140_pictures WHERE approved = 'YES' AND aid IN (1)  (0.004s)
    [28] => SELECT * FROM cpg140_pictures WHERE approved = 'YES' AND aid IN (1)  ORDER BY RAND() LIMIT 8 (0.002s)
    [29] => SELECT COUNT(*) from cpg140_pictures WHERE approved = 'YES' AND aid IN (1)  (0.007s)
    [30] => SELECT * FROM cpg140_pictures WHERE approved = 'YES' AND aid IN (1)  ORDER BY pid DESC  LIMIT 0 ,8 (0.001s)
)

==========================
GET :
------------------
Array
(
)

==========================
POST :
------------------
Array
(
)

==========================
Page generated in 0.232 seconds - 31 queries in 0.042 seconds - Album set : ; Meta set: AND aid IN (1) ;

Nibbler

It can do that if it can't find your group in the groups table. Can you check if there is an entry for group 2 in your cpg_usegroups table ? Try re-syncing the groups by navigating to the groups page.

the_todd

I found the fix for this problem, just had to get some sleep and found the problem first thing in the morning.

In the debug info posted above notice the group is 2, instead it should be 102 when integrated, because cpg is using board group number + 100, but the load_guest_data function is not adding 100 like the authenticate function in udb_base.inc.php .

The fix is as follows:
udb_base.inc.php
~Line 127

$USER_DATA['groups'][0] = $this->use_post_based_groups ? ($this->guestgroup) : 3;
should be changed to:
$USER_DATA['groups'][0] = $this->use_post_based_groups ? ($this->guestgroup) + 100 : 3;

Regards,
The_Todd

Nibbler

Can you try this fix instead in the Invision bridge file, change

$this->guestgroup = $this->use_post_based_groups ? $INFO['guest_group'] : 3;

to

$this->guestgroup = $this->use_post_based_groups ? $INFO['guest_group']+100 : 3;

and see if that also works.

the_todd

Quote from: Nibbler on July 08, 2005, 12:43:47 AM
Can you try this fix instead in the Invision bridge file, change

$this->guestgroup = $this->use_post_based_groups ? $INFO['guest_group'] : 3;

to

$this->guestgroup = $this->use_post_based_groups ? $INFO['guest_group']+100 : 3;

and see if that also works.

Yes, that works as well, and probably a better way to go about it.

Nibbler

Great, commited invisionboard20.inc.php v1.8 to devel cvs.

the_todd