4 * Display a list of all users currently logged on to the Citadel server.
13 #include <sys/types.h>
15 #include <sys/socket.h>
18 #include <netinet/in.h>
38 char buf[SIZ], sess, user[SIZ], room[SIZ], host[SIZ],
39 realroom[SIZ], realhost[SIZ];
44 output_headers(1, 1, 2, 0, 1, 0, 0);
46 wprintf("<script type=\"text/javascript\">\n"
47 "function ConfirmKill() { \n"
48 "return confirm('Do you really want to kill this session?');\n"
53 wprintf("<div id=\"banner\">\n");
54 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>");
55 wprintf("<IMG SRC=\"/static/users-icon.gif\" ALT=\" \" ALIGN=MIDDLE>");
56 wprintf("<SPAN CLASS=\"titlebar\"> Users currently on ");
57 escputs(serv_info.serv_humannode);
58 wprintf("</SPAN></TD><TD ALIGN=RIGHT>");
60 wprintf("</TD></TR></TABLE>\n");
62 "<div id=\"content\">\n");
64 do_template("beginbox_nt");
66 "<TABLE BORDER=0 CELLSPACING=0 WIDTH=100%%>\n<TR>\n");
67 wprintf("<TH COLSPAN=4>Session ID</TH>\n");
68 wprintf("<TH>User Name</TH>\n");
69 wprintf("<TH>Room</TH>");
70 wprintf("<TH>From host</TH>\n</TR>\n");
75 now = extract_long(&buf[4], 0);
84 while (serv_gets(buf), strcmp(buf, "000")) {
85 sess = extract_int(buf, 0);
86 extract(user, buf, 1);
87 extract(room, buf, 2);
88 extract(host, buf, 3);
89 extract(realroom, buf, 9);
90 extract(realhost, buf, 10);
91 last_activity = extract_long(buf, 5);
94 wprintf("<TR BGCOLOR=\"#%s\">",
95 (bg ? "DDDDDD" : "FFFFFF")
99 wprintf("<TD>%d</TD><TD>", sess);
101 (sess != WC->ctdl_pid)) {
102 wprintf(" <A HREF=\"/terminate_session&which_session=%d&session_owner=", sess);
104 wprintf("\" onClick=\"return ConfirmKill();\" "
107 if (sess == WC->ctdl_pid) {
108 wprintf(" <A HREF=\"/edit_me\" "
113 /* (link to page this user) */
114 wprintf("<TD><A HREF=\"/display_page&recp=");
117 "<IMG ALIGN=MIDDLE WIDTH=20 HEIGHT=15 "
118 "SRC=\"/static/page.gif\" "
120 " BORDER=0></A> ");
125 if ((now - last_activity) > 900L) {
128 "SRC=\"/static/idle.gif\" "
129 "ALT=\"[idle]\" BORDER=0>");
131 wprintf("</TD>\n\t<TD>");
135 /* username (link to user bio/photo page) */
136 wprintf("<A HREF=\"/showuser&who=");
143 wprintf("</TD>\n\t<TD>");
145 if (strlen(realroom) > 0) {
146 wprintf("<br /><I>");
150 wprintf("</TD>\n\t<TD>");
154 if (strlen(realhost) > 0) {
155 wprintf("<br /><I>");
159 wprintf("</TD>\n</TR>");
163 "Click on a name to read user info. Click on "
164 "<IMG ALIGN=MIDDLE SRC=\"/static/page.gif\" ALT=\"(p)\" "
166 "a page (instant message) to that user.<br /></CENTER>\n");
167 do_template("endbox");
172 void terminate_session(void)
176 serv_printf("TERM %s", bstr("which_session"));
183 * Change your session info (fake roomname and hostname)
189 if (!strcasecmp(bstr("sc"), "Change room name")) {
190 serv_printf("RCHG %s", bstr("fake_roomname"));
192 http_redirect("/whobbs");
193 } else if (!strcasecmp(bstr("sc"), "Change host name")) {
194 serv_printf("HCHG %s", bstr("fake_hostname"));
196 http_redirect("/whobbs");
197 } else if (!strcasecmp(bstr("sc"), "Change user name")) {
198 serv_printf("UCHG %s", bstr("fake_username"));
200 http_redirect("/whobbs");
201 } else if (!strcasecmp(bstr("sc"), "Cancel")) {
202 http_redirect("/whobbs");
205 output_headers(1, 1, 0, 0, 0, 0, 0);
207 wprintf("<div id=\"banner\">\n");
208 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>");
209 wprintf("<SPAN CLASS=\"titlebar\">");
210 wprintf("Edit your session display");
211 wprintf("</SPAN></TD></TR></TABLE>\n");
212 wprintf("</div>\n<div id=\"content\">\n");
214 wprintf("This screen allows you to change the way your\n");
215 wprintf("session appears in the 'Who is online' listing.\n");
216 wprintf("To turn off any 'fake' name you've previously\n");
217 wprintf("set, simply click the appropriate 'change' button\n");
218 wprintf("without typing anything in the corresponding box.\n");
221 wprintf("<FORM METHOD=\"POST\" ACTION=\"/edit_me\">\n");
223 wprintf("<TABLE border=0 width=100%%>\n");
225 wprintf("<TR><TD><B>Room name:</B></TD>\n<TD>");
226 wprintf("<INPUT TYPE=\"text\" NAME=\"fake_roomname\" MAXLENGTH=\"64\">\n");
227 wprintf("</TD>\n<TD ALIGN=center>");
228 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Change room name\">");
229 wprintf("</TD>\n</TR>\n");
231 wprintf("<TR><TD><B>Host name:</B></TD><TD>");
232 wprintf("<INPUT TYPE=\"text\" NAME=\"fake_hostname\" MAXLENGTH=\"64\">\n");
233 wprintf("</TD>\n<TD ALIGN=center>");
234 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Change host name\">");
235 wprintf("</TD>\n</TR>\n");
238 wprintf("<TR><TD><B>User name:</B></TD><TD>");
239 wprintf("<INPUT TYPE=\"text\" NAME=\"fake_username\" MAXLENGTH=\"64\">\n");
240 wprintf("</TD>\n<TD ALIGN=center>");
241 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Change user name\">");
242 wprintf("</TD>\n</TR>\n");
244 wprintf("<TR><TD> </TD><TD> </TD><TD ALIGN=center>");
245 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
246 wprintf("</TD></TR></TABLE>\n");
248 wprintf("</FORM></CENTER>\n");