Appending session id (sid) to custom link

This is an archive of the phpBB 2.0.x support forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
Locked
LVZ
Registered User
Posts: 27
Joined: Fri Apr 30, 2004 7:35 pm
Location: Las Vegas
Contact:

Appending session id (sid) to custom link

Post by LVZ »

Reference: http://lvshopnet.com and (frame) http://myLVN.com

I added a few new links to my ezPortal main page. However, if the user logs in and clicks on the specific links below, the logged in user info (session id) is lost:

http://mylvn.com/forums/search.php?search_id=egosearch

http://mylvn.com/forums/portal_2.php

What's the easiest way to append the ?{ X_Session_ID } to prevent this problem?
LVZ
Registered User
Posts: 27
Joined: Fri Apr 30, 2004 7:35 pm
Location: Las Vegas
Contact:

Post by LVZ »

Hmm, surely someone knows the answer or should this query be in another forum?
bdreyer
Registered User
Posts: 443
Joined: Fri Nov 19, 2004 10:30 pm
Location: Bothell, WA
Contact:

Post by bdreyer »

That kind of depends on how you are actually calling the link... phpbb includes a function called append_sid(), you put the url in the append_sid brackets

Code: Select all

append_sid('http://www.mylink.com');
Look in functions.php for details on how it works (I think).

I'm pretty sure it requires the http, but not positive
LVZ
Registered User
Posts: 27
Joined: Fri Apr 30, 2004 7:35 pm
Location: Las Vegas
Contact:

Post by LVZ »

I expected it should be easy. I just thought that someone knew off the top of the head where to make the changes rather than have me digging around the code.

Here's the easy solution (just add the two new variables as shown, 3/4 of the way down in the includes/page_header.php):

$template->assign_vars(array(
'SITENAME' => $board_config['sitename'],
// etc
'PRIVATE_MESSAGE_NEW_FLAG' => $s_privmsg_new,
// etc
'L_USERNAME' => $lang['Username'],
// etc
'L_REGISTER' => $lang['Register'],
// etc
'U_SEARCH_UNANSWERED' => append_sid('search.'.$phpEx.'?search_id=unanswered'),
// etc
'U_GROUP_CP' => append_sid('groupcp.'.$phpEx),
// ezPortal
'U_PORTAL' => append_sid('portal.'.$phpEx),
'L_HOME' => $lang['Home'],

// my new links
'U_PORTAL_2' => append_sid('portal_2.'.$phpEx),
'U_EGO_SEARCH' => append_sid('search.'.$phpEx.'?search_id=egosearch'),
Locked

Return to “2.0.x Support Forum”