Joomla! Discussion Forums



It is currently Wed Nov 25, 2009 7:35 pm (All times are UTC )

 




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Getting the session ID
Posted: Mon Nov 12, 2007 7:43 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Aug 16, 2007 5:06 pm
Posts: 8
Well I've been searching but without much luck on finding an answer. So my last resort is to post on the forum..

In my custom component how can I get the session_id of the current user? logged in or not.


Top
   
 
Posted: Tue Nov 13, 2007 1:16 pm 
User avatar
Joomla! Intern
Joomla! Intern
Offline

Joined: Sun Sep 30, 2007 11:12 am
Posts: 81
The session_id is stored in $session_id . If you look at index.php in the root directory you can see were it is started.

Hope this helps.


Top
   
 
Posted: Tue Nov 13, 2007 1:36 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Nov 01, 2007 8:27 am
Posts: 8
You can do this way:

global $my;
$my->id

if ($my->id){
....
....
}

I hope it's gonna help...

_________________
PSD to Joomla template conversion, Custom Joomla development
http://www.emcomponents.net


Top
  E-mail  
 
Posted: Fri Feb 08, 2008 1:26 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Fri Feb 01, 2008 12:23 pm
Posts: 138
Quote:
The session_id is stored in $session_id . If you look at index.php in the root directory you can see were it is started.

Hope this helps.


I just don't manage! There are various threads in this forum about the session topic but I couldn't find an answer to my most simple question:

how can I retrieve the session_id?

$session_id is empty
$_SESSION['sesson_id'] is empty

I just need to know for my own scripts what user I'm dealing with so I can retrieve the unique id from the users table in order to store user specific data.

_________________
my latest Joomla Sites: http://www.sound-tank.de / http://www.diacova.ch


Top
  E-mail  
 
Posted: Fri Feb 08, 2008 1:59 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Fri Feb 01, 2008 12:23 pm
Posts: 138
Well, since I don't need the session_id but only the user id I have solved the problem with:

$userInfo = $mainframe->getUser();
$user_id = $userInfo->id;

I would still be interested in how to obtain the sesson_id

_________________
my latest Joomla Sites: http://www.sound-tank.de / http://www.diacova.ch


Top
  E-mail  
 
Posted: Thu Feb 28, 2008 6:47 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Fri Feb 01, 2008 12:23 pm
Posts: 138
the best way I found doing such stuff is

global $my;

$user_id = $my->user_id
$user_name = $my->name
$user_type = $m->account_type

etc.

_________________
my latest Joomla Sites: http://www.sound-tank.de / http://www.diacova.ch


Top
  E-mail  
 
Posted: Mon May 04, 2009 9:41 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Apr 30, 2009 5:38 pm
Posts: 15
Location: Salt Lake City, Utah
This should get you the session id.

$session = &JSession::getInstance();
$session_id = $session->getId();

http://api.joomla.org/Joomla-Framework/ ... ssion.html

_________________
"I have many skills." --xena

Sense, Seize, Sustain. Search Impact
https://searchimpact.aculus.com/searchimpact/


Top
  E-mail  
 
Posted: Tue May 05, 2009 6:03 am 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Fri Feb 01, 2008 12:23 pm
Posts: 138
Hey, this is the Joomla 1.0 forum, you're posting 1.5 solutions...

_________________
my latest Joomla Sites: http://www.sound-tank.de / http://www.diacova.ch


Top
  E-mail  
 
Posted: Tue May 05, 2009 2:52 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Apr 30, 2009 5:38 pm
Posts: 15
Location: Salt Lake City, Utah
So it is. Sorry about that, I was searching for how to find session id myself, and this was the forum i came to. I posted the solution I found without realizing this was only for 1.0.

_________________
"I have many skills." --xena

Sense, Seize, Sustain. Search Impact
https://searchimpact.aculus.com/searchimpact/


Top
  E-mail  
 
Posted: Tue May 05, 2009 6:55 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Fri Feb 01, 2008 12:23 pm
Posts: 138
not a problem, just needed to make sure, follow up readers will now.

_________________
my latest Joomla Sites: http://www.sound-tank.de / http://www.diacova.ch


Top
  E-mail  
 
Posted: Mon Oct 26, 2009 11:55 pm 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Sat Sep 26, 2009 3:40 pm
Posts: 1
I am attempting to use the $my->user_id to get the userID of the current Joomla user for an external application that I'm writing. It used to work under 1.0.11, but with the move to 1.0.15, it is now broken.

Are there specific files that have to be included (using 'include') in my code to allow me access to the $my data?


Top
  E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

Quick reply

 



Who is online

Users browsing this forum: No registered users and 17 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group