~ubuntu-branches/ubuntu/utopic/lasso/utopic-proposed

« back to all changes in this revision

Viewing changes to php/examples/sample-sp/register.php

  • Committer: Bazaar Package Importer
  • Author(s): Frederic Peters
  • Date: 2004-09-13 09:26:34 UTC
  • Revision ID: james.westby@ubuntu.com-20040913092634-01vdfl8j9cp94exa
Tags: upstream-0.4.1
ImportĀ upstreamĀ versionĀ 0.4.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/*  
 
3
 * Service Provider Example -- Register Form
 
4
 *
 
5
 * Copyright (C) 2004 Entr'ouvert
 
6
 * http://lasso.entrouvert.org
 
7
 * 
 
8
 * Authors: Christophe Nowicki <cnowicki@easter-eggs.com>
 
9
 *
 
10
 * This program is free software; you can redistribute it and/or modify
 
11
 * it under the terms of the GNU General Public License as published by
 
12
 * the Free Software Foundation; either version 2 of the License, or
 
13
 * (at your option) any later version.
 
14
 * 
 
15
 * This program is distributed in the hope that it will be useful,
 
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
18
 * GNU General Public License for more details.
 
19
 * 
 
20
 * You should have received a copy of the GNU General Public License
 
21
 * along with this program; if not, write to the Free Software
 
22
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
23
 */
 
24
 
 
25
  $config = unserialize(file_get_contents('config.inc'));
 
26
  
 
27
  require_once 'DB.php';
 
28
  
 
29
  if (!empty($_GET['SID'])) 
 
30
        session_start($_GET['SID']);
 
31
  else
 
32
        session_start();
 
33
 
 
34
  if (!isset($_SESSION["nameidentifier"])) {
 
35
        print "User is not logged in";
 
36
        exit(0);
 
37
        }
 
38
 
 
39
        switch($_POST['action']) {
 
40
          case "submit":
 
41
                $db = &DB::connect($config['dsn']);
 
42
 
 
43
                if (DB::isError($db)) 
 
44
                  die($db->getMessage());
 
45
 
 
46
                $query = "UPDATE users SET first_name='" . $_POST['first_name'] . "',last_name='". $_POST['last_name'] ."' WHERE user_id='".$_SESSION["user_id"]."'";
 
47
                $res =& $db->query($query);
 
48
                if (DB::isError($res)) 
 
49
                  print $res->getMessage(). "\n";
 
50
 
 
51
                $url = "index.php";
 
52
                header("Request-URI: $url");
 
53
                header("Content-Location: $url");
 
54
                header("Location: $url");
 
55
                break;
 
56
          default:
 
57
?>
 
58
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 
59
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
60
<html>
 
61
<head>
 
62
<title>Lasso Service Provider Example : Registration Form</title>
 
63
</head>
 
64
 
 
65
<body>
 
66
<form name='frm' action="<?php echo $PHP_SELF; ?>" method='post'>
 
67
<table align="center">
 
68
<caption>Registration Form</caption>
 
69
<tr>
 
70
  <td>First Name:</td><td><input type='text' name="first_name" maxlength='50'></td>
 
71
</tr>
 
72
<tr>
 
73
  <td>Last Name:</td><td><input type='text' name="last_name" maxlength='50'></td>
 
74
</tr>
 
75
<tr>
 
76
        <td>&nbsp;</td><td><input type='submit' value="Ok"></td>
 
77
</tr>
 
78
</table>
 
79
<input type='hidden' name='action' value='submit'>
 
80
</form>
 
81
 
 
82
</body>
 
83
</html>
 
84
<?php
 
85
}
 
86
?>