|
who -> html for web pages [by Erik Niese-Petersen] |
|
|
|
Posted Wednesday, August 12th @ 11:39:00 PM, by George Greer in the Utils dept.
. Click the link below to read it or download it.
From: Erik Niese-Petersen <Tenp@cris.com>
Subject: Re: [Circle] who2html
On Mon, 5 Aug 1996, Cyber Reaper wrote:
> before I make it has anyone made an snippet to port who to a HTML file so
> that people at your web page can see who is on at the moment. if not could I
> get a few pointers. first where would I put it so that it is updated say...
> once every 30 seconds, second, what command is used to write to an ansii
> file? I know the command to read, but not write. thank you.
Here is a fast example.. Not sorted. Show mortals and all immortal
who are not invis..
[NOT tested! So typos and other bugs.. Blame me.. :) But it give you an idea]
void make_who2html(void) {
extern struct descriptor_data *descriptor_list;
FILE *opf;
struct descriptor_data *d;
struct char_data *ch;
if ((opf = fopen("~/public_html/who_on_mud.tmp", "w")) == 0)
return; /* or log it ? *shrug* */
fprintf(opf, "<HTML><HEAD><TITLE>Who is on the MUD?</TITLE></HEAD>\n");
fprintf(opf, "<BODY><H1>Who play right now?</H1><HR>\n");
for(d = descriptor_list; d; d = d->next)
if(!d->connected) {
if(d->original)
ch = d->original;
else if (!(ch = d->character)
continue;
if(GET_LEVEL(ch) < LVL_IMMORT || (GET_LEVEL(ch)>=LVL_IMMORT &&
!GET_INVIS_LEV(ch))) {
sprintf(buf, "[%2d %s] %s %s\n", GET_LEVEL(ch), GET_ABBR(ch),
GET_NAME(ch), GET_TITLE(ch));
fprintf(opf, buf);
}
}
fprintf(opf, "<HR></BODY></HTML>\n");
fclose(opf);
system("mv ~/public_html/who_on_mud.tmp ~/public_html/who_on_mud.html &");
}
Hope it helps.
<< Who command update [by Nashak] | Reply | View as text | Threaded | Whois command [by Primacy] >> |
|
Related Links |
|
|
|
CircleMUD Snippets |
|
|
Note: Not all of these snippets will work perfectly with
your version of code, so be prepared to fix one
or two bugs that may arise, and please let me know
what you needed to do to fix it. Sending a corrected
version is always welcome.
|
Finally, if you wish to use any of the snippets from this
page, you are more than welcome, just mention the
authors in your credits. If you wish to release any
of these snippets to the public on another site,
contact me FIRST.
|
|
|
|
|
|
|