cgi-session-user Mailing List for CGI-Session (Page 22)
Brought to you by:
sherzodr
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(4) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
|
Feb
|
Mar
(13) |
Apr
(6) |
May
(2) |
Jun
(3) |
Jul
(2) |
Aug
(10) |
Sep
(9) |
Oct
(15) |
Nov
(1) |
Dec
(4) |
2004 |
Jan
|
Feb
|
Mar
(7) |
Apr
|
May
(1) |
Jun
|
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
2005 |
Jan
(1) |
Feb
(8) |
Mar
(1) |
Apr
(1) |
May
(9) |
Jun
|
Jul
(14) |
Aug
(32) |
Sep
(34) |
Oct
(16) |
Nov
(6) |
Dec
(15) |
2006 |
Jan
(5) |
Feb
(27) |
Mar
(60) |
Apr
(12) |
May
(17) |
Jun
(24) |
Jul
(27) |
Aug
(16) |
Sep
(13) |
Oct
(19) |
Nov
(22) |
Dec
(29) |
2007 |
Jan
(23) |
Feb
(33) |
Mar
(42) |
Apr
(30) |
May
(14) |
Jun
(5) |
Jul
(12) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2008 |
Jan
(6) |
Feb
(9) |
Mar
(48) |
Apr
(20) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(2) |
Nov
(9) |
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
(11) |
Oct
(2) |
Nov
|
Dec
|
2010 |
Jan
(9) |
Feb
(28) |
Mar
|
Apr
(12) |
May
(13) |
Jun
|
Jul
(3) |
Aug
|
Sep
(1) |
Oct
(3) |
Nov
|
Dec
(9) |
2011 |
Jan
|
Feb
|
Mar
(6) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(8) |
2015 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
(5) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2024 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Ron S. <ro...@sa...> - 2005-11-28 09:37:49
|
The pure Perl module CGI::Session::Driver::oracle V 1.00 is available immediately from CPAN, and from http://savage.net.au/Perl-modules.html. On-line docs, and a *.ppd for ActivePerl are also available from the latter site. This module allows you to use Oracle to store sessions managed by= CGI::Session. -- Cheers Ron Savage, ro...@sa... on 28/11/2005 http://savage.net.au/index.html Let the record show: Microsoft is not an Australian company |
From: Mark S. <ma...@su...> - 2005-11-22 13:51:00
|
On Mon, Nov 21, 2005 at 05:22:52PM -0500, Cees Hek wrote: > On 11/21/05, Brett Sanger <swi...@sw...> wrote: > > Is there way to pass CGI::Session an existing DB handle for use, rather > > than a dsn and options? > > > > I've got a module that centralizes all the dsn info, and spits out the > > handle, but the docs don't make it look like I can use it with > > CGI::Session. > > From the postgres driver docs: > > $session = new CGI::Session("driver:PostgreSQL", undef, > {Handle=>$dbh, TableName=>'my_sessions'}); In the subversion repo for CGI::Session, I've added support for lazy-loading the handle: $session = new CGI::Session("driver:PostgreSQL", undef, {Handle=> sub{$dbh}, TableName=>'my_sessions'}); ^^^^^^^^ This could improve the laziness if you are using this in conjunction with the CGI::Application DBH and Session and plugins, which lazy load themselves. The change allows the database handle to only be created if the session is actually used. Mark |
From: Cees H. <ce...@gm...> - 2005-11-21 22:23:01
|
On 11/21/05, Brett Sanger <swi...@sw...> wrote: > Is there way to pass CGI::Session an existing DB handle for use, rather > than a dsn and options? > > I've got a module that centralizes all the dsn info, and spits out the > handle, but the docs don't make it look like I can use it with > CGI::Session. From the postgres driver docs: $session =3D new CGI::Session("driver:PostgreSQL", undef, {Handle=3D>$dbh, TableName=3D>'my_sessions'}); So just pass a 'Handle' option with your database handle and it will use th= at. Cheers, Cees |
From: Brett S. <swi...@sw...> - 2005-11-21 22:17:48
|
Is there way to pass CGI::Session an existing DB handle for use, rather than a dsn and options? I've got a module that centralizes all the dsn info, and spits out the handle, but the docs don't make it look like I can use it with CGI::Session. -- SwiftOne / Brett Sanger swi...@sw... |
From: Senthil N. <rs...@gm...> - 2005-11-18 07:56:29
|
Hi, I read through the CGI::Session tutorial and implemented most of the features of this module for my application. Found a problem with this module or Dont know i ditn handle it properly, I implemented session mgmt using this module for multi user environment and noticed separate sessions are maintained for every user. But when any one o= f the session is activated after some idle time, all the other sessions are also activated in the server, i.e, the access time / change time is modifie= d for all the sessions in the server. I found that the cgisess_<session id> file time is modified for all the session when one session is activated in the browser. How can i handle this in my application. Only the session related to the particular user has to be touched in the server. The time for other session= s should not be modified. Thanks Senthil Nathan R |
From: Cristi O. <cr...@wi...> - 2005-10-24 07:28:47
|
Hi, Sherzod Thanks for your support. This definitely SOLVED my problem. Cristi Ocolisan -----Original Message----- From: root [mailto:ro...@s1...] Sent: Friday, October 21, 2005 9:08 PM To: Cristi Ocolisan Cc: cgi...@li... Subject: Re: [Cgi-session-user] Wierd CGI-Session When a client is re-directed, IE is displaying them version of the image previously stored in cache. It can happen for the two following reasons: * Your IE settings don't check for newer version of your pages "automatically" and/or * Your pages (or your web server) indicate an expiration date for the document. You can start by updating your IE settings in Tools->Internet Options and click on Settings button on the "General" Tab, and tell IE to check for newer version of web pages "Automatically". If that doesn't help, make sure your web pages are served without any expiration date. Assuming your pages are "dynamic", you can do it by outputting the following HTTP header using CGI.pm: print $cgi->header(-expires=>'1s'); If your pages are "static", it depends on the type of the web server you're running to configure these settings. For apache 1.2+ look into mod_expires. -- Sherzod Ruzmetov On Fri, Oct 21, 2005 at 12:02:26PM +0300, Cristi Ocolisan wrote: > Hi all, > > > > I must confess that my knowledge of CGI::Session module is limited. > > I read all documentation about it, but still I have problems working with > it. > > > > I read also a lot of threads on a lot of forums all over the net, but there > is not an answer for my problem. > > > > So, the problem is: > > > > When a user connects to my website (www.workitportal.ro > <http://www.workitportal.ro/> ) he is not logged in (logic). After he logs > in, I redirect him to the last page he visited. > > But if he opens another page and then click a link to the page he logged in, > the browser does not recognizes him unless he click on refresh button. > > > > I have lost several days trying to solve this problem but no success. > > > > Ah. The important thing is that it happens only in IE. All other browsers > work correctly. > > > > Please tell me where my mistake is. > > > > Thanks. > > > > Cristi Ocolisan > > > -- > This message was scanned for spam and viruses by BitDefender. > For more information please visit http://linux.bitdefender.com/ -- This message was scanned for spam and viruses by BitDefender. For more information please visit http://linux.bitdefender.com/ -- This message was scanned for spam and viruses by BitDefender. For more information please visit http://linux.bitdefender.com/ |
From: root <ro...@s1...> - 2005-10-21 18:01:16
|
When a client is re-directed, IE is displaying them version of the image previously stored in cache. It can happen for the two following reasons: * Your IE settings don't check for newer version of your pages "automatically" and/or * Your pages (or your web server) indicate an expiration date for the document. You can start by updating your IE settings in Tools->Internet Options and click on Settings button on the "General" Tab, and tell IE to check for newer version of web pages "Automatically". If that doesn't help, make sure your web pages are served without any expiration date. Assuming your pages are "dynamic", you can do it by outputting the following HTTP header using CGI.pm: print $cgi->header(-expires=>'1s'); If your pages are "static", it depends on the type of the web server you're running to configure these settings. For apache 1.2+ look into mod_expires. -- Sherzod Ruzmetov On Fri, Oct 21, 2005 at 12:02:26PM +0300, Cristi Ocolisan wrote: > Hi all, > > > > I must confess that my knowledge of CGI::Session module is limited. > > I read all documentation about it, but still I have problems working with > it. > > > > I read also a lot of threads on a lot of forums all over the net, but there > is not an answer for my problem. > > > > So, the problem is: > > > > When a user connects to my website (www.workitportal.ro > <http://www.workitportal.ro/> ) he is not logged in (logic). After he logs > in, I redirect him to the last page he visited. > > But if he opens another page and then click a link to the page he logged in, > the browser does not recognizes him unless he click on refresh button. > > > > I have lost several days trying to solve this problem but no success. > > > > Ah. The important thing is that it happens only in IE. All other browsers > work correctly. > > > > Please tell me where my mistake is. > > > > Thanks. > > > > Cristi Ocolisan > > > -- > This message was scanned for spam and viruses by BitDefender. > For more information please visit http://linux.bitdefender.com/ |
From: Senthil N. <rs...@gm...> - 2005-10-21 17:26:25
|
Hi Sherzod, I have used a Session (latest ver 4.03) with 5 min as expiry and CGI cookie expiry also 5 min. Whats the difference between these two?? And Im not at all getting into "your session expired". What could be the problem? This is what im doing with session over CGI stuff. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D my $session =3D CGI::Session->load() or die CGI::Session->errstr; if ( $session->is_expired ) { print $session->header(); print "Your session expired!!"; exit(0); } elsif ( $session->is_empty ) { $session =3D $session->new(); } $session->expire("+5m"); my $cookie =3D $cgi->cookie(-name=3D>$session->name, -value=3D>$session->id= , -expires=3D>'+5m'); print $cgi->header(-cookie =3D> $cookie); =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Thanks Senthil Nathan R |
From: Senthil N. <rs...@gm...> - 2005-10-21 09:13:40
|
Hi Cristi, I doubt with the cookie not being set properly in IE. So, just check with that in the cookies folder, whether it creates the cookie for that login, when a session is created. If it is not so, then the problem is with that and proceed from here on. Hope you are creating the session like this, $session =3D CGI::Session->new(); $cgi =3D CGI->new(); $cookie =3D $cgi->cookie(-name=3D>$session->name, -value=3D>$session->id, -expires=3D>"+1d"); print $cgi->header(-cookie=3D>$cookie); HTH. Senthil Nathan R On 10/21/05, Cristi Ocolisan <cr...@wi...> wrote: > > Hi all, > > I must confess that my knowledge of CGI::Session module is limited. > > I read all documentation about it, but still I have problems working with > it. > > I read also a lot of threads on a lot of forums all over the net, but > there is not an answer for my problem. > > So, the problem is: > > When a user connects to my website ( www.workitportal.ro<http://www.work= itportal.ro/>) > he is not logged in (logic). After he logs in, I redirect him to the last > page he visited. > > But if he opens another page and then click a link to the page he logged > in, the browser does not recognizes him unless he click on refresh button= . > > I have lost several days trying to solve this problem but no success. > > Ah. The important thing is that it happens only in IE. All other browser= s > work correctly. > > Please tell me where my mistake is. > > Thanks. > > Cristi Ocolisan > > > -- > This message was scanned for spam and viruses by BitDefender. > For more information please visit http://linux.bitdefender.com/ > > > |
From: Cristi O. <cr...@wi...> - 2005-10-21 09:02:29
|
-- This message was scanned for spam and viruses by BitDefender. For more information please visit http://linux.bitdefender.com/ |
From: Senthil N. <rs...@gm...> - 2005-10-20 13:20:15
|
Hi Mark / Ron, Thanks a lot for your time. And I feel really sorry about posting this kinda problem. Thanks Senthil Nathan R On 10/19/05, Mark Stosberg <ma...@su...> wrote: > > On Wed, Oct 19, 2005 at 10:12:26PM +0530, Senthil Nathan wrote: > > Hi Sherzod, > > > > I'm trying to use the session module and could implement shopping cart > with > > min. features. > > > > But when I try to put into a package, the whole stuff, right from > session > > creation or loading existing session to adding/deleting/removing to car= t > > etc.., the package gives some minor problems, which I couldnt figure it > out. > > Do you use a text editor with syntax highlighting? The broken syntax > highlighting helped me go directly to the syntax error around line 35. > > You had tried to comment out a line, but left a few characters dangling. > Due to the nature of the error, the parser reported the issue later in > the code. > > Some other helpful debugging tips: > > - perl -cw cart.pm <http://cart.pm> fails to even compile the code. > > - Commenting out the whole subroutine around line 82 doesn't make a > difference. That's a sign the problem is elsewhere. > > If you are starting from scratch, you might look at the Handel > framework: > http://handelframework.com/ > > ( I haven't tried it myself. ) > > Mark > > > > > > > > > > > I have attached the 2 files, cart.pm <http://cart.pm> <http://cart.pm> > and cart.cgi with > > this. > > And this is the error I get, > > Software error: > > > > Bad name after name' at cart.pm <http://cart.pm> <http://cart.pm> line > 82. > > > > Can you please help me to figure out this problem. > > > > Thanks > > Senthil Nathan R > > > > -- > . . . . . . . . . . . . . . . . . . . . . . . . . . . > Mark Stosberg Principal Developer > ma...@su... Summersault, LLC > 765-939-9301 ext 202 database driven websites > . . . . . http://www.summersault.com/ . . . . . . . . > |
From: Ron S. <ro...@sa...> - 2005-10-19 23:28:45
|
On Wed, 19 Oct 2005 22:12:26 +0530, Senthil Nathan wrote: Hi Senthil You must comment out line 36. -- Cheers Ron Savage, ro...@sa... on 20/10/2005 http://savage.net.au/index.html Let the record show: Microsoft is not an Australian company |
From: Mark S. <ma...@su...> - 2005-10-19 17:57:28
|
On Wed, Oct 19, 2005 at 10:12:26PM +0530, Senthil Nathan wrote: > Hi Sherzod, > > I'm trying to use the session module and could implement shopping cart with > min. features. > > But when I try to put into a package, the whole stuff, right from session > creation or loading existing session to adding/deleting/removing to cart > etc.., the package gives some minor problems, which I couldnt figure it out. Do you use a text editor with syntax highlighting? The broken syntax highlighting helped me go directly to the syntax error around line 35. You had tried to comment out a line, but left a few characters dangling. Due to the nature of the error, the parser reported the issue later in the code. Some other helpful debugging tips: - perl -cw cart.pm fails to even compile the code. - Commenting out the whole subroutine around line 82 doesn't make a difference. That's a sign the problem is elsewhere. If you are starting from scratch, you might look at the Handel framework: http://handelframework.com/ ( I haven't tried it myself. ) Mark > > I have attached the 2 files, cart.pm <http://cart.pm> and cart.cgi with > this. > And this is the error I get, > Software error: > > Bad name after name' at cart.pm <http://cart.pm> line 82. > > Can you please help me to figure out this problem. > > Thanks > Senthil Nathan R -- . . . . . . . . . . . . . . . . . . . . . . . . . . . Mark Stosberg Principal Developer ma...@su... Summersault, LLC 765-939-9301 ext 202 database driven websites . . . . . http://www.summersault.com/ . . . . . . . . |
From: Sherzod R. <she...@ha...> - 2005-10-12 16:55:57
|
It seems right to me. The excerpt you pasted is only placing a cookie to = the client's computer, that's all. Once cookie with the right settings have = been placed, doing CGI::Session->new() will be able to extract the session ID from the cookie. The easiest is to try out a test script for yourself, you'll see. > -----Original Message----- > From: Alan Raetz [mailto:ar...@st...]=20 > Sent: Wednesday, October 12, 2005 12:28 PM > To: she...@cp... > Subject: error in tutorial? > Importance: High >=20 >=20 > In=20 > http://search.cpan.org/~sherzodr/CGI-Session-4.03/lib/CGI/Sess > ion/Tutorial.pm >=20 > You use "$query" in the example code below, but the text talks about=20 > "$session"... so is $query actually $session???? > Or is $query the CGI.pm object??? >=20 > -Alan >=20 >=20 >=20 > To make sure CGI::Session will be able to read your cookie at=20 > next request=20 > you need to consult its name() method for cookie's suggested name: >=20 > $cookie =3D $query->cookie( -name =3D> $session->name, > -value =3D> $session->id ); > print $query->header( -cookie=3D>$cookie ); >=20 > name() returns CGISESSID by default. If you prefer a=20 > different cookie name,=20 > you can change it as easily too, but you have to do it before=20 > CGI::Session=20 > object is created: >=20 >=20 >=20 |
From: Senthil N. <rs...@gm...> - 2005-10-06 07:33:42
|
Hi Sherzod Ruzmetov, Yeah its really working for the queries I posted. But I need to resolve only this, 2. How do I implement one session per user in the same machine (from same IP address). Is there anyother modules to do that? Thanks Senthil Nathan R On 10/6/05, Senthil Nathan <rs...@gm...> wrote: > > Hi Sherzod Ruzmetov, > > Yeah that's gr8. It's working now. Same SessionID is maintained even afte= r > use of several windows. > > But few more problems with that, > 1. The session is lost once I close all the windows to that SessionID. > How this can be avoided? ie., cookie gets deleted after closing all the > windows related to that sessionID. > 2. And how do I implement one session per user in the same machine > (from same IP address). Is there anyother modules to do that? > 3. Also looks like sessions are not getting expired. I could notice the > sessions are stored in the server even after setting it to 5minutes. > > FYI, im using session ver 3.95. I know ver 4.02 is there for download. I > need to try it. > > Thanks > Senthil Nathan R > > On 10/5/05, Sherzod Ruzmetov <she...@ha...> wrote: > > > > Use cookies with expiration date. Example: > > $session =3D CGI::Session->new(); > > $cgi =3D CGI->new(); > > $cookie =3D $cgi->cookie(-name=3D>$session->name, -value=3D>$session-= >id, > > -expires=3D>"+1d"); > > print $cgi->header(-cookie=3D>$cookie); > > > > -----Original Message----- > > *From:* Senthil Nathan [mailto:rs...@gm...] > > *Sent:* Wednesday, October 05, 2005 5:29 AM > > *To:* she...@cp... > > *Subject:* CGI::Session - query > > *Importance:* High > > > > Hi Sherzod Ruzmetov, > > > > I need some more examples of using CGI::Session. I read your cookbook. > > Could you send me more examples of using CGI::Session module. > > > > The query is, > > How to assign only one session id for a particular user and track his > > info.? > > I face problems in tracking a session in different windows. I could use > > one session for one window. But if the user opens in another window, a = new > > session is being created. How to restrict this. > > > > Thanks > > Senthil Nathan R > > > > > > > |
From: Senthil N. <rs...@gm...> - 2005-10-06 07:13:47
|
Hi Sherzod Ruzmetov, Yeah that's gr8. It's working now. Same SessionID is maintained even after use of several windows. But few more problems with that, 1. The session is lost once I close all the windows to that SessionID. How this can be avoided? ie., cookie gets deleted after closing all the windows related to that sessionID. 2. And how do I implement one session per user in the same machine (from same IP address). Is there anyother modules to do that? 3. Also looks like sessions are not getting expired. I could notice the sessions are stored in the server even after setting it to 5minutes. FYI, im using session ver 3.95. I know ver 4.02 is there for download. I need to try it. Thanks Senthil Nathan R On 10/5/05, Sherzod Ruzmetov <she...@ha...> wrote: > > Use cookies with expiration date. Example: > $session =3D CGI::Session->new(); > $cgi =3D CGI->new(); > $cookie =3D $cgi->cookie(-name=3D>$session->name, -value=3D>$session->i= d, > -expires=3D>"+1d"); > print $cgi->header(-cookie=3D>$cookie); > > -----Original Message----- > *From:* Senthil Nathan [mailto:rs...@gm...] > *Sent:* Wednesday, October 05, 2005 5:29 AM > *To:* she...@cp... > *Subject:* CGI::Session - query > *Importance:* High > > Hi Sherzod Ruzmetov, > > I need some more examples of using CGI::Session. I read your cookbook. > Could you send me more examples of using CGI::Session module. > > The query is, > How to assign only one session id for a particular user and track his > info.? > I face problems in tracking a session in different windows. I could use > one session for one window. But if the user opens in another window, a ne= w > session is being created. How to restrict this. > > Thanks > Senthil Nathan R > > > |
From: Ron S. <ro...@sa...> - 2005-10-05 22:30:08
|
On Wed, 5 Oct 2005 09:48:07 -0500, Mark Stosberg wrote: Hi Mark > If you need it for your own use-- great! I do. > You are welcome to publish yourself rather than in the main > distribution. That will help keep the maintenance load of the core > distribution lower. That's my plan. -- Cheers Ron Savage, ro...@sa... on 6/10/2005 http://savage.net.au/index.html Let the record show: Microsoft is not an Australian company |
From: Sherzod R. <she...@ha...> - 2005-10-05 17:13:05
|
Use cookies with expiration date. Example: =20 $session =3D CGI::Session->new(); $cgi =3D CGI->new(); =20 $cookie =3D $cgi->cookie(-name=3D>$session->name, = -value=3D>$session->id, -expires=3D>"+1d"); print $cgi->header(-cookie=3D>$cookie); =20 -----Original Message----- From: Senthil Nathan [mailto:rs...@gm...]=20 Sent: Wednesday, October 05, 2005 5:29 AM To: she...@cp... Subject: CGI::Session - query Importance: High Hi Sherzod Ruzmetov, I need some more examples of using CGI::Session. I read your cookbook. = Could you send me more examples of using CGI::Session module. The query is,=20 How to assign only one session id for a particular user and track = his info.?=20 I face problems in tracking a session in different windows. I could use = one session for one window. But if the user opens in another window, a new session is being created. How to restrict this. Thanks Senthil Nathan R=20 |
From: Mark S. <ma...@su...> - 2005-10-05 14:48:38
|
On Wed, Oct 05, 2005 at 08:12:07PM +1000, Ron Savage wrote: > Hi Folks > > Is there any particular reason V 4 does not ship with an Oracle driver? No. > If one needs to be written I'll do it this week. It'll be modelled on the > Postgres driver, but use type BLOB for the a_session column. If you need it for your own use-- great! You are welcome to publish yourself rather than in the main distribution. That will help keep the maintenance load of the core distribution lower. Thanks, Mark |
From: Ron S. <ro...@sa...> - 2005-10-05 10:15:12
|
Hi Folks Is there any particular reason V 4 does not ship with an Oracle driver? If one needs to be written I'll do it this week. It'll be modelled on the Postgres driver, but use type BLOB for the a_session column. -- Cheers Ron Savage, ro...@sa... on 5/10/2005 http://savage.net.au/index.html Let the record show: Microsoft is not an Australian company |
From: Michael R. <mic...@gm...> - 2005-09-27 01:04:04
|
How is one supposed to remove stale or abandoned sessions? (IOW, garbage collection). |
From: Sherzod R. <she...@ha...> - 2005-09-16 03:13:08
|
I think I fixed this problem in revision 225 (checkout http://svn.cromedome.net/ ) by creating driver objects *on-demand*. Now one can use global session objects and still expect it to be flushed to disk properly before program terminates. I just hope I didn't introduce more problems with this "fix". P.S. I know I did introduce a small problem though. Somehow $CGI::Session::File::FileName compatibility tests are failing, *again*. -- Sherzod > -----Original Message----- > From: cgi...@li... > [mailto:cgi...@li...] On > Behalf Of Charles Bailey > Sent: Monday, September 12, 2005 1:35 PM > To: Sherzod Ruzmetov; cgi...@li... > Subject: RE: [Cgi-session-user] (Doc)bug 4.0.2: Automagic flushing > Importance: High > > > --On September 12, 2005 1:35:53 AM -0400 Sherzod Ruzmetov > <she...@ha...> wrote: > > > Charles > > > > At first it sounded like you were answering my question on > why flush isn't > > autoflusing sometimes, but I kind of lost you somewhere in > the middle. > > > >> since the order of global destruction is undefined, it's > >> possible that > >> sub-objects held in the session object will be destroyed > >> before the session > >> itself, so by the time the the call to CGI::Session::flush() > >> is made, the > >> driver may not be defined. > > > > Would you be able to re-create this case in a test script? Since > > sub-objects are held as CGI::Session's attributes, won't they be > > collected AFTER session object is destroyed? > > Sorry; I think I was a little too concise. > > Perl's (current) global destruction phase differs from the usual GC > mechanism in that it doesn't track references or otherwise > try to sort out > relationships among SVs; it just wades in and starts freeing > them up. That > means sub-objects may be destroyed before their parents, etc. > > This isn't usually a problem -- after all, it's global > destruction, so > presumably nobody wants the data anymore. However, objects' DESTROY > methods are called before the object is deallocated, and may > want the data > for just a little bit longer. DESTROY is guaranteed that > simple scalars in > the object will be around (specifically, objects are cleaned > up before > non-blessed refs), but sub-objects may have already been > dumped, leaving > behind an C<undef>. > > To avoid this, one either has to insure that objects are > undefined (go out > of scope, are C<undef>d, or the like) before global > destruction, or the > DESTROY method must test for the existence of each > sub-object, and recover > appropriately if it's "mysteriously" disappeared. The first > option is more > common -- it's free if one follows the recommended practice of using > lexicals/strict for most purposes, since the lexicals will go > out of scope > before global destruction starts. One can also used END > blocks or other > cleanup handlers to free up objects that need to be global. > > As far as reproducing the problem, here's a short script that > demonstrates > the basic issue: > > #!/usr/local/bin/perl -W > use Data::Dumper; > $foo = bless {NAME => 'globifoo'}, 'Foo'; > $bar = bless {NAME => 'globibar'}, 'Bar'; > $bar->{Foo} = $foo; > my $mfoo = bless { NAME => 'lexifoo' }, 'Foo'; > my $mbar = bless { NAME => 'lexibar' }, 'Bar'; > $mbar->{Foo} = $mfoo; > sub Bar::DESTROY { > print Data::Dumper->Dump([ $_[0] ], [ $_[0]->{NAME} ]); > } > > The tough thing is that, since global destruction is > "unordered", it's > often a heisenbug. For instance, if one moves the definition of > Bar::DESTROY up in the test script, the problem resolves (on > my machine > using 5.9.2; YMMV). > > For CGI::Session, the following does it for me: > > #!/usr/local/bin/perl -W > use CGI::Session; > $sess = new CGI::Session; > print "Session id is", $sess->id; > > No session data is saved to disk, and the "(in cleanup) Can't > call method > "store" on undefined value" warning is generated. > > > So far few people complained about session not being automatically > > flushed, but no one was able to recreate the problem in a > test script. > > I'm not sure whether they're seeing this problem, but it'd be > on the list > of suspects if they're using globals and relying on automagic > flushing. > Turning on warnings and seeing something like the above in > the error log, > or resolution of the problem when a cleanup handler is added > would help to > confirm the source of trouble. > > I hope this helps. > > -- > Regards, > Charles Bailey < bailey _at_ newman _dot_ upenn _dot_ edu > > Newman Center at the University of Pennsylvania > > > ------------------------------------------------------- > SF.Net email is Sponsored by the Better Software Conference & EXPO > September 19-22, 2005 * San Francisco, CA * Development > Lifecycle Practices > Agile & Plan-Driven Development * Managing Projects & Teams * > Testing & QA > Security * Process Improvement & Measurement * > http://www.sqe.com/bsce5sf > _______________________________________________ > Cgi-session-user mailing list > Cgi...@li... > https://lists.sourceforge.net/lists/listinfo/cgi-session-user > > |
From: Vahid H. <vah...@bu...> - 2005-09-15 14:23:57
|
Hi Sherzod Thanks for your help on this, I have upgraded the CGI::Session to latest version and it seems to be working but I am still having issues with it Test results from your scripts html : Testing CGI::Session 4.02 CGISESSID : a893c42c62d59c4a8c08a53be003a5cc Counter: 1Testing CGI::Session 4.02 CGISESSID : a893c42c62d59c4a8c08a53be003a5cc Counter: 2 Test script now works fine it keeps the counter going up with same session ID, the file test failed on 2: not ok 2 - found session data file # Failed test (/home/vahid/test.pl at line 11) 1..2 # Looks like you failed 1 test of 2. !/usr/bin/perl use File::Spec; use Test::More qw/no_plan/; use strict; use CGI::Session; my $dir = File::Spec->catdir('t', '/tmp/'); my $id; my $ses = CGI::Session->new(undef,undef,{Directory=> $dir }); $id = $ses->id(); ok($id, "found session id"); ok(-r "$dir/cgisess_".$id, "found session data file"); <--line 11 It now seems to be keeping same session ID but fails to bring back any values from it.. the user i log in with seems to remain as the correct user as it first logs in but when a link is clicked on which refreshes the script, it keeps same session ID but username value is not set.. The only time it has brought back correct value is after logging in whcih calls &view directly which then loads in the menu system.. the menu system kept returning guest too upon loggin in until i asked it to look up gname from $session->param values, but either way still no good since once a link is clicked on the username becomes guest... :( top of script.. &init_session; $gname=$session->param("un"); print "---$gname---"; if ($act eq '' ) { &startup(); } else { &$act; } the first procedure it hits after user logs in the bit that loads in view has the correct username .. sub login { $username=$cgi->param('username'); $pass=$cgi->param('pass'); if (($pass eq '') || ($username eq '' ) ) { print "<hr size=3 width=100%>"; print "Missing Fields please hit back and try again - process halted"; print "<hr size=3 width=100%>"; } else { my $result = $ldap->bind("uid=$username,$base", password=>$pass); if($result->is_error()){ my $errorMessage = $result->error(); print "<p class=td align=center><font size=5>$errorMessage<br>"; print "hit back and try again - process halted</p>"; } else { $session->param("un", $username); $gname=$session->param("un"); print "<p class=td align=center>Welcome $username you are now logged in</p>"; &view(); } } } sub init_session { $sid = $cgi->cookie('CGISESSID') || $cgi->param('CGISESSID') || undef; $session = new CGI::Session(undef, $sid, {Directory=>'/tmp'}); $sid=$session->id; $gname=$session->param("un"); } sub menu { $gname=$session->param("un"); if ($gname eq '') { $gname="Guest"; } rint <<"EOF"; <a href=/cgi-bin/$formname?act=logout>LOGOUT</a> | | <a href=/cgi-bin/$formname?act=logbook>LOGBOOK</a> | </td></tr><tr><td class=td bgcolor=#FF0000 align=right> SESSION ID: $sid | USERNAME: $gname | IP ADDRESS: $ipaddress </table> EOF } } } sub view { my $dle=$cgi->param('dle'); my $type=$cgi->param('type'); if ($type eq '') { if ( ($dle eq '')) { &dbi_search(); } else { &dbi_search($dle); } } else { &dbi_search("$type"); } } sub dbi_search { &menu(); ..... } Thanks Vahid Sherzod Ruzmetov wrote: >Vahid, > >You seriously have to upgrade. The one you're using right now is 4 years, >and at least 20 releases old. Get the most recent from >http://search.cpan.org/dist/CGI-Session/ . > >Re-try those two scripts, and let us know. > >-- >Sherzod > > > > > > >>-----Original Message----- >>From: cgi...@li... >>[mailto:cgi...@li...] On >>Behalf Of Vahid Hedayati >>Sent: Wednesday, September 14, 2005 9:57 AM >>To: cgi...@li... >>Subject: Re: [Cgi-session-user] CGI::Session does not seem to >>be working for me >>Importance: High >> >> >>The below test fails it keeps resetting session ID's and counter >>remains on 1.. >> >> >> Testing CGI::Session 3.1.4.1 >> >> >> CGISESSID : dbaaf2e4bb0fdc16982906e6c8ff880c >> >> >> Counter: 1 >> >> >> Testing CGI::Session 3.1.4.1 >> >> >> CGISESSID : a1b974c2eef270e24dd42ed4a8803f18 >> >> >> Counter: 1 >> >> >>I also saw another posting so i thought i try out the script >>the below >>script fails on section 2 >> >>ok 1 - found session id >>not ok 2 - found session data file >># Failed test (./test.pl at line 16) >>1..2 >># Looks like you failed 1 test of 2. >> >>#!/usr/bin/perl -w >> use File::Spec; >> use Test::More qw/no_plan/; >> >> use CGI::Session; >> >> if (CGI::Session->VERSION >= 4) { >> *CGI::Session::DESTROY = sub { >> my $s = shift; >> $s->flush() or die >>"Flush seems to >> have failed: ".$s->errstr; >> }; >> } >> >> my $dir = File::Spec->catdir('t', 'sessiondata'); >> my $id; >> my $ses = CGI::Session->new(undef,undef,{Directory=> $dir }); >> $id = $ses->id(); >> ok($id, "found session id"); >> END { ok(-r "$dir/cgisess_".$id, "found session data file"); } >> >> >> >> >> >> >>Sherzod Ruzmetov wrote: >> >> >> >>>Vahid >>> >>>Try the following short script to test. If everything goes >>> >>> >>well, you should >> >> >>>see a persistent session id, and a counter which should >>> >>> >>increment each time >> >> >>>the page is revisited or refreshed (see >>>http://author.handalak.com/cgi-bin/session ). If it doesn't, >>> >>> >>there really is >> >> >>>a problem and we'll work on it. >>> >>>P.S. You would discover this eventually, but you should look into >>>CGI::Application and HTML::Template (Or Template Toolkit). >>> >>> >>The way you're >> >> >>>doing things right now (with if/else, and embedded 'HTML'), >>> >>> >>you can only go >> >> >>>so far. >>> >>> >>>#!/usr/bin/perl -w >>> >>>use strict; >>>use CGI; >>>use CGI::Carp ('fatalsToBrowser'); >>>use CGI::Session; >>> >>>my $query = CGI->new(); >>>my $session = CGI::Session->new(undef, undef, {Directory=>'/tmp'}); >>>my $counter = $session->param('counter') || 0; >>>$session->param('counter', ++$counter); >>> >>>my $cookie = $query->cookie(-name=>$session->name, >>> >>> >>-value=>$session->id, >> >> >>>-expires=>"+1h"); >>>print $query->header(-cookie=>$cookie), >>> $query->start_html("CGI::Session - " . $session->VERSION), >>> $query->h1("Testing CGI::Session " . $session->VERSION), >>> $query->h2($session->name . " : " . $session->id), >>> $query->h3("Counter: $counter"), >>> $query->end_html(); >>> >>>If it works, there's a problem with your code. >>> >>> >>> >>> >>> >>> >>> >>>>-----Original Message----- >>>>From: cgi...@li... >>>>[mailto:cgi...@li...] On >>>>Behalf Of Vahid Hedayati >>>>Sent: Monday, September 12, 2005 11:26 AM >>>>To: cgi...@li... >>>>Subject: [Cgi-session-user] CGI::Session does not seem to be >>>>working for me >>>>Importance: High >>>> >>>> >>>>CGI::Session version (3) / Perl v.5.8.6 : on FreeBSD 4.7 >>>> >>>>I have been trying for many hours to get CGI::Session to work: >>>> >>>>Here is my outcome after many hours of online searching testing: >>>> >>>>Trying to run a cgi script which authenticates after step 1 >>>> >>>> >>and then >> >> >>>>runs specfic actions once authenticated.. >>>> >>>>Here is the web results: >>>> >>>> >>>>_____+++++++ >>>>Original Session ID is >>>>++++ >>>> >>>>Welcome vahid you are now logged in >>>> >>>>Global username = vahid ::: 8d257f413fab17680ea94a176b3d71a6Clik me >>>><http://logmgr/cgi-bin/Provision2.cgi?act=vf> >>>> >>>>__________________Once clicked shows no STORED Session ID >>>>and no global >>>>username at the bottom has a new SESSION ID: --> >>>> >>>>___+++++++ >>>>Original Session ID is >>>>++++ >>>>Global username = ::: 6afdaa81cb7c88dc195e1aaab41adf59Clik me >>>><http://logmgr/cgi-bin/Provision2.cgi?act=vf> >>>> >>>> >>>>Basically what ever i have tried i end up with new session ids.. >>>> >>>> >>>>here is the code: >>>> >>>> >>>>This is the top of the script: >>>> >>>> >>>> >>>>if ($act eq '' ) { >>>> $cg = new CGI; >>>> $session = new CGI::Session(undef,undef,{Directory=>"/tmp/"}); >>>> $cookie = $cg->cookie(CGISESSID => $session->id); >>>> print $cg->header( -cookie=>$cookie ); >>>> $sid=$session->id; >>>> print "Session ID is $sid<br>"; >>>> &startup(); >>>>} else { >>>> $cg = new CGI; >>>> $sid=$cg->cookie("CGISESSID"); >>>> print "_____$sid+++++++<br>"; >>>> $session = new CGI::Session(undef,$sid,{Directory=>"/tmp/"}); >>>> print "Original Session ID is $sid<br>"; >>>> $sid = $session->id(); >>>> print "++++$sid_____<br>"; >>>> &$act; >>>>} >>>> >>>>sub startup { >>>> >>>>$value="logon2.htm"; >>>>&do($value); >>>>} >>>> >>>> >>>> >>>>sub login { >>>>$username=$cgi->param(username); >>>>$pass=$cgi->param(pass); >>>>if (($pass eq '') || ($username eq '' ) ) { >>>> print "<hr size=3 width=100%>"; >>>> print "Missing Fields please hit back and try again - >>>>process halted"; >>>> print "<hr size=3 width=100%>"; >>>>} else { >>>> my $result = $ldap->bind("uid=$username,$base", password=>$pass); >>>> if($result->is_error()){ >>>> my $errorMessage = $result->error(); >>>> print "$errorMessage"; >>>> } else { >>>> $session->param( "user_name","$username" ); >>>> print "<p class=td align=center>Welcome $username you are now >>>>logged in</p>"; >>>> &vf; >>>> # print >>>>"<script>\nwindow.location.replace(\"/cgi-bin/$formname?act=vf >>>>\");\n</script>"; >>>> } >>>>} >>>>} >>>> >>>>sub vf { >>>> #$gname= cookie($gusername); >>>> $gname = $session->param("user_name"); >>>> >>>> print "Global username = $gname ::: $sid"; >>>> print "<a href=/cgi-bin/Provision2.cgi?act=vf>Clik me</a>"; >>>>} >>>> >>>> >>>> >>>> >>>> >>>>------------------------------------------------------- >>>>SF.Net email is Sponsored by the Better Software Conference & EXPO >>>>September 19-22, 2005 * San Francisco, CA * Development >>>>Lifecycle Practices >>>>Agile & Plan-Driven Development * Managing Projects & Teams * >>>>Testing & QA >>>>Security * Process Improvement & Measurement * >>>>http://www.sqe.com/bsce5sf >>>>_______________________________________________ >>>>Cgi-session-user mailing list >>>>Cgi...@li... >>>>https://lists.sourceforge.net/lists/listinfo/cgi-session-user >>>> >>>> >>>> >>>> >>>> >>>> >>> >>> >>> >>> >> >>------------------------------------------------------- >>SF.Net email is sponsored by: >>Tame your development challenges with Apache's Geronimo App >>Server. Download >>it for free - -and be entered to win a 42" plasma tv or your very own >>Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php >>_______________________________________________ >>Cgi-session-user mailing list >>Cgi...@li... >>https://lists.sourceforge.net/lists/listinfo/cgi-session-user >> >> >> >> > > > >------------------------------------------------------- >SF.Net email is sponsored by: >Tame your development challenges with Apache's Geronimo App Server. Download >it for free - -and be entered to win a 42" plasma tv or your very own >Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php >_______________________________________________ >Cgi-session-user mailing list >Cgi...@li... >https://lists.sourceforge.net/lists/listinfo/cgi-session-user > > |
From: Sherzod R. <she...@ha...> - 2005-09-14 19:32:32
|
Vahid, You seriously have to upgrade. The one you're using right now is 4 years, and at least 20 releases old. Get the most recent from http://search.cpan.org/dist/CGI-Session/ . Re-try those two scripts, and let us know. -- Sherzod > -----Original Message----- > From: cgi...@li... > [mailto:cgi...@li...] On > Behalf Of Vahid Hedayati > Sent: Wednesday, September 14, 2005 9:57 AM > To: cgi...@li... > Subject: Re: [Cgi-session-user] CGI::Session does not seem to > be working for me > Importance: High > > > The below test fails it keeps resetting session ID's and counter > remains on 1.. > > > Testing CGI::Session 3.1.4.1 > > > CGISESSID : dbaaf2e4bb0fdc16982906e6c8ff880c > > > Counter: 1 > > > Testing CGI::Session 3.1.4.1 > > > CGISESSID : a1b974c2eef270e24dd42ed4a8803f18 > > > Counter: 1 > > > I also saw another posting so i thought i try out the script > the below > script fails on section 2 > > ok 1 - found session id > not ok 2 - found session data file > # Failed test (./test.pl at line 16) > 1..2 > # Looks like you failed 1 test of 2. > > #!/usr/bin/perl -w > use File::Spec; > use Test::More qw/no_plan/; > > use CGI::Session; > > if (CGI::Session->VERSION >= 4) { > *CGI::Session::DESTROY = sub { > my $s = shift; > $s->flush() or die > "Flush seems to > have failed: ".$s->errstr; > }; > } > > my $dir = File::Spec->catdir('t', 'sessiondata'); > my $id; > my $ses = CGI::Session->new(undef,undef,{Directory=> $dir }); > $id = $ses->id(); > ok($id, "found session id"); > END { ok(-r "$dir/cgisess_".$id, "found session data file"); } > > > > > > > Sherzod Ruzmetov wrote: > > >Vahid > > > >Try the following short script to test. If everything goes > well, you should > >see a persistent session id, and a counter which should > increment each time > >the page is revisited or refreshed (see > >http://author.handalak.com/cgi-bin/session ). If it doesn't, > there really is > >a problem and we'll work on it. > > > >P.S. You would discover this eventually, but you should look into > >CGI::Application and HTML::Template (Or Template Toolkit). > The way you're > >doing things right now (with if/else, and embedded 'HTML'), > you can only go > >so far. > > > > > >#!/usr/bin/perl -w > > > >use strict; > >use CGI; > >use CGI::Carp ('fatalsToBrowser'); > >use CGI::Session; > > > >my $query = CGI->new(); > >my $session = CGI::Session->new(undef, undef, {Directory=>'/tmp'}); > >my $counter = $session->param('counter') || 0; > >$session->param('counter', ++$counter); > > > >my $cookie = $query->cookie(-name=>$session->name, > -value=>$session->id, > >-expires=>"+1h"); > >print $query->header(-cookie=>$cookie), > > $query->start_html("CGI::Session - " . $session->VERSION), > > $query->h1("Testing CGI::Session " . $session->VERSION), > > $query->h2($session->name . " : " . $session->id), > > $query->h3("Counter: $counter"), > > $query->end_html(); > > > >If it works, there's a problem with your code. > > > > > > > > > > > >>-----Original Message----- > >>From: cgi...@li... > >>[mailto:cgi...@li...] On > >>Behalf Of Vahid Hedayati > >>Sent: Monday, September 12, 2005 11:26 AM > >>To: cgi...@li... > >>Subject: [Cgi-session-user] CGI::Session does not seem to be > >>working for me > >>Importance: High > >> > >> > >>CGI::Session version (3) / Perl v.5.8.6 : on FreeBSD 4.7 > >> > >>I have been trying for many hours to get CGI::Session to work: > >> > >>Here is my outcome after many hours of online searching testing: > >> > >>Trying to run a cgi script which authenticates after step 1 > and then > >>runs specfic actions once authenticated.. > >> > >>Here is the web results: > >> > >> > >>_____+++++++ > >>Original Session ID is > >>++++ > >> > >>Welcome vahid you are now logged in > >> > >>Global username = vahid ::: 8d257f413fab17680ea94a176b3d71a6Clik me > >><http://logmgr/cgi-bin/Provision2.cgi?act=vf> > >> > >>__________________Once clicked shows no STORED Session ID > >>and no global > >>username at the bottom has a new SESSION ID: --> > >> > >>___+++++++ > >>Original Session ID is > >>++++ > >>Global username = ::: 6afdaa81cb7c88dc195e1aaab41adf59Clik me > >><http://logmgr/cgi-bin/Provision2.cgi?act=vf> > >> > >> > >>Basically what ever i have tried i end up with new session ids.. > >> > >> > >>here is the code: > >> > >> > >>This is the top of the script: > >> > >> > >> > >>if ($act eq '' ) { > >> $cg = new CGI; > >> $session = new CGI::Session(undef,undef,{Directory=>"/tmp/"}); > >> $cookie = $cg->cookie(CGISESSID => $session->id); > >> print $cg->header( -cookie=>$cookie ); > >> $sid=$session->id; > >> print "Session ID is $sid<br>"; > >> &startup(); > >>} else { > >> $cg = new CGI; > >> $sid=$cg->cookie("CGISESSID"); > >> print "_____$sid+++++++<br>"; > >> $session = new CGI::Session(undef,$sid,{Directory=>"/tmp/"}); > >> print "Original Session ID is $sid<br>"; > >> $sid = $session->id(); > >> print "++++$sid_____<br>"; > >> &$act; > >>} > >> > >>sub startup { > >> > >> $value="logon2.htm"; > >> &do($value); > >>} > >> > >> > >> > >>sub login { > >> $username=$cgi->param(username); > >> $pass=$cgi->param(pass); > >> if (($pass eq '') || ($username eq '' ) ) { > >> print "<hr size=3 width=100%>"; > >> print "Missing Fields please hit back and try again - > >>process halted"; > >> print "<hr size=3 width=100%>"; > >> } else { > >> my $result = $ldap->bind("uid=$username,$base", password=>$pass); > >> if($result->is_error()){ > >> my $errorMessage = $result->error(); > >> print "$errorMessage"; > >> } else { > >> $session->param( "user_name","$username" ); > >> print "<p class=td align=center>Welcome $username you are now > >>logged in</p>"; > >> &vf; > >> # print > >>"<script>\nwindow.location.replace(\"/cgi-bin/$formname?act=vf > >>\");\n</script>"; > >> } > >> } > >>} > >> > >>sub vf { > >> #$gname= cookie($gusername); > >> $gname = $session->param("user_name"); > >> > >> print "Global username = $gname ::: $sid"; > >> print "<a href=/cgi-bin/Provision2.cgi?act=vf>Clik me</a>"; > >>} > >> > >> > >> > >> > >> > >>------------------------------------------------------- > >>SF.Net email is Sponsored by the Better Software Conference & EXPO > >>September 19-22, 2005 * San Francisco, CA * Development > >>Lifecycle Practices > >>Agile & Plan-Driven Development * Managing Projects & Teams * > >>Testing & QA > >>Security * Process Improvement & Measurement * > >>http://www.sqe.com/bsce5sf > >>_______________________________________________ > >>Cgi-session-user mailing list > >>Cgi...@li... > >>https://lists.sourceforge.net/lists/listinfo/cgi-session-user > >> > >> > >> > >> > > > > > > > > > > ------------------------------------------------------- > SF.Net email is sponsored by: > Tame your development challenges with Apache's Geronimo App > Server. Download > it for free - -and be entered to win a 42" plasma tv or your very own > Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php > _______________________________________________ > Cgi-session-user mailing list > Cgi...@li... > https://lists.sourceforge.net/lists/listinfo/cgi-session-user > > |
From: Vahid H. <vah...@bu...> - 2005-09-14 13:56:54
|
The below test fails it keeps resetting session ID's and counter remains on 1.. Testing CGI::Session 3.1.4.1 CGISESSID : dbaaf2e4bb0fdc16982906e6c8ff880c Counter: 1 Testing CGI::Session 3.1.4.1 CGISESSID : a1b974c2eef270e24dd42ed4a8803f18 Counter: 1 I also saw another posting so i thought i try out the script the below script fails on section 2 ok 1 - found session id not ok 2 - found session data file # Failed test (./test.pl at line 16) 1..2 # Looks like you failed 1 test of 2. #!/usr/bin/perl -w use File::Spec; use Test::More qw/no_plan/; use CGI::Session; if (CGI::Session->VERSION >= 4) { *CGI::Session::DESTROY = sub { my $s = shift; $s->flush() or die "Flush seems to have failed: ".$s->errstr; }; } my $dir = File::Spec->catdir('t', 'sessiondata'); my $id; my $ses = CGI::Session->new(undef,undef,{Directory=> $dir }); $id = $ses->id(); ok($id, "found session id"); END { ok(-r "$dir/cgisess_".$id, "found session data file"); } Sherzod Ruzmetov wrote: >Vahid > >Try the following short script to test. If everything goes well, you should >see a persistent session id, and a counter which should increment each time >the page is revisited or refreshed (see >http://author.handalak.com/cgi-bin/session ). If it doesn't, there really is >a problem and we'll work on it. > >P.S. You would discover this eventually, but you should look into >CGI::Application and HTML::Template (Or Template Toolkit). The way you're >doing things right now (with if/else, and embedded 'HTML'), you can only go >so far. > > >#!/usr/bin/perl -w > >use strict; >use CGI; >use CGI::Carp ('fatalsToBrowser'); >use CGI::Session; > >my $query = CGI->new(); >my $session = CGI::Session->new(undef, undef, {Directory=>'/tmp'}); >my $counter = $session->param('counter') || 0; >$session->param('counter', ++$counter); > >my $cookie = $query->cookie(-name=>$session->name, -value=>$session->id, >-expires=>"+1h"); >print $query->header(-cookie=>$cookie), > $query->start_html("CGI::Session - " . $session->VERSION), > $query->h1("Testing CGI::Session " . $session->VERSION), > $query->h2($session->name . " : " . $session->id), > $query->h3("Counter: $counter"), > $query->end_html(); > >If it works, there's a problem with your code. > > > > > >>-----Original Message----- >>From: cgi...@li... >>[mailto:cgi...@li...] On >>Behalf Of Vahid Hedayati >>Sent: Monday, September 12, 2005 11:26 AM >>To: cgi...@li... >>Subject: [Cgi-session-user] CGI::Session does not seem to be >>working for me >>Importance: High >> >> >>CGI::Session version (3) / Perl v.5.8.6 : on FreeBSD 4.7 >> >>I have been trying for many hours to get CGI::Session to work: >> >>Here is my outcome after many hours of online searching testing: >> >>Trying to run a cgi script which authenticates after step 1 and then >>runs specfic actions once authenticated.. >> >>Here is the web results: >> >> >>_____+++++++ >>Original Session ID is >>++++ >> >>Welcome vahid you are now logged in >> >>Global username = vahid ::: 8d257f413fab17680ea94a176b3d71a6Clik me >><http://logmgr/cgi-bin/Provision2.cgi?act=vf> >> >>__________________Once clicked shows no STORED Session ID >>and no global >>username at the bottom has a new SESSION ID: --> >> >>___+++++++ >>Original Session ID is >>++++ >>Global username = ::: 6afdaa81cb7c88dc195e1aaab41adf59Clik me >><http://logmgr/cgi-bin/Provision2.cgi?act=vf> >> >> >>Basically what ever i have tried i end up with new session ids.. >> >> >>here is the code: >> >> >>This is the top of the script: >> >> >> >>if ($act eq '' ) { >> $cg = new CGI; >> $session = new CGI::Session(undef,undef,{Directory=>"/tmp/"}); >> $cookie = $cg->cookie(CGISESSID => $session->id); >> print $cg->header( -cookie=>$cookie ); >> $sid=$session->id; >> print "Session ID is $sid<br>"; >> &startup(); >>} else { >> $cg = new CGI; >> $sid=$cg->cookie("CGISESSID"); >> print "_____$sid+++++++<br>"; >> $session = new CGI::Session(undef,$sid,{Directory=>"/tmp/"}); >> print "Original Session ID is $sid<br>"; >> $sid = $session->id(); >> print "++++$sid_____<br>"; >> &$act; >>} >> >>sub startup { >> >> $value="logon2.htm"; >> &do($value); >>} >> >> >> >>sub login { >> $username=$cgi->param(username); >> $pass=$cgi->param(pass); >> if (($pass eq '') || ($username eq '' ) ) { >> print "<hr size=3 width=100%>"; >> print "Missing Fields please hit back and try again - >>process halted"; >> print "<hr size=3 width=100%>"; >> } else { >> my $result = $ldap->bind("uid=$username,$base", password=>$pass); >> if($result->is_error()){ >> my $errorMessage = $result->error(); >> print "$errorMessage"; >> } else { >> $session->param( "user_name","$username" ); >> print "<p class=td align=center>Welcome $username you are now >>logged in</p>"; >> &vf; >> # print >>"<script>\nwindow.location.replace(\"/cgi-bin/$formname?act=vf >>\");\n</script>"; >> } >> } >>} >> >>sub vf { >> #$gname= cookie($gusername); >> $gname = $session->param("user_name"); >> >> print "Global username = $gname ::: $sid"; >> print "<a href=/cgi-bin/Provision2.cgi?act=vf>Clik me</a>"; >>} >> >> >> >> >> >>------------------------------------------------------- >>SF.Net email is Sponsored by the Better Software Conference & EXPO >>September 19-22, 2005 * San Francisco, CA * Development >>Lifecycle Practices >>Agile & Plan-Driven Development * Managing Projects & Teams * >>Testing & QA >>Security * Process Improvement & Measurement * >>http://www.sqe.com/bsce5sf >>_______________________________________________ >>Cgi-session-user mailing list >>Cgi...@li... >>https://lists.sourceforge.net/lists/listinfo/cgi-session-user >> >> >> >> > > > |