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) {
90 char error_message[SIZ];
102 if (supplied_username != NULL) {
103 strcpy(username, supplied_username);
106 strcpy(username, bstr("username") );
109 serv_printf("AGUP %s", username);
112 sprintf(error_message,
113 "<IMG SRC=\"static/error.gif\" VALIGN=CENTER>"
114 "%s<BR><BR>\n", &buf[4]);
115 select_user_to_edit(error_message);
119 extract(username, &buf[4], 0);
120 extract(password, &buf[4], 1);
121 flags = extract_int(&buf[4], 2);
122 timescalled = extract_int(&buf[4], 3);
123 msgsposted = extract_int(&buf[4], 4);
124 axlevel = extract_int(&buf[4], 5);
125 usernum = extract_long(&buf[4], 6);
126 lastcall = extract_long(&buf[4], 7);
127 purgedays = extract_long(&buf[4], 8);
129 output_headers(3); /* No room banner on this screen */
130 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=007700><TR><TD>");
131 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"<B>"
132 "Edit user account: ");
134 wprintf("</B></FONT></TD></TR></TABLE>\n");
137 wprintf("this is %s", username);
145 void create_user(void) {
147 char error_message[SIZ];
150 strcpy(username, bstr("username"));
152 serv_printf("CREU %s", username);
156 display_edituser(username);
159 sprintf(error_message,
160 "<IMG SRC=\"static/error.gif\" VALIGN=CENTER>"
161 "%s<BR><BR>\n", &buf[4]);
162 select_user_to_edit(error_message);