cvs: peardoc /en/package/http/http-session2 cookies.xml intro.xml
[email protected] ("Till Klampaeckel")
| Newsgroups | php.pear.doc |
|---|---|
| Message-ID | <cvstill1197920825@cvsserver> |
till Mon Dec 17 19:47:05 2007 UTC
Modified files:
/peardoc/en/package/http/http-session2 cookies.xml intro.xml
Log:
* another attempt to fix all English (thanks Mark)
* extended documentation on using session_set_cookie_params()
http://cvs.php.net/viewvc.cgi/peardoc/en/package/http/http-session2/cookies.xml?r1=1.2&r2=1.3&diff_format=u
Index: peardoc/en/package/http/http-session2/cookies.xml
diff -u peardoc/en/package/http/http-session2/cookies.xml:1.2 peardoc/en/package/http/http-session2/cookies.xml:1.3
--- peardoc/en/package/http/http-session2/cookies.xml:1.2 Mon Dec 17 12:33:41 2007
+++ peardoc/en/package/http/http-session2/cookies.xml Mon Dec 17 19:47:05 2007
@@ -1,4 +1,4 @@
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
<refentry id="package.http.http-session2.cookies">
<refnamediv>
<refname>Making a session persistant</refname>
@@ -12,20 +12,27 @@
<title>Explaination</title>
<para>
- <classname>HTTP_Session2</classname> provides an OO interface to standard PHP
- session_* calls. When you create a session it needs to be referenced using a
- sessionID. This sessionID is generally saved into a cookie to make it last
- across browser sessions. To extend the lifetime of this cookie (the standard is
+ When you create a session it needs to be referenced using a sessionID. This
+ sessionID is generally saved either into a cookie or passed along in the URI.
+ </para>
+
+ <para>
+ To remember the sessionID across browser sessions, the cookie method is favoured.
+ </para>
+
+ <para>
+ To extend the lifetime of this cookie (the standard is
that it's only valid until the browser is closed) we use PHP's
- session_set_cookie_params.
+ session_set_cookie_params().
</para>
+
</refsect1>
<refsect1 id="package.http.http-session2.cookies.examples">
<title>Example</title>
<example>
- <title>Using MDB2 to store session data in a database</title>
+ <title>Use of session_set_cookie_params</title>
<programlisting role="php">
require_once 'HTTP/Session2.php';
http://cvs.php.net/viewvc.cgi/peardoc/en/package/http/http-session2/intro.xml?r1=1.2&r2=1.3&diff_format=u
Index: peardoc/en/package/http/http-session2/intro.xml
diff -u peardoc/en/package/http/http-session2/intro.xml:1.2 peardoc/en/package/http/http-session2/intro.xml:1.3
--- peardoc/en/package/http/http-session2/intro.xml:1.2 Mon Dec 17 12:33:41 2007
+++ peardoc/en/package/http/http-session2/intro.xml Mon Dec 17 19:47:05 2007
@@ -1,4 +1,4 @@
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
<refentry id="package.http.http-session2.intro">
<refnamediv>
<refname>Introduction</refname>
@@ -13,9 +13,12 @@
<para>
This package provides access to session-state values as well as session-level
settings and lifetime management methods.
- Based on the standart <acronym>PHP</acronym> session handling mechanism it
- provides more advanced features such as database containers, idle and expire
- timeouts, etc..
+ </para>
+
+ <para>
+ Based on the standart <acronym>PHP</acronym> session handling mechanism
+ HTTP_Session2 provides more advanced features such as database containers,
+ idle and expire timeouts and more.
</para>
</refsect1>
@@ -31,9 +34,10 @@
HTTP_Session2::start('MySessionID');
HTTP_Session2::set('variable', 'The string');
if (HTTP_Session2::isNew()) {
- echo('new session was created with the current request');
+ echo 'new session was created with the current request';
$visitors++; // Increase visitors count
}
+// continue
</programlisting>
</example>
@@ -46,13 +50,13 @@
HTTP_Session2::setExpire(time() + 60 * 60); // expires in one hour
HTTP_Session2::setIdle(time() + 10 * 60); // idles in ten minutes
-// expired
+// the session expired
if (HTTP_Session2::isExpired()) {
- echo 'Your session is expired!';
+ echo 'Your session has expired!';
HTTP_Session2::destroy();
}
-// session is idlec
+// the session is idle
if (HTTP_Session2::isIdle()) {
echo "You've been idle for too long!";
HTTP_Session2::destroy();
@@ -64,7 +68,7 @@
</example>
<para>
- For a more comprehensive example of persistant sessions, check the cookie section.
+ For a more comprehensive example of persistant sessions, please check the cookie section.
</para>
</refsect1>