"Fossies" - the Fresh Open Source Software Archive 
Member "proma-0.8.3/pages/change.inc.php" (25 Oct 2007, 3063 Bytes) of package /linux/privat/old/proma-0.8.3.tar.gz:
The requested HTML page contains a <FORM> tag that is unusable on "Fossies" in "automatic" (rendered) mode so that page is shown as HTML source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 <?php
2
3 /* ProMA (ProFTPd MySQL Admin), Copyright (C) 2002-2007 Stein Magnus Jodal
4 * ProMA comes with ABSOLUTELY NO WARRANTY.
5 * This is free software, and you are welcome to redistribute it
6 * under the terms of the GNU General Public License.
7 * Read 'COPYING' for further information.
8 */
9
10 /* ProMA Change Account Information Page
11 * $Id: change.inc.php,v 1.8 2007/10/25 19:13:35 jodal Exp $
12 */
13
14 ?>
15
16 <h2>Change Account Information</h2>
17
18 <?php
19
20 if (!empty($_POST["submit"])) {
21 // If the change form is submitted and should be processed
22
23 $old_userid = addslashes($_POST["old_userid"]);
24 $old_passwd = addslashes($_POST["old_passwd"]);
25 $new_userid = addslashes($_POST["new_userid"]);
26 $new_passwd1 = addslashes($_POST["new_passwd1"]);
27 $new_passwd2 = addslashes($_POST["new_passwd2"]);
28
29 if ($old_userid == "" || $old_passwd == "" || $new_passwd1 != $new_passwd2) {
30 print "<p>Old userid or password is empty, or new passwords are not identical. <a href=\"?page=change\">Try again</a></p>\n";
31 } else {
32
33 if ($new_userid == "" && $new_passwd1 != "") {
34 $query = "UPDATE
35 $table_users
36 SET
37 $users_passwd = PASSWORD('$new_passwd1')
38 WHERE
39 $users_userid = '$old_userid' AND
40 $users_passwd = PASSWORD('$old_passwd')";
41 } elseif ($new_userid != "" && $new_passwd1 == "") {
42 $query = "UPDATE
43 $table_users
44 SET
45 $users_userid = '$new_userid'
46 WHERE
47 $users_userid = '$old_userid' AND
48 $users_passwd = PASSWORD('$old_passwd')";
49 } elseif ($new_userid != "" && $new_passwd1 != "") {
50 $query = "UPDATE
51 $table_users
52 SET
53 $users_userid = '$new_userid',
54 $users_passwd = PASSWORD('$new_passwd1')
55 WHERE
56 $users_userid = '$old_userid' AND
57 $users_passwd = PASSWORD('$old_passwd')";
58 }
59
60 if (isset($query)) {
61 $result = mysql_query($query) or die("Failed to query database.");
62 $affected = mysql_affected_rows($link);
63
64 if ($affected == 1) {
65 print "<p>Changes performed without problems.</p>\n";
66 } elseif ($affected == 0) {
67 print "<p>Error: Possible password mismatch. <a href=\"?page=change\">Try again</a></p>\n";
68 }
69 } else {
70 print "<p>No values to update with. <a href=\"?page=change\">Try again</a></p>\n";
71 }
72 }
73
74 } else {
75 // If the change form is not submitted, print it
76 ?>
77
78 <form action="?page=change" method="post">
79
80 <h3>Old Information</h3>
81
82 <table>
83 <tr>
84 <th class="thv">Userid</th>
85 <td><input type="text" name="old_userid" /> Required</td>
86 </tr>
87
88 <tr>
89 <th class="thv">Password</th>
90 <td><input type="password" name="old_passwd" /> Required</td>
91 </tr>
92 </table>
93
94 <h3>New Information</h3>
95
96 <table>
97 <tr>
98 <th class="thv">Userid</th>
99 <td><input type="text" name="new_userid" />
100 Only required if changing userid</td>
101 </tr>
102
103 <tr>
104 <th class="thv">Password</th>
105 <td><input type="password" name="new_passwd1" />
106 Only required if changing password</td>
107 </tr>
108
109 <tr>
110 <th class="thv">Password</th>
111 <td><input type="password" name="new_passwd2" />
112 Repeat password if changing</td>
113 </tr>
114 </table>
115
116 <p><input type="submit" name="submit" value="Change" /></p>
117
118 </form>
119
120 <?php
121 }
122 ?>