summaryrefslogtreecommitdiffstats
path: root/php/Attic/examples/sample-sp/register.php
diff options
context:
space:
mode:
authorChristophe Nowicki <cnowicki@easter-eggs.com>2004-09-20 16:01:08 +0000
committerChristophe Nowicki <cnowicki@easter-eggs.com>2004-09-20 16:01:08 +0000
commit63eda2109992301e9e033f66c5d6f4912b1d56f5 (patch)
treebbb39e8845160a1d3047af1ea058467def2dc4e7 /php/Attic/examples/sample-sp/register.php
parent4909ede99e0a938abdbb27305989f61938783c23 (diff)
PHP session are now stored in the database
A now table was added 'sso_session' for storing information about the PHP Session, it's possible to view logged user Logout destroy the PHP session in the IdP Bug : user can't sso twice ;(
Diffstat (limited to 'php/Attic/examples/sample-sp/register.php')
-rw-r--r--php/Attic/examples/sample-sp/register.php20
1 files changed, 13 insertions, 7 deletions
diff --git a/php/Attic/examples/sample-sp/register.php b/php/Attic/examples/sample-sp/register.php
index 6c1b0152..26c468f5 100644
--- a/php/Attic/examples/sample-sp/register.php
+++ b/php/Attic/examples/sample-sp/register.php
@@ -22,9 +22,20 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
- $config = unserialize(file_get_contents('config.inc'));
-
require_once 'DB.php';
+ require_once 'session.php';
+
+ $config = unserialize(file_get_contents('config.inc'));
+
+ // connect to the data base
+ $db = &DB::connect($config['dsn']);
+ if (DB::isError($db))
+ die($db->getMessage());
+
+ // session handler
+ session_set_save_handler("open_session", "close_session",
+ "read_session", "write_session", "destroy_session", "gc_session");
+
session_start();
if (!isset($_SESSION["nameidentifier"])) {
@@ -34,11 +45,6 @@
switch($_POST['action']) {
case "submit":
- $db = &DB::connect($config['dsn']);
-
- if (DB::isError($db))
- die($db->getMessage());
-
// Update User info
$query = "UPDATE users SET first_name=" . $db->quoteSmart($_POST['first_name']);
$query .= ",last_name=" . $db->quoteSmart($_POST['last_name']);