Trying to integrate login/logout with my own website

Started by ricteo, September 26, 2009, 01:43:01 PM

Previous topic - Next topic

ricteo

Hi everyone,

I am a novice at SMF and hope you guys can pardon me if i am not so clear with my question:)

I am trying to integrate the login/logout of SMF with my website and is encountering some problems.

I am using SSI to do the integration.
I have put this code into my website and i can login successfully.

However, I noticed that when i close the browser and open my website, my website cannot read the context value anymore ($username is empty).
But the forum still shows that i am 'login'.

I have been stuck with this problem for some time and hope someone will really help me out.

Thanks in advance.

This is my code.

<?php
require_once('forums/SSI.php');
require_once('forums/Sources/QueryString.php');
require_once('forums/Sources/Subs.php');
require_once('forums/Sources/Errors.php');
require_once('forums/Sources/Load.php');
require_once('forums/Sources/Security.php');

$userName='';
$userId='';
if(isset($context['user']['name'])){
   $userName=$context['user']['name'];
   $userId=$context['user']['id'];
}

if ($context['user']['is_guest'])
{
   ssi_login('the link to the page i want it to go after login');
}
else
{
   ssi_logout('the link to the page i want it to go after login');
}
?>

king kratos

When I pulled the login to my website, I had to use include() instead of require() or require_one().

Kratos

Kays

Hi, welcome to SMF.

I don't know if you've seen the SSI Readme. Quite a bit of helpfull information there.

But it sounds like you could have a session problem. Go into the Admin CP > Server Settings > Feature Configuration and set the following

Enable local storage of cookies  > Unchecked
Use subdomain independent cookies > checked
Use database driven sessions > checked

Also in looking at what you've posted there's no need to include the following. SSI.php does that already.


require_once('forums/Sources/QueryString.php');
require_once('forums/Sources/Subs.php');
require_once('forums/Sources/Errors.php');
require_once('forums/Sources/Load.php');
require_once('forums/Sources/Security.php');






If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

ricteo

Hi,

I noticed that if i set the internet options on explorer to accept session cookies, my site can read the $context variable.I am puzzelled why smf can read $context after i restart my computer but my website cannot do it.

And it is problematic if i am to ask my users to set the cookie value since most of them are not IT savvy.

Anyone can help?

Thanks in advance

Arantor

Please can you attach the file itself here? (Not just post its contents)
Holder of controversial views, all of which my own.


Advertisement: