View/Edit #760:tell_www_body

Switch to edit mode.

Name(s): tell_www_body
1:  data = this.location:www_moderator_login()
2:  if (typeof(data) == $STR)
3:    return this.location:www_welcome(data)
4:  endif
5:  player:tell("<H1>", this.location:titlec(), "</H1>")
6:  {id, pw, md, sn} = $list_utils:slice(data[1..4], 2)
7:  data = data[5..$]
8:  users = this.location.users
9:  newname = listassoc(data, "NEWNAME")
10: newpass = listassoc(data, "NEWPASS")
11: if (newname && newpass)
12:   newname = $string_utils:trim(newname[2])
13:   newpass = $string_utils:trim(newpass[2])
14:   newpass || (newpass = "*")
15:   where = $list_utils:iassoc(newname, this.location.users)
16:   if (where == 1 && this == #760)
17:     $msg:mtell("error", "Sorry, you are not allowed to change the Moderator's password for the generic web room.")
18:   elseif (where)
19:     this.location.users[where][1] = newname
20:     this.location.users[where][2] = newpass
21:     newname == id && (pw = newpass)
22:     users = this.location.users
23:   elseif (newname && newpass)
24:     users = this.location.users = {@users, {newname, newpass, {}, {}, "CHECKED", 0}}
25:   endif
26: elseif (delete = listassoc(data, "DELETE"))
27:   if (where = $list_utils:iassoc(delete[2], users))
28:     users = this.location.users = listdelete(users, where)
29:   endif
30: endif
31: player:tell("<H3>Setup page.</H3>")
32: player:tell("To change a password, enter the old name and new password.  The password <B>*</B> allows any password to be used.")
33: player:tell("<FORM><INPUT NAME=\"ID\" TYPE=\"hidden\" VALUE=\"", id, "\"><INPUT NAME=\"PW\" TYPE=\"hidden\" VALUE=\"", pw, "\"><INPUT NAME=\"MD\" TYPE=\"hidden\" VALUE=\"", md, "\"><INPUT NAME=\"SN\" TYPE=\"hidden\" VALUE=\"", random($maxint), "\">")
34: player:tell("<TABLE BORDER=\"0\"><TR><TD>")
35: player:tell("New user:")
36: player:tell("</TD><TD><INPUT NAME=\"NEWNAME\" TYPE=\"text\" VALUE=\"\" SIZE=\"20\"></TD></TR><TR><TD>")
37: player:tell("Password:")
38: player:tell("</TD><TD><INPUT NAME=\"NEWPASS\" TYPE=\"text\" VALUE=\"\" SIZE=\"20\"></TD></TR></TABLE>")
39: player:tell("<INPUT TYPE=\"submit\" VALUE=\"Add new user\"></FORM>")
40: player:tell("<HR>Current number of users: ", length(users))
41: player:tell("<P><TABLE BORDER=\"1\">")
42: player:tell("<TR><TH>Name</TH><TH>Password</TH><TH>Delete</TH></TR>")
43: counter = 0
44: parameters = $www:integrate_cgi({{"ID", id}, {"PW", pw}, {"MD", md}, {"SN", tostr(random($maxint))}})
45: for user in (users)
46:   counter = counter + 1
47:   suspend(0)
48:   delete = counter <= this.protected ? "&nbsp;" | tostr("<A HREF=\"/", toint(this), parameters, "&DELETE=", $string_utils:substitute(user[1], $www.desubst, 1), "\">Delete</A>")
49:   player:tell("<TR><TD>", user[1], "</TD><TD>", user[2], "</TD><TD>", delete, "</TD></TR>")
50: endfor
51: player:tell("</TABLE><P>")
52: player:tell("Back to <A HREF=\"/", toint(this.location), parameters, "&TX=\">", this.location:title(), "</A>...")
53: "Last modified by whiz (#3135) on Wed Jan 24 09:40:56 2007 EST."

Verb arguments: this none this
Verb perms: Readable eXecutable NOT-Debug
Verb owned by: Dax (#789)

You are not logged in.

[home | help | who | search | setup | code]