10 #include <sys/types.h>
12 #include <sys/socket.h>
15 #include <netinet/in.h>
37 char clientsoftware[256];
45 struct whouser *wlist = NULL;
46 struct whouser *wptr = NULL;
47 char buf[256], sess, user[256], room[256], host[256];
53 wprintf("<SCRIPT LANGUAGE=\"JavaScript\">\n"
54 "function ConfirmKill() { \n"
55 "return confirm('Do you really want to kill this session?');\n"
60 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=007700><TR><TD>");
61 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"<B>Users currently on ");
62 escputs(serv_info.serv_humannode);
63 wprintf("</B></FONT></TD></TR></TABLE>\n");
66 "Click on a name to read user info. Click on "
67 "<IMG ALIGN=MIDDLE SRC=\"/static/page.gif\" ALT=\"(p)\" "
69 "a page (instant message) to that user.<BR>"
70 "<TABLE BORDER=1 WIDTH=100%%>\n<TR>\n");
71 wprintf("<TH>Session ID</TH>\n");
72 wprintf("<TH>User Name</TH>\n");
73 wprintf("<TH>Room</TH>");
74 wprintf("<TH>From host</TH>\n</TR>\n");
78 while (serv_gets(buf), strcmp(buf, "000")) {
79 sess = extract_int(buf, 0);
80 extract(user, buf, 1);
81 extract(room, buf, 2);
82 extract(host, buf, 3);
85 for (wptr = wlist; wptr != NULL; wptr = wptr->next) {
86 if (wptr->sessionnum == sess) {
88 if (strcasecmp(user, wptr->username)) {
89 sprintf(buf, "%cBR%c%s",
91 strcat(wptr->username, buf);
93 if (strcasecmp(room, wptr->roomname)) {
94 sprintf(buf, "%cBR%c%s",
96 strcat(wptr->roomname, buf);
98 if (strcasecmp(host, wptr->hostname)) {
99 sprintf(buf, "%cBR%c%s",
101 strcat(wptr->hostname, buf);
107 wptr = (struct whouser *)
108 malloc(sizeof(struct whouser));
111 strcpy(wlist->username, user);
112 strcpy(wlist->roomname, room);
113 strcpy(wlist->hostname, host);
114 wlist->sessionnum = sess;
118 while (wlist != NULL) {
119 wprintf("<TR>\n\t<TD ALIGN=center>%d", wlist->sessionnum);
121 (wlist->sessionnum != serv_info.serv_pid)) {
122 wprintf(" <A HREF=\"/terminate_session&which_session=%d&session_owner=", wlist->sessionnum);
123 urlescputs(wlist->username);
124 wprintf("\" onClick=\"return ConfirmKill();\" "
127 if (wlist->sessionnum == serv_info.serv_pid) {
128 wprintf(" <A HREF=\"/edit_me\" "
131 wprintf("</TD>\n\t<TD>");
133 /* (link to page this user) */
134 wprintf("<A HREF=\"/display_page&recp=");
135 urlescputs(wlist->username);
137 "<IMG ALIGN=MIDDLE SRC=\"/static/page.gif\" "
139 " BORDER=0></A> ");
142 /* username (link to user bio/photo page) */
143 wprintf("<A HREF=\"/showuser&who=");
144 urlescputs(wlist->username);
146 escputs(wlist->username);
151 wprintf("</TD>\n\t<TD>");
152 escputs(wlist->roomname);
153 wprintf("</TD>\n\t<TD>");
155 escputs(wlist->hostname);
156 wprintf("</TD>\n</TR>");
162 wprintf("</TABLE></CENTER>\n");
167 void terminate_session(void)
171 serv_printf("TERM %s", bstr("which_session"));
178 * Change your session info (fake roomname and hostname)
184 if (!strcasecmp(bstr("sc"), "Change room name")) {
185 serv_printf("RCHG %s", bstr("fake_roomname"));
187 http_redirect("/whobbs");
188 } else if (!strcasecmp(bstr("sc"), "Change host name")) {
189 serv_printf("HCHG %s", bstr("fake_hostname"));
191 http_redirect("/whobbs");
192 } else if (!strcasecmp(bstr("sc"), "Change user name")) {
193 serv_printf("UCHG %s", bstr("fake_username"));
195 http_redirect("/whobbs");
196 } else if (!strcasecmp(bstr("sc"), "Cancel")) {
197 http_redirect("/whobbs");
202 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=000077><TR><TD>");
203 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"><B>");
204 wprintf("Edit your session display");
205 wprintf("</B></FONT></TD></TR></TABLE>\n");
206 wprintf("This screen allows you to change the way your\n");
207 wprintf("session appears in the 'Who is online' listing.\n");
208 wprintf("To turn off any 'fake' name you've previously\n");
209 wprintf("set, simply click the appropriate 'change' button\n");
210 wprintf("without typing anything in the corresponding box.\n");
213 wprintf("<FORM METHOD=\"POST\" ACTION=\"/edit_me\">\n");
215 wprintf("<TABLE border=0 width=100%%>\n");
217 wprintf("<TR><TD><B>Room name:</B></TD>\n<TD>");
218 wprintf("<INPUT TYPE=\"text\" NAME=\"fake_roomname\" MAXLENGTH=\"64\">\n");
219 wprintf("</TD>\n<TD ALIGN=center>");
220 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Change room name\">");
221 wprintf("</TD>\n</TR>\n");
223 wprintf("<TR><TD><B>Host name:</B></TD><TD>");
224 wprintf("<INPUT TYPE=\"text\" NAME=\"fake_hostname\" MAXLENGTH=\"64\">\n");
225 wprintf("</TD>\n<TD ALIGN=center>");
226 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Change host name\">");
227 wprintf("</TD>\n</TR>\n");
230 wprintf("<TR><TD><B>User name:</B></TD><TD>");
231 wprintf("<INPUT TYPE=\"text\" NAME=\"fake_username\" MAXLENGTH=\"64\">\n");
232 wprintf("</TD>\n<TD ALIGN=center>");
233 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Change user name\">");
234 wprintf("</TD>\n</TR>\n");
236 wprintf("<TR><TD> </TD><TD> </TD><TD ALIGN=center>");
237 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
238 wprintf("</TD></TR></TABLE>\n");
240 wprintf("</FORM></CENTER>\n");