"Remember me"

joan
joan's picture

Joined: 2002-10-21
Posts: 3473
Posted: Sun, 2003-03-16 21:31

We have a members only gallery. My users (god bless'em) don't want to have to type their details in every time they log in. They want a "Remember me" button, so they are re-logged in automatically.

Has anyone implemented something like this? If not, any suggestions on what needs to be done?

a T d H v A a N n K c S e

 
alindeman
alindeman's picture

Joined: 2002-10-06
Posts: 8194
Posted: Sun, 2003-03-16 22:07

The problem is PHP sessions. Sessions don't last more than one browser session by default (you may be able to change this with PHP directives, but I've never tried). Not using PHP sessions would undermine almost every part of Gallery, so I don't know how you'd do this :sad:

 
jmullan
jmullan's picture

Joined: 2002-07-28
Posts: 974
Posted: Mon, 2003-03-17 00:54

In init.php, replace this with this (but this doesn't give users the option of choosing whether or not to remember them)

Old:
<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>
/* Start a new session, or resume our current one */
session_start();
</TD></TR></TABLE><!-- BBCode End -->

New:
<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>
/* Start a new session, or resume our current one */
$session_expire = 86400;
$cookie_expire = time()+$session_expire;
ini_set("session.cookie_lifetime",$session_expire);
session_start();
</TD></TR></TABLE><!-- BBCode End -->

Based on:
http://www.php.net/manual/en/function.session-set-cookie-params.php

http://www.php.net/manual/sv/ref.session.php

 
joan
joan's picture

Joined: 2002-10-21
Posts: 3473
Posted: Thu, 2003-03-20 22:31

Thanks guys, I had a play, and it looks like right solution.

However, it looks like we'll be moving to XOOP (or similar) so that will presumably solve the problem without me doing any work, so this is on hold for the moment.

 
linton

Joined: 2002-10-12
Posts: 42
Posted: Sun, 2003-03-23 22:02
Quote:
In init.php, replace this with this (but this doesn't give users the option of choosing whether or not to remember them)

Do you think that if there is a check box option when the user logs in that would then choose between which of the 2 functions to use would work. I don't know much about PHP and even less about php sessions. I think that if there was the option to stay logged in or not would be really good for the gallery users that have restricted commenting to only logged in users.

thanks
linton