summaryrefslogtreecommitdiffstats
path: root/php/Attic/examples/sample-idp/user_add.php
diff options
context:
space:
mode:
authorChristophe Nowicki <cnowicki@easter-eggs.com>2004-09-08 15:43:51 +0000
committerChristophe Nowicki <cnowicki@easter-eggs.com>2004-09-08 15:43:51 +0000
commit070e552257daeb15c24dce902b6d9d1a17d7b15d (patch)
treebe1686d42f4db2c70b682c6b1390b8e04e979485 /php/Attic/examples/sample-idp/user_add.php
parenta0e6291fb2482f5c926ab2599c2d85a80f9f59ab (diff)
downloadlasso-070e552257daeb15c24dce902b6d9d1a17d7b15d.tar.gz
lasso-070e552257daeb15c24dce902b6d9d1a17d7b15d.tar.xz
lasso-070e552257daeb15c24dce902b6d9d1a17d7b15d.zip
added edit sp metadata to the setup system
Diffstat (limited to 'php/Attic/examples/sample-idp/user_add.php')
-rw-r--r--php/Attic/examples/sample-idp/user_add.php52
1 files changed, 33 insertions, 19 deletions
diff --git a/php/Attic/examples/sample-idp/user_add.php b/php/Attic/examples/sample-idp/user_add.php
index ff363f28..c763d3de 100644
--- a/php/Attic/examples/sample-idp/user_add.php
+++ b/php/Attic/examples/sample-idp/user_add.php
@@ -22,9 +22,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
-?>
-<?php
require_once 'HTML/QuickForm.php';
require_once 'DB.php';
@@ -38,38 +35,52 @@
$form->addRule('username', 'Please enter the Username', 'required', null, 'client');
$form->addRule('password', 'Please enter the Password', 'required', null, 'client');
- if ($form->validate()) {
-
- $config = unserialize(file_get_contents('config.inc'));
+ if ($form->validate())
+ {
+ $config = unserialize(file_get_contents('config.inc'));
- $db = &DB::connect($config['dsn']);
- if (DB::isError($db))
+ $db = &DB::connect($config['dsn']);
+ if (DB::isError($db))
die($db->getMessage());
- $query = "INSERT INTO users (user_id, username, password) VALUES(nextval('user_id_seq'),'";
- $query .= $form->exportValue('username') . "','" . $form->exportValue('password') . "')";
+ $query = "INSERT INTO users (user_id, username, password) VALUES(nextval('user_id_seq'),'";
+ $query .= $form->exportValue('username') . "','" . $form->exportValue('password') . "')";
- $res =& $db->query($query);
- if (DB::isError($db))
- die($db->getMessage());
-
- $db->disconnect();
+ $res =& $db->query($query);
+ if (DB::isError($res))
+ die("username exist!");
+ $db->disconnect();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
-<body onLoad="window.close()">
+<script type="text/javascript">
+<!--
+ function reload_and_close()
+ {
+ opener.document.location.reload();
+ window.close();
+ }
+
+// -->
+</script>
+</head>
+<body onLoad="reload_and_close();">
</body>
</html>
<?php
- exit;
- }
+ }
+ else
+ {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
-<body>
+<head>
+ <title>Add User</title>
+</head>
+<body onLoad="window.focus();">
<?php
$form->display();
?>
@@ -77,3 +88,6 @@
<p>Copyright &copy; 2004 Entr'ouvert</p>
</body>
</html>
+<?php
+ }
+?>