News:

Join the Facebook Fan Page.

Main Menu

.SSI Login/Logout problem

Started by JamesMD, January 04, 2011, 09:55:20 AM

Previous topic - Next topic

JamesMD

So on my main site, I have the "Welcome Guest! Login or Register"
And I have the "Login" Username and Password box which both work fine.

My Forum is SMF 2.0RC4
But when I do log in, it still says the above information as if I'm not logged in.

I'm only using this code.
<?php
if ($context['user']['is_guest'])
{
ssi_login();
}
else
{
ssi_logout();
}
?>


I know it's probably something I'm missing, but not sure what.

Masterd

Quote from: JamesMD on January 04, 2011, 09:55:20 AM
<?php
if ($context['user']['is_guest'])
{
ssi_login();
}
else
{
ssi_logout();
}
?>


Try this:

<?php

if ($context['user']['is_guest'])

ssi_login();

else if 
$context['user']['is_logged']

ssi_logout();

?>



JamesMD

Tried it but still no luck. I had Syntax Errors at first but overcome them because of missing brackets.

This is the latest I've used. Thankyou for the quick response too!
<?php

if ($context['user']['is_guest'])
{
ssi_login();
}
else if (
$context['user']['is_logged'])
{
ssi_logout();
}
?>


Masterd

You don't need to use the brackets.

JamesMD

I get this Error if I don't (For some reason?) I'm using .php pages too.

Parse error: syntax error, unexpected T_VARIABLE, expecting '(' in /home/root/root/index.php on line 43

Masterd

You need to put that code in the Index.template.php, not the Index.php.

JamesMD

Hmm. I'm using this script on my Index.php so it will call the SSI.php to use the Login Box on every main site page (Not the forums)

Also I can't find in the Index.Template.php the stuff I need to change in the code to make it work, or do I just copy the code you gave in to the  Index.Template.php and it should work? Sorry for the confusion, I'm getting confused myself! Ha.

Masterd

Quote from: Masterd on January 04, 2011, 10:29:33 AM
You need to put that code in the Index.template.php, not the Index.php.

JamesMD

Okay I've put it in (without the <? because they are already in at the top and bottom)

but I'm getting this?
I'm putting it in to the custom theme I have. (index.Template.php)

Fatal error: Call to undefined function ssi_logout() in /home/root/public_html/forum/Sources/Load.php(2140) : eval()'d code on line 278



Kays

Hi, silly question maybe, but have you included SSI.php on that page?

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

JamesMD

I have yep, right at the top of my pages

<?php require("forum/SSI.php"); ?>

Kays

Where are you trying to add it?

If it's to a theme, SSI.php won't load.

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

JamesMD

To my main website, eg. www.your-site.com/index.php [nofollow]

It shows the login and password textbox, aswell as the recent posts etc. just not showing logout when I try to login.

Kays

Something to check or do is to go into the Admin CP> Server Settings > Cookies and Sessions and verify the following:

Enable local storage of cookies - unchecked
Use subdomain independent cookies - checked
Use database driven sessions - checked

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

Masterd

Run this query in your database:

REPLACE INTO smf_settings VALUES ('disableTemplateEval', 1);

Advertisement: