View Full Version : Code Request
jennec
08-03-2005, 04:46 PM
Hi guys,
Would someone be able to tell me how I can modify this code to provide the forum session id.
This fuctions used to grab the forum login session ID in SD 1.15, and provide it as part of a link for the admin section. It does not work in SD 2. Can one one help?
I think it is a matter of syntax change, but I have no idea what it will be now.
function ForumAdminLinkID()
{
* * * global $session_id;
*
* * * $forumadmin = '<td align="center"><div><a href="phpBB2/admin/index.php?sid=' . $session_id . '"><img src="images/icons/phpbb.gif"/><br/>Forum Admin</a></div></td>';
* *
* *echo $forumadmin;
* *
* * * }
*
* *ForumAdminLinkID();
You don't need the session id to pass to the admin anymore
jennec
08-03-2005, 05:16 PM
Not SD admin, but my forum admin control panel. phpBB2.
I am trying to create a link to the Forum Admin Control Panel on my Login Panel. As I said, this code used to do it.
Is there any documentation re the global variables for SD?
No documentation as such but if you look in /include/globalfunctions.php in the GetUserInfo() function you will see all the fields available.
The one you want is $userinfo['sessionurl']
jennec
08-03-2005, 08:05 PM
Thanks Spib.
I tried using that Global Variable using the following code. But it did not append the session id to the link I am creating. Can you see if I am doing anything wrong?
* function ForumAdminLinkID()
* *{
* * * global $userinfo;
*
* * * $forumadmin = '<td align="center"><div><a href="phpBB2/admin/index.php?sid=' . $userinfo['sessionurl'] . '"><img src="images/icons/phpbb.gif"/><br/>Forum Admin</a></div></td>';
* *
* *echo $forumadmin;
* *
* * * }
*
* *ForumAdminLinkID();
No you aren't doing anything wrong- I was forgetting the way that particular variable works.
Unfortunately, the session id is no longer stored in a global variable. However, if you want to hack the code to achieve this, open includes/usersystems/phpbb2.php and around line 424, right before
//#################DELETE OLD SESSIONS##########
add
$GLOBALS['sessionid'] = *$session['session_id'];
Then you can reference the session id by $global $sessionid;
jennec
08-04-2005, 08:14 AM
That worked nicely thank you.
For those how might want to use the code I have used I have included it below.
phpBB2 2.0.11
function ForumAdminLinkID()
{
global $sessionid;
*
$forumadmin = '<td align="center"><div><a href="phpBB2/admin/index.php?sid=' . $sessionid . '"><img src="images/icons/phpbb.gif"/><br/>Forum Admin</a></div></td>';
* *
echo $forumadmin;
* *
}
*
ForumAdminLinkID();
phpBB2 2.0.15+
The link to the Admin board changed in this version so the link needs to be changed as below
function ForumAdminLinkID()
{
global $sessionid;
*
$forumadmin = '<td align="center"><div><a href="phpBB2/admin/?admin=1&sid=' . $sessionid . '"><img src="images/icons/phpbb.gif"/><br/>Forum Admin</a></div></td>';
* *
echo $forumadmin;
* *
}
*
ForumAdminLinkID();
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.