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=\"/showuser&who=");
133 urlescputs(wlist->username);
135 escputs(wlist->username);
138 /* (link to page this user) */
139 wprintf("<A HREF=\"/display_page&recp=");
140 urlescputs(wlist->username);
141 wprintf("\">(p)</A>");
144 wprintf("</FONT></TD>\n\t<TD><FONT SIZE=-1>");
145 escputs(wlist->roomname);
146 wprintf("</FONT></TD>\n\t<TD><FONT SIZE=-1>");
148 escputs(wlist->hostname);
149 wprintf("</FONT></TD>\n</TR>");
155 wprintf("</TABLE></CENTER>\n");
160 void terminate_session(void)
164 serv_printf("TERM %s", bstr("which_session"));
171 * Change your session info (fake roomname and hostname)
177 if (!strcasecmp(bstr("sc"), "Change room name")) {
178 serv_printf("RCHG %s", bstr("fake_roomname"));
180 http_redirect("/whobbs");
181 } else if (!strcasecmp(bstr("sc"), "Change host name")) {
182 serv_printf("HCHG %s", bstr("fake_hostname"));
184 http_redirect("/whobbs");
185 } else if (!strcasecmp(bstr("sc"), "Change user name")) {
186 serv_printf("UCHG %s", bstr("fake_username"));
188 http_redirect("/whobbs");
189 } else if (!strcasecmp(bstr("sc"), "Cancel")) {
190 http_redirect("/whobbs");
195 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=000077><TR><TD>");
196 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"><B>");
197 wprintf("Edit your session display");
198 wprintf("</B></FONT></TD></TR></TABLE>\n");
199 wprintf("This screen allows you to change the way your\n");
200 wprintf("session appears in the 'Who is online' listing.\n");
201 wprintf("To turn off any 'fake' name you've previously\n");
202 wprintf("set, simply click the appropriate 'change' button\n");
203 wprintf("without typing anything in the corresponding box.\n");
206 wprintf("<FORM METHOD=\"POST\" ACTION=\"/edit_me\">\n");
208 wprintf("<TABLE border=0 width=100%%>\n");
210 wprintf("<TR><TD><B>Room name:</B></TD>\n<TD>");
211 wprintf("<INPUT TYPE=\"text\" NAME=\"fake_roomname\" MAXLENGTH=\"64\">\n");
212 wprintf("</TD>\n<TD ALIGN=center>");
213 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Change room name\">");
214 wprintf("</TD>\n</TR>\n");
216 wprintf("<TR><TD><B>Host name:</B></TD><TD>");
217 wprintf("<INPUT TYPE=\"text\" NAME=\"fake_hostname\" MAXLENGTH=\"64\">\n");
218 wprintf("</TD>\n<TD ALIGN=center>");
219 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Change host name\">");
220 wprintf("</TD>\n</TR>\n");
223 wprintf("<TR><TD><B>User name:</B></TD><TD>");
224 wprintf("<INPUT TYPE=\"text\" NAME=\"fake_username\" MAXLENGTH=\"64\">\n");
225 wprintf("</TD>\n<TD ALIGN=center>");
226 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Change user name\">");
227 wprintf("</TD>\n</TR>\n");
229 wprintf("<TR><TD> </TD><TD> </TD><TD ALIGN=center>");
230 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
231 wprintf("</TD></TR></TABLE>\n");
233 wprintf("</FORM></CENTER>\n");