3.9 PHP 7.1 Get Guest Session

For Joomla! 3.x Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general

Moderator: ooffick

Forum rules
Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.
Post Reply
dangling
Joomla! Apprentice
Joomla! Apprentice
Posts: 45
Joined: Tue Nov 01, 2005 4:51 pm

3.9 PHP 7.1 Get Guest Session

Post by dangling » Fri May 24, 2019 4:21 pm

Hello,

I am trying to redirect to my proxy using sorcerer inside an article as follows.

Code: Select all

<?php
header("Location: https://www.abc.com/compare/?page=compare". "&token=" . $session->getId()."&end", TRUE, 303);
die();
?>
This works for a logged user but not for a guest. For a guest I get an error
Call to a member function getId() on null.
I am trying to test if user returns to page so need to know if guest has session so I can reload a record in my application.
Thanks
Paul
Last edited by toivo on Fri May 24, 2019 4:29 pm, edited 1 time in total.
Reason: mod note: moved to 3.x Coding

CDXXonline
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 169
Joined: Fri Oct 13, 2017 8:00 pm

Re: 3.9 PHP 7.1 Get Guest Session

Post by CDXXonline » Sat Jun 01, 2019 12:30 am

Seems like you need to add a null case and direct it to do something other than give you an error. If null do this (whatever this will be, maybe get ip?) else your code.


Post Reply

Return to “Joomla! 3.x Coding”