getting userid in 3rd party php file

Permalink
Hi,

I need to get the userid of the currently loggedin user into a an variable. In old concrete it was in a session, but after the security system was changed i can't get it from the session anymore.

As the php file is not loaded from concrete5 i can't just call
$u = new User();
echo $u->getUserID();

How do i get the information?

cbox
 
cbox replied on at Permalink Reply
cbox
Ok.. It has been solved..

Maybe not a beatiful solution, but it works. :)

if (!empty($_COOKIE['CONCRETE5'])) {
$data = file_get_contents(dirname(dirname(__FILE__)).'/files/tmp/sess_'.$_COOKIE['CONCRETE5']);

if (!empty($data)) {
session_decode($data);

}
}

if (!empty($_SESSION['uID'])) {
$userid = $_SESSION['uID'];

This website stores cookies on your computer. These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media. To find out more about the cookies we use, see our Privacy Policy.