Simple Machines Community Forum

SMF Support => SMF 2.1.x Support => Topic started by: stog on June 28, 2023, 06:40:13 AM

Title: session timed out preventing login
Post by: stog on June 28, 2023, 06:40:13 AM
Hi all

just set up new 2.1 installation yesterday (default theme)

no mods installed
however

while trying to prevent Login appearing when linking back to the Forum from a direct link out (from a Board link to another part of the directory -- an index.html) I clicked "enable local storage" in server settings/cookies (which allowed link back to the forum to not contain log in dialogue - if I was already logged in!

also disabled 2 factor security!

However today while testing from my phone, adding a board & altering a board permission to guest access, within a Category restricting access to global & admin (possibly creating a problem)

I found myself in a session timed out while posting and also preventing login

returned to my desktop

enabled maintenance mode from ftp, looked at repair_settings and was considering administrate.php if i can find where to download it

I have had a look at other threads with this session timed out problem, but suspect I need to unclick local storage of cookies, but can't get in to administer.

Please advise before I mess things up further

Many thanks
Title: Re: session timed out preventing login
Post by: stog on June 28, 2023, 08:15:59 AM
update -- sorted

i seem to be able to log in ok on my iphone now but not the desktop (mac/firefox)
errors showing are 2: undefined array key "total time logged in"  subs.php line 4339 so am looking into this

ok

have unchecked local storage for cookies

and can now log in ok

& for the initial problem -- have changed the link back to the forum to http://xxx without the www    or without only linking by index.php

hope this helps others
Title: Re: session timed out preventing login
Post by: Kindred on June 28, 2023, 09:58:15 AM
you have one URL for your forum - either with www or without.
You need to set your htaccess to automatically redirect anyone who uses the wrong one to the correct one.

If you turn on local cookies, then it makes the problem worse...   
if you turn on subdomain independent cookies, then it solves part of the problem -- but you should still use htaccess -- and you can't have both local and subdomain independent cookies on at the same time.
Title: Re: session timed out preventing login
Post by: Sir Osis of Liver on June 28, 2023, 12:48:28 PM
.htaccess


# 301 REDIRECT HTTP TO HTTPS AND WWW TO NON-WWW
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
</IfModule>

Title: Re: session timed out preventing login
Post by: stog on June 28, 2023, 03:28:05 PM
Thx both
very helpful

appreciated