B
Bruno Sousa
Hi,
If I uncomment line 14 nothing is displayed and each time the page is
refreshed ( 2 second interval) ruby creates a different file
/tmp/rubysess.*
But if I uncomment lines 17-23 it works, displaying the last access time
and only one session file is created.
Why is that? I don't want to use cgi.out{} and stuff
1 <%
2 require 'cgi'
3 require 'cgi/session'
4 require 'cgi/session/pstore'
5 cgi = CGI.new("html4")
6
7 sess = CGI::Session.new( cgi, 'database_manager' =>
CGI::Session:
Store,
8 "session_key" => "a_test",
9 "session_expires" => Time.now + 1 *
60,
10 "prefix" => "rubysess.")
11 lastaccess = sess["lastaccess"].to_s
12 sess["lastaccess"] = Time.now
13
14 #print '<HTML><BODY>'+lastaccess+'</BODY></HTML>'
15
16 =begin
17 cgi.out{
18 cgi.html {
19 cgi.body(){
20 "Last access time: #{lastaccess}"
21 }
22 }
23 }
24 =end
25
26 sess.close
27
28 %>
If I uncomment line 14 nothing is displayed and each time the page is
refreshed ( 2 second interval) ruby creates a different file
/tmp/rubysess.*
But if I uncomment lines 17-23 it works, displaying the last access time
and only one session file is created.
Why is that? I don't want to use cgi.out{} and stuff
1 <%
2 require 'cgi'
3 require 'cgi/session'
4 require 'cgi/session/pstore'
5 cgi = CGI.new("html4")
6
7 sess = CGI::Session.new( cgi, 'database_manager' =>
CGI::Session:
8 "session_key" => "a_test",
9 "session_expires" => Time.now + 1 *
60,
10 "prefix" => "rubysess.")
11 lastaccess = sess["lastaccess"].to_s
12 sess["lastaccess"] = Time.now
13
14 #print '<HTML><BODY>'+lastaccess+'</BODY></HTML>'
15
16 =begin
17 cgi.out{
18 cgi.html {
19 cgi.body(){
20 "Last access time: #{lastaccess}"
21 }
22 }
23 }
24 =end
25
26 sess.close
27
28 %>