Update of /cvsroot/phpbt/phpbt
In directory usw-pr-cvs1:/tmp/cvs-serv20009
Modified Files:
strings-en.php user.php
Log Message:
Starting on the user page - allow for password changes
Index: strings-en.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/strings-en.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- strings-en.php 2001/06/27 13:41:21 1.4
+++ strings-en.php 2001/07/10 04:01:54 1.5
@@ -28,7 +28,8 @@
'nousers' => 'No users found',
'bugbadperm' => 'You cannot change this bug',
'bugbadnum' => 'That bug does not exist',
- 'datecollision' => 'Someone has updated this bug since you viewed it. The bug info has been reloaded with the latest changes.'
+ 'datecollision' => 'Someone has updated this bug since you viewed it. The bug info has been reloaded with the latest changes.',
+ 'passwordmatch' => 'Those passwords don\'t match -- please try again'
);
// Page titles
Index: user.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/user.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- user.php 2001/02/03 18:06:04 1.1
+++ user.php 2001/07/10 04:01:54 1.2
@@ -1,5 +1,46 @@
-<html>
-<body>
-<div align="center">Nothing here yet</div>
-</body>
-</html>
+<?php
+
+// user.php - Preferences page
+
+include 'include.php';
+
+page_open(array('sess' => 'usess', 'auth' => 'uauth', 'perm' => 'uperm'));
+
+$u = $auth->auth['uid'];
+
+function change_password($pass1, $pass2) {
+ global $t, $q, $u, $STRING;
+
+ if (!$pass1 = trim($pass1)) $error = $STRING['givepassword'];
+ elseif ($pass1 != $pass2) $error = $STRING['passwordmatch'];
+
+ if ($error) {
+ show_password_form($error);
+ return;
+ }
+
+ $q->query("update User set Password = '$pass1' where UserID = $u");
+ $t->set_file('content', 'passwordchanged.html');
+}
+
+function show_password_form($error = '') {
+ global $t, $pass1, $pass2;
+
+ $t->set_file('content', 'passwordform.html');
+ $t->set_var(array(
+ 'error' => $error ? $error.'<br><br>' : '',
+ 'pass1' => $pass1,
+ 'pass2' => $pass2
+ ));
+}
+
+$t->set_file('wrap', 'wrap.html');
+
+if ($do) change_password($pass1, $pass2);
+else show_password_form();
+
+$t->pparse('main', array('content', 'wrap', 'main'));
+
+page_close();
+
+?>
|