2 * Administrative screen to add/change/delete user accounts
13 #include <sys/types.h>
15 #include <sys/socket.h>
18 #include <netinet/in.h>
32 void select_user_to_edit(char *message)
37 output_headers(3); /* No room banner on this screen */
39 if (message != NULL) wprintf(message);
41 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=007700><TR><TD>");
42 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"<B>"
43 "Add/change/delete user accounts"
44 "</B></FONT></TD></TR></TABLE>\n");
46 wprintf("<TABLE border=0 CELLSPACING=10><TR VALIGN=TOP>"
47 "<TD>To edit an existing user account, select the user "
48 "name from the list and click 'Edit'.<BR><BR>");
50 wprintf("<CENTER><FORM METHOD=\"POST\" ACTION=\"/display_edituser\">\n");
51 wprintf("<SELECT NAME=\"username\" SIZE=10>\n");
55 while (serv_gets(buf), strcmp(buf, "000")) {
56 extract(username, buf, 0);
62 wprintf("</SELECT><BR>\n");
64 wprintf("<input type=submit name=sc value=\"Edit\">");
65 wprintf("</FORM></CENTER>\n");
68 "To create a new user account, enter the desired "
69 "user name in the box below and click 'Create'.<BR><BR>");
71 wprintf("<CENTER><FORM METHOD=\"POST\" ACTION=\"/create_user\">\n");
72 wprintf("New user: ");
73 wprintf("<input type=text name=username><BR>\n"
74 "<input type=submit value=\"Create\">"
75 "</FORM></CENTER>\n");
77 wprintf("</TD></TR></TABLE>\n");
85 * Edit a user. If supplied_username is null, look in the "username"
86 * web variable for the name of the user to edit.
88 void display_edituser(char *supplied_username) {
91 char error_message[SIZ];
93 if (supplied_username != NULL) {
94 strcpy(username, supplied_username);
97 strcpy(username, bstr("username") );
100 serv_printf("AGUP %s", username);
103 sprintf(error_message,
104 "<IMG SRC=\"static/error.gif\" VALIGN=CENTER>"
105 "%s<BR><BR>\n", &buf[4]);
106 select_user_to_edit(error_message);
110 output_headers(3); /* No room banner on this screen */
112 wprintf("this is %s", username);
120 void create_user(void) {
123 char error_message[SIZ];
125 strcpy(username, bstr("username"));
127 serv_printf("CREU %s", username);
131 display_edituser(username);
134 sprintf(error_message,
135 "<IMG SRC=\"static/error.gif\" VALIGN=CENTER>"
136 "%s<BR><BR>\n", &buf[4]);
137 select_user_to_edit(error_message);
143 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=007700><TR><TD>");
144 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"<B>"
145 "Edit user account: ");
147 wprintf("</B></FONT></TD></TR></TABLE>\n");