home *** CD-ROM | disk | FTP | other *** search
- [[.import name=cookie]]
- [[.import name=session args="'session_dir', '/tmp'"]]
- <html><body>
- [[-- retrieve session information --]]
- [[\
- sessionid = cookie.get('session')
- if sessionid:
- num = session.get(sessionid)
- if num==None:
- sessionid = None
- num = 0
- else: num = int(num)
- else: num = 0
- ]]
- [[-- output --]]
- Your session ID was: [[=sessionid]]<br>
- [[num = num + 1]]
- You have visited this page [[=num]] time(s).<br>
- [[-- save session information for next time --]]
- [[\
- sessionid = session.set( num, 10, sessionid )
- if sessionid: cookie.set('session', sessionid)
- ]]
- Your session ID is now: [[=sessionid]]<br>
- Session expiration = 10 seconds.<br>
- <b>Note:</b> This example requires write access to
- the /tmp directory to function correctly.
- </body></html>
-