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");
65 "<table border=0 cellspacing=0 width=99%% bgcolor=\"#FFFFFF\">"
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");
171 void terminate_session(void)
175 serv_printf("TERM %s", bstr("which_session"));
182 * Change your session info (fake roomname and hostname)
188 if (!strcasecmp(bstr("sc"), "Change room name")) {
189 serv_printf("RCHG %s", bstr("fake_roomname"));
191 http_redirect("/whobbs");
192 } else if (!strcasecmp(bstr("sc"), "Change host name")) {
193 serv_printf("HCHG %s", bstr("fake_hostname"));
195 http_redirect("/whobbs");
196 } else if (!strcasecmp(bstr("sc"), "Change user name")) {
197 serv_printf("UCHG %s", bstr("fake_username"));
199 http_redirect("/whobbs");
200 } else if (!strcasecmp(bstr("sc"), "Cancel")) {
201 http_redirect("/whobbs");
204 output_headers(1, 1, 0, 0, 0, 0, 0);
206 wprintf("<div id=\"banner\">\n");
207 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>");
208 wprintf("<SPAN CLASS=\"titlebar\">");
209 wprintf("Edit your session display");
210 wprintf("</SPAN></TD></TR></TABLE>\n");
211 wprintf("</div>\n<div id=\"content\">\n");
213 wprintf("This screen allows you to change the way your\n");
214 wprintf("session appears in the 'Who is online' listing.\n");
215 wprintf("To turn off any 'fake' name you've previously\n");
216 wprintf("set, simply click the appropriate 'change' button\n");
217 wprintf("without typing anything in the corresponding box.\n");
220 wprintf("<FORM METHOD=\"POST\" ACTION=\"/edit_me\">\n");
222 wprintf("<TABLE border=0 width=100%%>\n");
224 wprintf("<TR><TD><B>Room name:</B></TD>\n<TD>");
225 wprintf("<INPUT TYPE=\"text\" NAME=\"fake_roomname\" MAXLENGTH=\"64\">\n");
226 wprintf("</TD>\n<TD ALIGN=center>");
227 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Change room name\">");
228 wprintf("</TD>\n</TR>\n");
230 wprintf("<TR><TD><B>Host name:</B></TD><TD>");
231 wprintf("<INPUT TYPE=\"text\" NAME=\"fake_hostname\" MAXLENGTH=\"64\">\n");
232 wprintf("</TD>\n<TD ALIGN=center>");
233 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Change host name\">");
234 wprintf("</TD>\n</TR>\n");
237 wprintf("<TR><TD><B>User name:</B></TD><TD>");
238 wprintf("<INPUT TYPE=\"text\" NAME=\"fake_username\" MAXLENGTH=\"64\">\n");
239 wprintf("</TD>\n<TD ALIGN=center>");
240 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Change user name\">");
241 wprintf("</TD>\n</TR>\n");
243 wprintf("<TR><TD> </TD><TD> </TD><TD ALIGN=center>");
244 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
245 wprintf("</TD></TR></TABLE>\n");
247 wprintf("</FORM></CENTER>\n");