Please learn to use Drupal to save yourself, me and anyone that uses your contributed module time, money, headaches and death threats! If you use the following you will get the session id for a logged in user:
<?php global $user; $user->sid; // this is the session id!!!!!!!!!!!!!!!!!!!!!!! ?>
The session id is also stored in the database in the user table. So you see it is not necessary to:
- write a function to get the Cookie that contains the session id
- write a database table to store the session id then JOIN it to the user table
- use PHP session_id()
- use the Global variable $_SESSION to get the session id or to use it to store a session id
If you print out the $user object you will see all sorts of useful ready made information. Stop re-inventing code that is neither more efficient or useful.
stdClass Object ( [uid] => 1 [name] => rpo [pass] => 5f4dcc3b5xF765d61d8327deb882cf99 [mail] => info@nosepic.se [mode] => 0 [sort] => 0 [threshold] => 0 [theme] => [signature] => [signature_format] => 0 [created] => 1311773286 [access] => 1322647026 [login] => 1322639355 [status] => 1 [timezone] => 3600 [language] => [picture] => [init] => info@nosepic.se [data] => a:0:{} [timezone_name] => Europe/Stockholm [sid] => mghiqgd7geuuelluihrm554cl3 [hostname] => 127.0.0.1 [timestamp] => 1322647124 [cache] => 0 [session] => easypic_project|N;node_overview_filter|a:0:{} [roles] => Array ( [2] => authenticated user ) )
I got to tell you that hunting you down is a lot more enjoyable than hunting down your ill skilled attempts to code something that is simpler than what is already provided!! If you are going to hack code then you should at least try to do it well. Read the f***kin' code!! :(
