Cannot Stay Logged in (Cookie problem?)

Started by Terragen, April 10, 2004, 12:31:17 PM

Previous topic - Next topic

Terragen

Quote from: [Unknown] on April 16, 2004, 05:36:37 PM
This just sounds like a screwed up server to me :P.

-[Unknown]

But its ONLY the SMF files.

YabbSE works fine. If I make my own script it works fine.

If I copy and paste a working setcookie call into the SMF file it doesn't work.

I know IIS is horrible (like I said I only used it because there wasn't any good free way to use ASP in Apache a few years ago when I put it up) but it seems ridiculous that its "biased" only against smf lol.

I can't be that crazy because I've seen a few other people here post of similar problems.

I just want my cookies to work lol


:'( :'(

[Unknown]

I use IIS 6.0 without issue...

It sounds like the server is breaking the Set-Cookie header when two cookies are set, or something.

Try putting ob_clean(); before the setcookie call.

-[Unknown]

Terragen

tried obclean but still not getting the cookie set :(

damn microsoft.. well I guess i'll have to keep logging in until I can get the time to switch over to apache

thanks again

Terragen

#23
In order to get the cookies working i've had to change some of the code. Hopefully I can get Apache on soon and get this sorted out :/

Anyways for anyone else with the same problem

Replace:

header('Location: ' . str_replace(' ', '%20', $setLocation));


With:


print '<html><head><meta http-equiv="refresh" content="0;URL=' . str_replace(' ', '%20', $setLocation) . '">';
        print '</head><body><a href="' . str_replace(' ', '%20', $setLocation) . '">Click here</a></body></html>';



in function redirect exit in subs.php

an annoying fix but seems to be the only way to get IIS to set cookies.

[Unknown]

Umm.. SMF uses no such code...?  Do you mean add that to the redirectexit() function?

I should note again that it does work with IIS, just probably not really old versions of IIS :P.

-[Unknown]

Terragen

Sorry I copy and pasted the code but apparently the second time it didn't grab it in the clipboard :D

i'll edit the post

treo

mhm, did you try just a fresh install of SMF? If it works than there is a hard to find missconfiguration ;)

[Unknown]

Sorry, I have this thing about xhtml compliancy...

Replace, Sources/Subs.php:

header('Location: ' . str_replace(' ', '%20', $setLocation));

With:

echo '<html>
<head><meta http-equiv="refresh" content="0;URL=', str_replace(' ', '%20', $setLocation), '" /></head>
<body><a href="' . str_replace(' ', '%20', $setLocation) . '">Click here</a></body>
</html>';


Although, javascript could also be used, and so could i18n..

-[Unknown]

Terragen

Quote from: treo on April 23, 2004, 03:56:23 PM
mhm, did you try just a fresh install of SMF? If it works than there is a hard to find missconfiguration ;)

Nope - its an MS bug (from 1997) - they didn't follow CGI standard. So YabbSE must have used a different method because it worked fine then.

The problem is IIS ignores cookies when there's a redirect in the header. This solves that problem (With the html refresh). I suppose you could use the YabbSE method whatever it is because it worked fine but the SMF implementation exposes the MS bug (I finally found out what it was lol).

So yeah a fresh install of SMF didn't work either - but its MS's fault.


[Unknown]

The YaBB SE method was to not do anything, but that could cause problems because you didn't know if login actually worked...

-[Unknown]

simpleton

Hi :)

I seem to have developed the same little problem a day or two ago.
I've been running "SMF 1.0 Beta 4.1 Public" without any problems... then suddenly one of my members messaged me from another forum about this problem as they couldn't log out, post, or send IM's on my one! ???
another member had it too but seemed to have fixed it by logging out and then back in again.

Upon checking myself, I found I had the log out problem too and was unable to post or start new topics.... I either had session timeout errors (despite taking merely a moment or two to try posting) or the message to log out and log back in again (which i was unable to do without deleting my cookie) so I changed the cookiename to see if that might help yesterday.

It made things better for me :D but the first member messaged me again today having come back to test if things were back to normal but found the same problems!

QuoteIt won't let me post without the time out error even though I'm really quick and it wants to keep me forever cos it won't let me log out again  :'(  I want to go home  :'( 

I went to have a look and although I can post and start new threads, i cannot log out.
I've now noticed that local cookies were on... :-[ so have switched them off... and renamed the cookie again... think my account seems ok now ;D

I'm hoping the local cookie thing was my prob :D

Sorry to take up your time with this post if my problem is solved but thought maybe I'd make mention of it.

Terragen

You might just be seeing the sessions working

if you get a browser like opera you can check on the cookies to see which ones have been set by the server.

IF you're only getting the PHPSESSID cookie then thats the session and you are having the same problem - SMF sends the logincookies but then redirects you to the main page but if you're on IIS the redirect causes the login cookies not to get sent

so check your cookies to see which ones are getting set :)

[Unknown]

I would assume sessions are not properly working on your server.  This is common on sourceforge and other load balanced servers.

-[Unknown]

-Garion-

#33
I want to point out that while I have the same problem, I found a temp solution (which in truth isn't really a solution).  If you were logged in before, and after either closing the browser or visiting another website, and upon re-entering the forum visitors will have been logged out and shown as guests.  But I discovered that by just clicking the home button, or attempting to view any of the boards will automatically log you back in (without having to type in username & pass)!  Weird.. so basically, if you have this problem, all you need to do is re-click the HOME button and it'll reload the page and log you in at the same time.

Edit: I did created a FAQ and directed all new users and visitors to it using the news box, and told them that's all they needed to do to relogin without any hassles.

My board: http://bashyou.net/garion/forum

[Unknown]

That sounds like a caching issue to me...

-[Unknown]

-Garion-

Quote from: [Unknown] on April 24, 2004, 06:42:14 PM
That sounds like a caching issue to me...

-[Unknown]

Hm.. the YABBSE forum that I'm also running doesn't have the same issue (at least nobody has raised it).  So.. I guess this caching problem only manifests itself in SMF?

Jalapeno

Quote from: -Garion- on April 24, 2004, 06:34:58 PM
I want to point out that while I have the same problem, I found a temp solution (which in truth isn't really a solution).  If you were logged in before, and after either closing the browser or visiting another website, and upon re-entering the forum visitors will have been logged out and shown as guests.  But I discovered that by just clicking the home button, or attempting to view any of the boards will automatically log you back in (without having to type in username & pass)!  Weird.. so basically, if you have this problem, all you need to do is re-click the HOME button and it'll reload the page and log you in at the same time.

Exactly the same here...

Jalapeno

Uhmm, any news on this. I still have the same problem.

-Garion-

I still have that problem on one of my boards.  I'm running two SMF forums right now under the same domain name, each with their own MySQL database, and only my personal SMF board has that issue.  I compared cookie settings on both.. and they're exactly alike..   :-\

tman

I've had the "can't stay log in prob" as well.

The solution in my case was simple but effective, installing php as isapi instead of cgi did the trick. If you have this problem and enough control over your server I suggest you do the same.
Note that while installing as isapi I also installed php 4.3.6 instead of 4.3.1, so that could be the solution as well.

P.S. In my case it was a windows 2000 adv. server running IIS 5.0
hxxp:www.aapjeskijken.com [nonactive]
hxxp:www.quote-db.com [nonactive]

Advertisement: