Re: Conditional session initialization on Auth
| From: | Alan Knowles | Date: | Sat, 12 Jul 2003 12:18:50 +0000 |
| Subject: | Re: Conditional session initialization on Auth | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-18193@lists.php.net to get a copy of this message | ||
perhaps all of this should be in the constructor:
$auth = new Auth('File', array(
'file'=>'....',
'usernameField' => '...'
'passwordField' => '...'
'alwaysRegisterSession' => true|false,
'LoginCallback' => ''
'useCallback' => false
);
.. keeps the API nice and simple :)
Regards
Alan
Bertrand Mansion wrote:
<alan@akbkhome.com> wrote :-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.comAttached is a patch that adds a flag to $auth->start() $auth->start(); // same behavour as usual.. $auth->start(true); // always register the session (eg. same as usual behaviour) $auth->start(false); will only initiate a session when a) the user tries to log in b) if there is an existing session (using $_REQUEST[session_name()]) I needed this to enable authentication information to be carried around a site which some parts are open, and others secure. - so I call start() on all pages, but dont want to generate session data/files for all visitors..While you are at it, I would also suggest another change to the start() method by adding two paramaters : $userfield, $passfield so that we don't always have to call our login form fields 'username' and 'password'. With your changes, start() will become: function start($regSession = true, $userfield = 'username', $passfield='password') I needed this change because I don't have control aver the client application that is trying to connect to my server and it happens they use 'Username' and 'Password' instead. Bertrand Mansion Mamasam