12 #include <sys/types.h>
14 #include <sys/socket.h>
17 #include <netinet/in.h>
39 char clientsoftware[256];
47 struct whouser *wlist = NULL;
48 struct whouser *wptr = NULL;
49 char buf[256], sess, user[256], room[256], host[256];
55 wprintf("<SCRIPT LANGUAGE=\"JavaScript\">\n"
56 "function ConfirmKill() { \n"
57 "return confirm('Do you really want to kill this session?');\n"
62 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=007700><TR><TD>");
63 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"<B>Users currently on ");
64 escputs(serv_info.serv_humannode);
65 wprintf("</B></FONT></TD></TR></TABLE>\n");
67 wprintf("<CENTER>\n<TABLE BORDER=1 WIDTH=100%%>\n<TR>\n");
68 wprintf("<TH>Session ID</TH>\n");
69 wprintf("<TH>User Name</TH>\n");
70 wprintf("<TH>Room</TH>");
71 wprintf("<TH>From host</TH>\n</TR>\n");
75 while (serv_gets(buf), strcmp(buf, "000")) {
76 sess = extract_int(buf, 0);
77 extract(user, buf, 1);
78 extract(room, buf, 2);
79 extract(host, buf, 3);
82 for (wptr = wlist; wptr != NULL; wptr = wptr->next) {
83 if (wptr->sessionnum == sess) {
85 if (strcasecmp(user, wptr->username)) {
86 sprintf(buf, "%cBR%c%s",
88 strcat(wptr->username, buf);
90 if (strcasecmp(room, wptr->roomname)) {
91 sprintf(buf, "%cBR%c%s",
93 strcat(wptr->roomname, buf);
95 if (strcasecmp(host, wptr->hostname)) {
96 sprintf(buf, "%cBR%c%s",
98 strcat(wptr->hostname, buf);
104 wptr = (struct whouser *)
105 malloc(sizeof(struct whouser));
108 strcpy(wlist->username, user);
109 strcpy(wlist->roomname, room);
110 strcpy(wlist->hostname, host);
111 wlist->sessionnum = sess;
115 while (wlist != NULL) {
116 wprintf("<TR>\n\t<TD ALIGN=center><FONT SIZE=-1>%d", wlist->sessionnum);
118 (wlist->sessionnum != serv_info.serv_pid)) {
119 wprintf(" <A HREF=\"/terminate_session&which_session=%d&session_owner=", wlist->sessionnum);
120 urlescputs(wlist->username);
121 wprintf("\" onClick=\"return ConfirmKill();\" "
124 if (wlist->sessionnum == serv_info.serv_pid) {
125 wprintf(" <A HREF=\"/edit_me\" "
128 wprintf("</FONT></TD>\n\t<TD><FONT SIZE=-1>");
131 /* username (link to user bio/photo page) */
132 wprintf("<A HREF=\"javascript:window.opener.location='/showuser&who=");
133 urlescputs(wlist->username);
134 wprintf("';window.location='/whobbs'\">");
135 escputs(wlist->username);
139 wprintf("</FONT></TD>\n\t<TD><FONT SIZE=-1>");
140 escputs(wlist->roomname);
141 wprintf("</FONT></TD>\n\t<TD><FONT SIZE=-1>");
143 escputs(wlist->hostname);
144 wprintf("</FONT></TD>\n</TR>");
150 wprintf("</TABLE>\n<BR><BR>\n");
151 wprintf("<TABLE BORDER=0 BGCOLOR=\"#003399\">\n<TR><TD ALIGN=center VALIGN=center CELLPADING=20>\n");
152 wprintf("<B><A HREF=\"javascript:window.close()\">Close window</A></B>\n");
153 wprintf("</TD></TR>\n</TABLE></FONT>\n</CENTER>");
159 void terminate_session(void)
163 serv_printf("TERM %s", bstr("which_session"));
170 * Change your session info (fake roomname and hostname)
176 if (!strcasecmp(bstr("sc"), "Change room name")) {
177 serv_printf("RCHG %s", bstr("fake_roomname"));
179 http_redirect("/whobbs");
180 } else if (!strcasecmp(bstr("sc"), "Change host name")) {
181 serv_printf("HCHG %s", bstr("fake_hostname"));
183 http_redirect("/whobbs");
184 } else if (!strcasecmp(bstr("sc"), "Change user name")) {
185 serv_printf("UCHG %s", bstr("fake_username"));
187 http_redirect("/whobbs");
188 } else if (!strcasecmp(bstr("sc"), "Cancel")) {
189 http_redirect("/whobbs");
194 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=000077><TR><TD>");
195 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"><B>");
196 wprintf("Edit your session display");
197 wprintf("</B></FONT></TD></TR></TABLE>\n");
198 wprintf("This screen allows you to change the way your\n");
199 wprintf("session appears in the 'Who is online' listing.\n");
200 wprintf("To turn off any 'fake' name you've previously\n");
201 wprintf("set, simply click the appropriate 'change' button\n");
202 wprintf("without typing anything in the corresponding box.\n");
205 wprintf("<FORM METHOD=\"POST\" ACTION=\"/edit_me\">\n");
207 wprintf("<TABLE border=0 width=100%%>\n");
209 wprintf("<TR><TD><B>Room name:</B></TD>\n<TD>");
210 wprintf("<INPUT TYPE=\"text\" NAME=\"fake_roomname\" MAXLENGTH=\"64\">\n");
211 wprintf("</TD>\n<TD ALIGN=center>");
212 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Change room name\">");
213 wprintf("</TD>\n</TR>\n");
215 wprintf("<TR><TD><B>Host name:</B></TD><TD>");
216 wprintf("<INPUT TYPE=\"text\" NAME=\"fake_hostname\" MAXLENGTH=\"64\">\n");
217 wprintf("</TD>\n<TD ALIGN=center>");
218 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Change host name\">");
219 wprintf("</TD>\n</TR>\n");
222 wprintf("<TR><TD><B>User name:</B></TD><TD>");
223 wprintf("<INPUT TYPE=\"text\" NAME=\"fake_username\" MAXLENGTH=\"64\">\n");
224 wprintf("</TD>\n<TD ALIGN=center>");
225 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Change user name\">");
226 wprintf("</TD>\n</TR>\n");
228 wprintf("<TR><TD> </TD><TD> </TD><TD ALIGN=center>");
229 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
230 wprintf("</TD></TR></TABLE>\n");
232 wprintf("</FORM></CENTER>\n");