News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Always logged in as guest on website

Started by Sel_888, December 29, 2008, 08:30:47 PM

Previous topic - Next topic

Sel_888

I have spent the last several hours and many clumps of hairs pulled out of my head trying to figure this out.

Here is what is going on.
I am trying to have a login / welcome member on my homepage.
No problem with getting the login/password boxes... :D
<?php
if ($context['user']['is_guest'])
{
ssi_login();
}
else
{
ssi_welcome();
}
?>

All works hunky dory, if I was a guest. :-X It shows the signin and password box NP! BUTtttt... when I hit 'login', it automatically redirects me to my forum, not keeping me on my website.
I had tried to put in the url in the ssi_login('http://mywebsite.com'); but to no avail.
Through my research, I have made sure that...

  • "Use subdomain independent cookies" is set in my server settings
  • refreshed my cookies in my browsers

Still ... I am always a 'guest'.

Now, I KNOW that I am accessing my SSI.php properly, for I am able to have my recent posts and who's online in the website, just it will NOT see me as a registered user.

So, I need two helps.

  • A user is able to log in and still stay on my website instead of being re-directed to my forum.
  • The website is able to see who I am instead of a 'guest'

What am I overlooking?
Thnx for your help.
-Sel  :(
I didn't get it wrong, I just found 10,000 ways it doesn't work...

LagunaChapala.com - A community site for South Shore residents


Sel_888

Quote from: Orstio on December 29, 2008, 10:47:13 PM
global $context;

used in what context? (sorry about the pun... couldn't help it)

in other words, how would I use that in the code. i thought that I had something like that at one time in my infinite different ways to make this work, but if you can 'laymen' it out for me in code, it would be appreciated.
THNX
-Sel
I didn't get it wrong, I just found 10,000 ways it doesn't work...

LagunaChapala.com - A community site for South Shore residents

Orstio

<?php
global $context;

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

Sel_888

K, I did that, but it still didn't help my TWO problems.

First problem being it still redirects me to my forum page instead of the same page,
and second, it still sees me as guest.

Another thing that it does that I find extremely interesting, of which it had done the whole time before, and that is when I look at my ssi_logOnline() after I had logged in to the site (and going back to the website after it redirected me to the forum), it says that there is one guest and one user online. the user being me, but it still thinks that I am a new guest with the welcome message (welcome guest....)

I have seen other people having this problem through my research, but I never can figure out what they did to make work.

I would really like to be able to make my website with a lot of sections using
Quoteif ($context['user']['is_guest']
Or
Quoteif ($context['user']['is_admin']

Etc to show or not show parts, depending on who is accessing the page.
Its now been a 24 hr struggle for me and I am about to have a brain explosion.
Where the hooie am I going wrong????? :-[

-Sel
I didn't get it wrong, I just found 10,000 ways it doesn't work...

LagunaChapala.com - A community site for South Shore residents

Orstio

Make sure subdomain independent cookies are on.

You'll want to use ssi_logOnline() before you check for online status.  That function actually forces the SMF user session start.

Sel_888

QuoteInsert Quote
Make sure subdomain independent cookies are on

If you can see, in my first post in this I have...
Quote
-"Use subdomain independent cookies" is set in my server settings
-refreshed my cookies in my browsers

Still ... I am always a 'guest'.


Second, I do not want to have the logonline() listed at the top of the site, but at the bottom.
Maybe I will change it to just whosonline() and see if that might make a difference.

ALSO... do you have any idea why I am being re-directed to my forum page when I try to log on and hit the button? I tried many things, and all seem to just go to my forum, no matter what.
-Sel
I didn't get it wrong, I just found 10,000 ways it doesn't work...

LagunaChapala.com - A community site for South Shore residents

Orstio


Sel_888

Quote from: Orstio on December 30, 2008, 12:39:40 PM
ssi_login('URL goes here');

That would be nice if that would work, but it still INSISTS on taking me to my forum site.

and it STILL insists that I am a guest. I can NEVER get it to see me as a registered user.
I use ssi_boardNews and others with total success on the site... so... weird.

This isn't a simple problem that you tend to refer this to. I have TRIED a gazillion different things, so many ways that I don't even want to list them all. What could be the problem?

-Sel
I didn't get it wrong, I just found 10,000 ways it doesn't work...

LagunaChapala.com - A community site for South Shore residents

Orstio

It's your URL.  Your cookies aren't being recognized as the same site.

What you have:

Site:
http://www.site.com

Forum:
http://www.forum.site.com

What you need:

Site:
http://www.site.com

Forum:
http://forum.site.com

It might seem like a trivial change, but it makes a world of difference to the browser when it is trying to make sure that your cookies are secure.


Sel_888

Quote from: Orstio on December 31, 2008, 09:50:32 AM
It's your URL.  Your cookies aren't being recognized as the same site.

What you have:

Site:
http://www.site.com

Forum:
http://www.forum.site.com

What you need:

Site:
http://www.site.com

Forum:
http://forum.site.com

It might seem like a trivial change, but it makes a world of difference to the browser when it is trying to make sure that your cookies are secure.

Lost!!!!
First... how do I go about making my forum without the www in front.
Second... that makes NO difference on why when I hit 'login' button, it STILL sends me to my forum.
Third... where would I be writting in the 'http://forum.site.com' in the code anyways? does it have to do with the [is_guest] ??
SOOOOOOOOOOO lost.
here's my site just in case.... http://www.lagunachapala.com
It all has to do with the top right login. it will NOT show my being a registered user, and the link for the login button sends me to the forum site.
Tried to make the code simple again....
<?php
global $context;
if (
$context['user']['is_guest'])
{
ssi_login('http://www.lagunachapala.com');
}
else
{
ssi_welcome();
}
?>


:'( waaaaaaaaaaaaa
-Sel

I didn't get it wrong, I just found 10,000 ways it doesn't work...

LagunaChapala.com - A community site for South Shore residents

Orstio

It has nothing to do with writing the URL into the code.

This is your forum location:

http://www.forum.lagunachapala.com/

When I try to access this:

http://forum.lagunachapala.com/index.php

I get redirected here:

http://www.forum.lagunachapala.com/index.php?www

That redirect alone will cause you cookie issues.

Sel_888

so what do I do about that? how can I change that?
I didn't get it wrong, I just found 10,000 ways it doesn't work...

LagunaChapala.com - A community site for South Shore residents

Orstio

That depends on how the redirect and subdomain were created.

Sel_888

Quote from: Orstio on December 31, 2008, 12:27:52 PM
That depends on how the redirect and subdomain were created.

k... now I am very lost. All of this was created by my host provider (aplus.net) and it's not like I had a choice with how it was created... maybe I will have to talk to them.
I didn't get it wrong, I just found 10,000 ways it doesn't work...

LagunaChapala.com - A community site for South Shore residents

Sel_888

ALrighty---THEN!

a lot of time had gone by ... and I had just excuded the whole possibility that I could have any uses for
Quoteif ($context['user']['is_guest'] or
if ($context['user']['is_admin'] etc...
in my website.... I concluded to the fact that my hostserver (aplus.net) made subdomains really hokey!

Now... I have changed hostservers (hostgator.com).... and also upgraded my SMF to 2.0 RC1-1, and I am AGAIN having login issues with SSI....
Two things are happening....

1- ALWAYS sees me as guest
2- with hitting 'LOGIN' button, it directs me to the forum (which I don't want)... though I have the URL pointing me back to the website (which I want).

Now... I DO have the forum as a sub-domain... and I KNOW that my require_once is working since I can see a poll that I am pulling from the forum (just to see that it DOES work)...
Of course I have the require command on line 1.
I have 'use subdomain independent cookies' enabled... etc etc etc.

What am I overlooking now?

I am searching this forum, and still I am not seeing any answers.
I didn't get it wrong, I just found 10,000 ways it doesn't work...

LagunaChapala.com - A community site for South Shore residents

Arantor

There have been some issues in 2.0rc1-1 with the session handler not doing this properly.

The only solution I encountered was to include SSI.php, then basically have a copy of ssi_login() in my code, manually pushing the $_SESSION value that should be set by SSI.php.
Holder of controversial views, all of which my own.


Advertisement: