News:

Wondering if this will always be free?  See why free is better.

Main Menu

Passing $_SESSION variable to external program

Started by barry1947, December 07, 2016, 12:06:46 PM

Previous topic - Next topic

barry1947

Hi Everyone
Is it possible to pass a straight session variable to an external script so that the script can tell the request was made by a valid logged on member. Or if not, is there an alternative way that this can be achieved.
Many thanks
Barry

Kindred

#1
if using php, then


<?php
require_once('SSI.php');

global 
$context;

if (
$context['user']['is_logged'])
  
$real_user=1;
?>

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

barry1947

Hi Kindred,
Many thanks for your prompt reply.
My script is totally disconnected from the the forum and all I have to go on is an http request that could come from anywhere. So I have no idea of who the user is without some form of recognition like a session variable that I can look at. HTTP_REFERER would almost be OK but it is unreliable. I can do it via a URL query but that would be to easy for anyone to hack it.
And advice is much appreciated.
My thanks once again and best regards.
Barry

Kindred

your script does not have to be connected to the forum... that's why the require_once('absolute/path/to/forum/directory/SSI.php'); line is there...   SSI.php allows you to access forum variables and other forum data outside of the forum itself
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

barry1947

Hi Kindred,
Many thanks to you once again.
You must be a busy guy.
I do not want to take up too much of your time and I appreciate your answers.
I will go and digest what you have have offered as maybe you are coming from a completely different angle than I have in my head right now. However, I think it is beginning to dawn on me where I may be able to go with this.
Once again, many thanks for your time.
Best regards
Barry

barry1947

Hi Kindred,
Got it.
Works like a charm.
Thank you and best regards
Barry.

Advertisement: