Re: CGI::Session with MySQL Driver



* Alexandre Jaquet schrieb:

> Mark Clements a écrit :
>> Alexandre Jaquet wrote:
>>> Mark Clements a écrit :
>>>> Alexandre Jaquet wrote:
>>>>>
>>>>> $SESSION = new CGI::Session( "driver:MySQL", undef, { Handle=>$dbh} );
>>>>> $SESSION->store($dbh,$SESSION->id,'',"user_name => $username");
>>>>
>>>> Don't use store, use param.
>>>
>>> That's what I've try first it's doesn't store value key pair
>>> user_name $username ...
>>
>> Show us your code using param.

>
> sub login {
> my $username = param('user_name');
> my $userpassword = param('user_password');

[...]

> $CGI::Session::MySQL::TABLE_NAME = 'session';
> my $SESSION = new CGI::Session( "driver:MySQL", undef, {Handle => $dbh} );
> @my_array = ("$username");
> $SESSION->param("user_name", \@my_array);

This creates a new session since the second param to new() is undef. The
param()-call should set the value for "user_name" in *this* session. It
seems to be all right.

How do you verify that this value is not saved in your session? Do you
look into the database by hand, don't you?

I assume your problem is to get back this session instead of creating a
new one each time your script is called. Could this be?

regards,
fabian
.



Relevant Pages

  • Re: CGI::Session
    ... Alexandre Jaquet wrote: ... > use strict; ... > use CGI; ... my $session = new CGI::Session( ...
    (comp.lang.perl.misc)
  • Re: CGI::Session with MySQL Driver
    ... Fabian Pilkowski a écrit: ... user_name $username ... ... This creates a new session since the second param to newis undef. ...
    (comp.lang.perl.misc)
  • Re: CGI::Session
    ... Alexandre Jaquet a écrit: ... my $session; ... one method is missing at ... cleanup) Can't locate auto/CGI/Session/store.al in @INC (@INC contains: ...
    (comp.lang.perl.misc)
  • creating a new session when a session is expired
    ... After reading the documentation about CGI::Session I didn't find any ... Now I'm using the following code to create a new session ... Alexandre JAQUET ...
    (comp.lang.perl.misc)