SHARE
TWEET

Untitled

a guest Feb 3rd, 2012 304 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $user_id = 0;
  3. $table_prefix = 'elgg_'; // get from engine/settings.php
  4. if (! empty($_COOKIE['Elgg'])) {
  5.         $session_id = mysql_real_escape_string($_COOKIE['Elgg']);
  6.         $sql = ("SELECT `data` FROM `{$table_prefix}users_sessions` WHERE `session` = '{$session_id}'");
  7.         $result = mysql_query($sql);
  8.         if ($row = mysql_fetch_array($result)) {
  9.                 $data = explode('attributes";', $row[0]);
  10.                 if (!empty($data)) {
  11.                         $session = unserialize($data[1]);
  12.                         $user_id = $session['guid'];
  13.                 }          
  14.         }
  15. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top