Collaborama About Help Contact Anonymous [login] Source: site.view [edit] Function name: configure Arguments: sessionkey,message,card Description: Page type: webl Render function: Module: magicparties Page source: var ret = nil; // [sessionkey, type, address, price, size, lotSize, beds, baths, features, description]; var msg = ""; var first = "A23456789JQK"; var second = "CHSD0"; message = Str_Trim(message); card = Str_Trim(Str_ToUpperCase(card)); var userInfo = WubCall("siteutil.getSessionInfo", ["mpviv", sessionkey]); if (sessionkey == "nil" or sessionkey == "") then ret = WubCall("magicparties.viv", ["ERR_LOGIN"]) elsif ((Size(card) < 2) or (Size(card) > 3) or (Str_IndexOf(Select(card, 0, 1),first) < 0) or (Str_IndexOf(Select(card, 1, 2),second) < 0)) then msg = "Invalid card, should be something like 7S."; ret = WubCall("magicparties.viv", [sessionkey, msg]) elsif (message == "") then msg = "Please add a default response."; ret = WubCall("magicparties.viv", [sessionkey, msg]) end; // No errors: add it if (ret == nil) then var db = Wub_GetDB("mpviv"); var coll = Wub_GetCollection(db, "config"); var data = [. user = userInfo.username .]; var dbobj = Wub_NewDBObject(data); Wub_RemoveDB(coll, dbobj); data = [. user = userInfo.username, message = message, card = card .]; // add user's information dbobj = Wub_NewDBObject(data); Wub_InsertDB(coll, dbobj); msg = "Updated."; ret = WubCall("magicparties.viv", [sessionkey, msg]); end; ret;